FakeModuleInstallUtil

public classFakeModuleInstallUtilextendsObject

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 ModuleInstallResponserepresents the requested modules are already installed on device.

Public Method Summary

static ModuleAvailabilityResponse
createModuleAvailabilityResponse(boolean availability, int availabilityStatus)
Creates a ModuleAvailabilityResponsewith the given availability and the specified availability status code.
static ModuleAvailabilityResponse
createModuleAvailabilityResponse(boolean availability)
Creates a ModuleAvailabilityResponsewith the given availability.
static ModuleInstallIntentResponse
createModuleInstallIntentResponse(PendingIntent pendingIntent)
Creates a ModuleInstallIntentResponsewith the given pending intent that can be used to simulate the install UI flow.
static ModuleInstallStatusUpdate
createModuleInstallStatusUpdate(int sessionId, int installState)
Creates a ModuleInstallStatusUpdatewith the given session id and install state.
static ModuleInstallStatusUpdate
createModuleInstallStatusUpdate(int sessionId, int installState, long bytesDownloaded, long totalBytesToDownload, int errorCode)
Creates a ModuleInstallStatusUpdatewith 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 ModuleInstallStatusUpdatewith the given session id, install state, and error code.
static ModuleInstallStatusUpdate
createModuleInstallStatusUpdate(int sessionId, int installState, long bytesDownloaded, long totalBytesToDownload)
Creates a ModuleInstallStatusUpdatewith the given session id, install state, bytes downloaded, and total bytes to download.
static ModuleInstallResponse
generateModuleInstallResponse()
Generates a ModuleInstallResponsewhen the requested modules are not present on device.

Inherited Method Summary

Fields

public static final ModuleInstallResponseALREADY_INSTALLED_RESPONSE

A ModuleInstallResponserepresents the requested modules are already installed on device.

Public Methods

public static ModuleAvailabilityResponsecreateModuleAvailabilityResponse(boolean availability, int availabilityStatus)

Creates a ModuleAvailabilityResponsewith the given availability and the specified availability status code.

public static ModuleAvailabilityResponsecreateModuleAvailabilityResponse(boolean availability)

Creates a ModuleAvailabilityResponsewith the given availability.

When theavailabilityis set tofalse,the AvailabilityStatuswill be set to ModuleAvailabilityResponse.AvailabilityStatus.STATUS_READY_TO_DOWNLOAD.

public static ModuleInstallIntentResponsecreateModuleInstallIntentResponse(PendingIntent pendingIntent)

Creates a ModuleInstallIntentResponsewith the given pending intent that can be used to simulate the install UI flow.

public static ModuleInstallStatusUpdatecreateModuleInstallStatusUpdate(int sessionId, int installState)

Creates a ModuleInstallStatusUpdatewith the given session id and install state.

Calls to this method will set the ModuleInstallStatusUpdate.ProgressInfotonull.

public static ModuleInstallStatusUpdatecreateModuleInstallStatusUpdate(int sessionId, int installState, long bytesDownloaded, long totalBytesToDownload, int errorCode)

Creates a ModuleInstallStatusUpdatewith the given session id, install state, bytes downloaded, and total bytes to download, and error code.

public static ModuleInstallStatusUpdatecreateModuleInstallStatusUpdate(int sessionId, int installState, int errorCode)

Creates a ModuleInstallStatusUpdatewith the given session id, install state, and error code.

Calls to this method will set the ModuleInstallStatusUpdate.ProgressInfotonull.

public static ModuleInstallStatusUpdatecreateModuleInstallStatusUpdate(int sessionId, int installState, long bytesDownloaded, long totalBytesToDownload)

Creates a ModuleInstallStatusUpdatewith the given session id, install state, bytes downloaded, and total bytes to download.

public static ModuleInstallResponsegenerateModuleInstallResponse()

Generates a ModuleInstallResponsewhen the requested modules are not present on device.