diff options
author | Ben Lin <linben@google.com> | 2016-07-22 18:31:36 -0700 |
---|---|---|
committer | Ben Lin <linben@google.com> | 2016-07-25 17:42:49 +0000 |
commit | 4acc4bd8ac48571219563413aee2508f8e205ae0 (patch) | |
tree | c755166d29b45d78c4025641a6404d6d81e9c196 /packages/DocumentsUI | |
parent | d172ebb612e7e31f16cde2733a586730b697e8fa (diff) |
Potential fix for flaky tests.
1) Fixing orientation of test devices to their natural orientation
(Phone is usually portrait, and most big tablets are landscape). We
unfreeze the orientation at tearDown because if we don't, the device
will be permanently locked to that orientation.
2) Adding closerDrawer() to FileManagementUiTest and RootsUiTest.
Bug: 30190207
Change-Id: Iec90ee8d46fef1acbf5b04fe718810edbf99da0c
(cherry picked from commit 73a59e9a02f09e61037e4fb8275d283f3861fe90)
Diffstat (limited to 'packages/DocumentsUI')
-rw-r--r-- | packages/DocumentsUI/tests/src/com/android/documentsui/ActivityTest.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/DocumentsUI/tests/src/com/android/documentsui/ActivityTest.java b/packages/DocumentsUI/tests/src/com/android/documentsui/ActivityTest.java index 8ad30d71a811..1400fe6ac7d4 100644 --- a/packages/DocumentsUI/tests/src/com/android/documentsui/ActivityTest.java +++ b/packages/DocumentsUI/tests/src/com/android/documentsui/ActivityTest.java @@ -113,14 +113,22 @@ public abstract class ActivityTest<T extends Activity> extends ActivityInstrumen mClient = mResolver.acquireUnstableContentProviderClient(getTestingProviderAuthority()); mDocsHelper = new DocumentsProviderHelper(getTestingProviderAuthority(), mClient); + device.setOrientationNatural(); setupTestingRoots(); launchActivity(); resetStorage(); + + // Since at the launch of activity, ROOT_0 and ROOT_1 have no files, drawer will + // automatically open for phone devices. Espresso register click() as (x, y) MotionEvents, + // so if a drawer is on top of a file we want to select, it will actually click the drawer. + // Thus to start a clean state, we always try to close first. + bots.roots.closeDrawer(); } @Override public void tearDown() throws Exception { + device.unfreezeRotation(); mClient.release(); super.tearDown(); } |