Merge "Fix memory leaks in Settings" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
be13e74deb
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.fuelgauge;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Matchers.anyInt;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
@@ -89,6 +90,7 @@ public class BackgroundActivityPreferenceControllerTest {
|
||||
|
||||
mShadowContext = RuntimeEnvironment.application;
|
||||
FakeFeatureFactory.setupForTest();
|
||||
when(mContext.getApplicationContext()).thenReturn(mContext);
|
||||
when(mContext.getPackageManager()).thenReturn(mPackageManager);
|
||||
when(mContext.getSystemService(Context.APP_OPS_SERVICE)).thenReturn(mAppOpsManager);
|
||||
when(mContext.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
|
||||
@@ -118,7 +120,7 @@ public class BackgroundActivityPreferenceControllerTest {
|
||||
@Test
|
||||
public void testHandlePreferenceTreeClick_restrictApp_showDialog() {
|
||||
doReturn(AppOpsManager.MODE_ALLOWED).when(mAppOpsManager)
|
||||
.checkOpNoThrow(anyInt(), anyInt(), anyString());
|
||||
.checkOpNoThrow(anyInt(), anyInt(), anyString());
|
||||
|
||||
mController.handlePreferenceTreeClick(mPreference);
|
||||
|
||||
@@ -128,7 +130,7 @@ public class BackgroundActivityPreferenceControllerTest {
|
||||
@Test
|
||||
public void testHandlePreferenceTreeClick_unRestrictApp_showDialog() {
|
||||
doReturn(AppOpsManager.MODE_IGNORED).when(mAppOpsManager)
|
||||
.checkOpNoThrow(anyInt(), anyInt(), anyString());
|
||||
.checkOpNoThrow(anyInt(), anyInt(), anyString());
|
||||
|
||||
mController.handlePreferenceTreeClick(mPreference);
|
||||
|
||||
|
Reference in New Issue
Block a user