use of com.android.tools.build.bundletool.testing.FakeDevice in project bundletool by google.
the class DeviceAnalyzerTest method activityManagerFails_propertiesFallback.
@Test
public void activityManagerFails_propertiesFallback() {
FakeDevice fakeDevice = FakeDevice.fromDeviceSpec("id1", DeviceState.ONLINE, mergeSpecs(sdkVersion(26), locales("de-DE"), density(480), abis("armeabi")));
fakeDevice.injectShellCommandOutput("am get-config", () -> "error");
FakeAdbServer fakeAdbServer = new FakeAdbServer(/* hasInitialDeviceList= */
true, /* devices= */
ImmutableList.of(fakeDevice));
fakeAdbServer.init(Paths.get("path/to/adb"));
DeviceSpec spec = new DeviceAnalyzer(fakeAdbServer).getDeviceSpec(Optional.empty());
assertThat(spec.getScreenDensity()).isEqualTo(480);
assertThat(spec.getSupportedAbisList()).containsExactly("armeabi");
assertThat(spec.getSdkVersion()).isEqualTo(26);
assertThat(spec.getSupportedLocalesList()).containsExactly("de-DE");
}
use of com.android.tools.build.bundletool.testing.FakeDevice in project bundletool by google.
the class DeviceAnalyzerTest method extractsDeviceFeatures.
@Test
public void extractsDeviceFeatures() {
FakeDevice fakeDevice = FakeDevice.fromDeviceSpec("id1", DeviceState.ONLINE, mergeSpecs(density(240), locales("en-US"), abis("x86"), sdkVersion(21), deviceFeatures("com.feature1", "com.feature2")));
FakeAdbServer fakeAdbServer = new FakeAdbServer(/* hasInitialDeviceList= */
true, /* devices= */
ImmutableList.of(fakeDevice));
fakeAdbServer.init(Paths.get("path/to/adb"));
DeviceAnalyzer analyzer = new DeviceAnalyzer(fakeAdbServer);
DeviceSpec deviceSpec = analyzer.getDeviceSpec(Optional.empty());
assertThat(deviceSpec.getDeviceFeaturesList()).containsExactly("com.feature1", "com.feature2");
}
Aggregations