Loading packages/SystemUI/tests/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ android:process=":killable" /> </application> <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" <instrumentation android:name="android.testing.TestableInstrumentation" android:targetPackage="com.android.systemui.tests" android:label="Tests for SystemUI"> </instrumentation> Loading packages/SystemUI/tests/src/com/android/systemui/RoundedCornersTest.java +5 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; Loading @@ -30,7 +29,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.app.Fragment; import android.support.test.filters.FlakyTest; import android.support.test.filters.SmallTest; import android.testing.AndroidTestingRunner; import android.view.Display; Loading @@ -48,12 +46,10 @@ import com.android.systemui.tuner.TunablePadding.TunablePaddingService; import com.android.systemui.tuner.TunerService; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(AndroidTestingRunner.class) @FlakyTest @SmallTest public class RoundedCornersTest extends SysuiTestCase { Loading @@ -72,6 +68,7 @@ public class RoundedCornersTest extends SysuiTestCase { mWindowManager = mock(WindowManager.class); mView = spy(new StatusBarWindowView(mContext, null)); when(mStatusBar.getStatusBarWindow()).thenReturn(mView); when(mStatusBar.getNavigationBarWindow()).thenReturn(mView); mContext.putComponent(StatusBar.class, mStatusBar); Display display = mContext.getSystemService(WindowManager.class).getDefaultDisplay(); Loading @@ -94,6 +91,8 @@ public class RoundedCornersTest extends SysuiTestCase { @Test public void testNoRounding() { mContext.getOrCreateTestableResources().addOverride(dimen.rounded_corner_radius, 0); mContext.getOrCreateTestableResources() .addOverride(dimen.rounded_corner_content_padding, 0); mRoundedCorners.start(); // No views added. Loading @@ -107,6 +106,8 @@ public class RoundedCornersTest extends SysuiTestCase { @Test public void testRounding() { mContext.getOrCreateTestableResources().addOverride(dimen.rounded_corner_radius, 20); mContext.getOrCreateTestableResources() .addOverride(dimen.rounded_corner_content_padding, 20); mRoundedCorners.start(); // Add 2 windows for rounded corners (top and bottom). Loading packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java +10 −4 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ import android.util.Log; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; Loading @@ -56,10 +58,14 @@ public abstract class SysuiTestCase { mRealInstrumentation = InstrumentationRegistry.getInstrumentation(); Instrumentation inst = spy(mRealInstrumentation); when(inst.getContext()).thenThrow(new RuntimeException( "SysUI Tests should use SysuiTestCase#getContext or SysuiTestCase#mContext")); when(inst.getTargetContext()).thenThrow(new RuntimeException( "SysUI Tests should use SysuiTestCase#getContext or SysuiTestCase#mContext")); when(inst.getContext()).thenAnswer(invocation -> { throw new RuntimeException( "SysUI Tests should use SysuiTestCase#getContext or SysuiTestCase#mContext"); }); when(inst.getTargetContext()).thenAnswer(invocation -> { throw new RuntimeException( "SysUI Tests should use SysuiTestCase#getContext or SysuiTestCase#mContext"); }); InstrumentationRegistry.registerInstance(inst, InstrumentationRegistry.getArguments()); } Loading packages/SystemUI/tests/src/com/android/systemui/doze/DozeTriggersTest.java +0 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.app.Instrumentation; import android.os.Handler; import android.os.Looper; import android.support.test.InstrumentationRegistry; import android.support.test.filters.FlakyTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; Loading packages/SystemUI/tests/src/com/android/systemui/qs/QSDetailTest.java +1 −3 Original line number Diff line number Diff line Loading @@ -23,10 +23,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import org.junit.After; import org.junit.Ignore; import android.support.test.filters.SmallTest; import android.support.test.filters.FlakyTest; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.testing.TestableLooper.RunWithLooper; Loading @@ -41,6 +38,7 @@ import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.qs.DetailAdapter; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; Loading Loading
packages/SystemUI/tests/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ android:process=":killable" /> </application> <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner" <instrumentation android:name="android.testing.TestableInstrumentation" android:targetPackage="com.android.systemui.tests" android:label="Tests for SystemUI"> </instrumentation> Loading
packages/SystemUI/tests/src/com/android/systemui/RoundedCornersTest.java +5 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; Loading @@ -30,7 +29,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.app.Fragment; import android.support.test.filters.FlakyTest; import android.support.test.filters.SmallTest; import android.testing.AndroidTestingRunner; import android.view.Display; Loading @@ -48,12 +46,10 @@ import com.android.systemui.tuner.TunablePadding.TunablePaddingService; import com.android.systemui.tuner.TunerService; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(AndroidTestingRunner.class) @FlakyTest @SmallTest public class RoundedCornersTest extends SysuiTestCase { Loading @@ -72,6 +68,7 @@ public class RoundedCornersTest extends SysuiTestCase { mWindowManager = mock(WindowManager.class); mView = spy(new StatusBarWindowView(mContext, null)); when(mStatusBar.getStatusBarWindow()).thenReturn(mView); when(mStatusBar.getNavigationBarWindow()).thenReturn(mView); mContext.putComponent(StatusBar.class, mStatusBar); Display display = mContext.getSystemService(WindowManager.class).getDefaultDisplay(); Loading @@ -94,6 +91,8 @@ public class RoundedCornersTest extends SysuiTestCase { @Test public void testNoRounding() { mContext.getOrCreateTestableResources().addOverride(dimen.rounded_corner_radius, 0); mContext.getOrCreateTestableResources() .addOverride(dimen.rounded_corner_content_padding, 0); mRoundedCorners.start(); // No views added. Loading @@ -107,6 +106,8 @@ public class RoundedCornersTest extends SysuiTestCase { @Test public void testRounding() { mContext.getOrCreateTestableResources().addOverride(dimen.rounded_corner_radius, 20); mContext.getOrCreateTestableResources() .addOverride(dimen.rounded_corner_content_padding, 20); mRoundedCorners.start(); // Add 2 windows for rounded corners (top and bottom). Loading
packages/SystemUI/tests/src/com/android/systemui/SysuiTestCase.java +10 −4 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ import android.util.Log; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; Loading @@ -56,10 +58,14 @@ public abstract class SysuiTestCase { mRealInstrumentation = InstrumentationRegistry.getInstrumentation(); Instrumentation inst = spy(mRealInstrumentation); when(inst.getContext()).thenThrow(new RuntimeException( "SysUI Tests should use SysuiTestCase#getContext or SysuiTestCase#mContext")); when(inst.getTargetContext()).thenThrow(new RuntimeException( "SysUI Tests should use SysuiTestCase#getContext or SysuiTestCase#mContext")); when(inst.getContext()).thenAnswer(invocation -> { throw new RuntimeException( "SysUI Tests should use SysuiTestCase#getContext or SysuiTestCase#mContext"); }); when(inst.getTargetContext()).thenAnswer(invocation -> { throw new RuntimeException( "SysUI Tests should use SysuiTestCase#getContext or SysuiTestCase#mContext"); }); InstrumentationRegistry.registerInstance(inst, InstrumentationRegistry.getArguments()); } Loading
packages/SystemUI/tests/src/com/android/systemui/doze/DozeTriggersTest.java +0 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.app.Instrumentation; import android.os.Handler; import android.os.Looper; import android.support.test.InstrumentationRegistry; import android.support.test.filters.FlakyTest; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; Loading
packages/SystemUI/tests/src/com/android/systemui/qs/QSDetailTest.java +1 −3 Original line number Diff line number Diff line Loading @@ -23,10 +23,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import org.junit.After; import org.junit.Ignore; import android.support.test.filters.SmallTest; import android.support.test.filters.FlakyTest; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.testing.TestableLooper.RunWithLooper; Loading @@ -41,6 +38,7 @@ import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.qs.DetailAdapter; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; Loading