use of com.android.settings.testutils.ResolveInfoBuilder in project android_packages_apps_Settings by omnirom.
the class SmartAutoRotateCameraStateControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
final Context context = Mockito.spy(RuntimeEnvironment.application);
final ContentResolver contentResolver = RuntimeEnvironment.application.getContentResolver();
when(context.getContentResolver()).thenReturn(contentResolver);
final PackageManager packageManager = Mockito.mock(PackageManager.class);
when(context.getPackageManager()).thenReturn(packageManager);
doReturn(PACKAGE_NAME).when(packageManager).getRotationResolverPackageName();
mController = new SmartAutoRotateCameraStateController(context, "smart_auto_rotate");
when(mController.isCameraLocked()).thenReturn(false);
final ResolveInfo resolveInfo = new ResolveInfoBuilder(PACKAGE_NAME).build();
resolveInfo.serviceInfo = new ServiceInfo();
when(packageManager.resolveService(any(), anyInt())).thenReturn(resolveInfo);
}
use of com.android.settings.testutils.ResolveInfoBuilder in project android_packages_apps_Settings by omnirom.
the class SmartAutoRotateBatterySaverControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
final Context context = Mockito.spy(RuntimeEnvironment.application);
final ContentResolver contentResolver = RuntimeEnvironment.application.getContentResolver();
when(context.getContentResolver()).thenReturn(contentResolver);
final PackageManager packageManager = Mockito.mock(PackageManager.class);
when(context.getPackageManager()).thenReturn(packageManager);
doReturn(PACKAGE_NAME).when(packageManager).getRotationResolverPackageName();
mController = Mockito.spy(new SmartAutoRotateBatterySaverController(context, "smart_auto_rotate"));
when(mController.isPowerSaveMode()).thenReturn(false);
final ResolveInfo resolveInfo = new ResolveInfoBuilder(PACKAGE_NAME).build();
resolveInfo.serviceInfo = new ServiceInfo();
when(packageManager.resolveService(any(), anyInt())).thenReturn(resolveInfo);
}
use of com.android.settings.testutils.ResolveInfoBuilder in project android_packages_apps_Settings by omnirom.
the class RTTSettingPreferenceControllerTest method setupTestIntent.
private void setupTestIntent() {
final ResolveInfo info = new ResolveInfoBuilder("pkg").setActivity("pkg", "class").build();
final Intent intent = new Intent("com.android.test.action.example");
mShadowPackageManager.addResolveInfoForIntent(intent, info);
}
Aggregations