diff options
author | Felipe Leme <felipeal@google.com> | 2016-10-11 09:17:50 -0700 |
---|---|---|
committer | Felipe Leme <felipeal@google.com> | 2016-10-11 09:26:02 -0700 |
commit | 1ac5441f572c7866a8c5040ae16723fe604960e8 (patch) | |
tree | d88fc2e2d3c9d1e08340cecec025c37695d055c0 /packages/Shell/tests | |
parent | edbaeb814a8dfe3bc65df86a5ffb15cbbc254cae (diff) |
Collapses status bar on teardown so it does not affect other tests.
BUG: 30639703
Test: mmm -j32 frameworks/base/packages/Shell && adb install -r -g ${ANDROID_PRODUCT_OUT}/data/app/ShellTests/ShellTests.apk && adb shell am instrument -e class com.android.shell.BugreportReceiverTest -w com.android.shell.tests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I2635439ac0c033d1ad6b4ba545b8d751f5576b72
Diffstat (limited to 'packages/Shell/tests')
-rw-r--r-- | packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java | 9 | ||||
-rw-r--r-- | packages/Shell/tests/src/com/android/shell/UiBot.java | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java b/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java index dde71ebe5530..b4bfb0124455 100644 --- a/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java +++ b/packages/Shell/tests/src/com/android/shell/BugreportReceiverTest.java @@ -201,7 +201,12 @@ public class BugreportReceiverTest { @After public void tearDown() throws Exception { Log.i(TAG, getName() + ".tearDown()"); - cancelExistingNotifications(); + try { + cancelExistingNotifications(); + } finally { + // Collapses just in case, so a failure here does not compromise tests on other classes. + mUiBot.collapseStatusBar(); + } } @Test @@ -362,7 +367,7 @@ public class BugreportReceiverTest { detailsUi.assertName(NAME); // Sanity check cancelFromNotification(); - mUiBot.closeNotifications(); + mUiBot.collapseStatusBar(); assertDetailsUiClosed(); assertServiceNotRunning(); diff --git a/packages/Shell/tests/src/com/android/shell/UiBot.java b/packages/Shell/tests/src/com/android/shell/UiBot.java index deab7da953fa..e8397659e692 100644 --- a/packages/Shell/tests/src/com/android/shell/UiBot.java +++ b/packages/Shell/tests/src/com/android/shell/UiBot.java @@ -62,7 +62,7 @@ final class UiBot { return getObject(text); } - public void closeNotifications() throws Exception { + public void collapseStatusBar() throws Exception { // TODO: mDevice should provide such method.. StatusBarManager sbm = (StatusBarManager) mInstrumentation.getContext().getSystemService("statusbar"); |