Provides static utility methods to generate fake response objects for module install APIs in tests.
Field Summary
public static final ModuleInstallResponse | ALREADY_INSTALLED_RESPONSE | A
ModuleInstallResponse represents the requested modules are already
installed on device. |
Public Method Summary
static ModuleAvailabilityResponse |
createModuleAvailabilityResponse(boolean availability, int
availabilityStatus)
Creates a
ModuleAvailabilityResponse with the given availability and the
specified availability status code.
|
static ModuleAvailabilityResponse |
createModuleAvailabilityResponse(boolean availability)
Creates a
ModuleAvailabilityResponse with the given availability.
|
static ModuleInstallIntentResponse |
createModuleInstallIntentResponse(PendingIntent
pendingIntent)
Creates a
ModuleInstallIntentResponse with the given pending intent that can
be used to simulate the install UI flow.
|
static ModuleInstallStatusUpdate |
createModuleInstallStatusUpdate(int sessionId, int installState)
Creates a
ModuleInstallStatusUpdate with the given session id and install
state.
|
static ModuleInstallStatusUpdate |
createModuleInstallStatusUpdate(int sessionId, int installState, long
bytesDownloaded, long totalBytesToDownload, int errorCode)
Creates a
ModuleInstallStatusUpdate with the given session id, install state,
bytes downloaded, and total bytes to download, and error code.
|
static ModuleInstallStatusUpdate |
createModuleInstallStatusUpdate(int sessionId, int installState, int
errorCode)
Creates a
ModuleInstallStatusUpdate with the given session id, install state,
and error code.
|
static ModuleInstallStatusUpdate |
createModuleInstallStatusUpdate(int sessionId, int installState, long
bytesDownloaded, long totalBytesToDownload)
Creates a
ModuleInstallStatusUpdate with the given session id, install state,
bytes downloaded, and total bytes to download.
|
static ModuleInstallResponse |
generateModuleInstallResponse()
Generates a
ModuleInstallResponse when the requested modules are not present on
device.
|
Inherited Method Summary
Fields
public static final ModuleInstallResponse ALREADY_INSTALLED_RESPONSE
A
ModuleInstallResponse
represents the requested modules are already installed
on device.
Public Methods
public static ModuleAvailabilityResponse createModuleAvailabilityResponse (boolean availability, int availabilityStatus)
Creates a
ModuleAvailabilityResponse
with the given availability and the specified
availability status code.
public static ModuleAvailabilityResponse createModuleAvailabilityResponse (boolean availability)
Creates a
ModuleAvailabilityResponse
with the given availability.
When the availability
is set to false
, the
AvailabilityStatus
will be set to
ModuleAvailabilityResponse.AvailabilityStatus.STATUS_READY_TO_DOWNLOAD
.
public static ModuleInstallIntentResponse createModuleInstallIntentResponse (PendingIntent pendingIntent)
Creates a
ModuleInstallIntentResponse
with the given pending intent that can be used
to simulate the install UI flow.
public static ModuleInstallStatusUpdate createModuleInstallStatusUpdate (int sessionId, int installState)
Creates a
ModuleInstallStatusUpdate
with the given session id and install state.
Calls to this method will set the
ModuleInstallStatusUpdate.ProgressInfo
to null
.
public static ModuleInstallStatusUpdate createModuleInstallStatusUpdate (int sessionId, int installState, long bytesDownloaded, long totalBytesToDownload, int errorCode)
Creates a
ModuleInstallStatusUpdate
with the given session id, install state, bytes
downloaded, and total bytes to download, and error code.
public static ModuleInstallStatusUpdate createModuleInstallStatusUpdate (int sessionId, int installState, int errorCode)
Creates a
ModuleInstallStatusUpdate
with the given session id, install state, and
error code.
Calls to this method will set the
ModuleInstallStatusUpdate.ProgressInfo
to null
.
public static ModuleInstallStatusUpdate createModuleInstallStatusUpdate (int sessionId, int installState, long bytesDownloaded, long totalBytesToDownload)
Creates a
ModuleInstallStatusUpdate
with the given session id, install state, bytes
downloaded, and total bytes to download.
public static ModuleInstallResponse generateModuleInstallResponse ()
Generates a
ModuleInstallResponse
when the requested modules are not present on
device.