From 5fb3a45a53f93b78f3097c771977e2cffb83f839 Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Fri, 20 Dec 2019 15:31:45 +0800 Subject: Manually close activity when SearchViewUiTest When search bar expand then activity destroy, it has risk that SearchFrament show caused by focus transition. This will cause crash because fragment cannot show when stateSaved. Bug: 142840883 Test: atest DocumentsUIGoogleTests Change-Id: I3e37cefb0709284f02158c031fb135e9dd606662 --- tests/functional/com/android/documentsui/SearchViewUiTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/functional/com/android/documentsui/SearchViewUiTest.java b/tests/functional/com/android/documentsui/SearchViewUiTest.java index 9a151f7fb..d18ac3c02 100644 --- a/tests/functional/com/android/documentsui/SearchViewUiTest.java +++ b/tests/functional/com/android/documentsui/SearchViewUiTest.java @@ -44,6 +44,16 @@ public class SearchViewUiTest extends ActivityTest { bots.directory.waitForDocument(fileName1); } + @Override + public void tearDown() throws Exception { + // manually close activity to avoid SearchFragment show when Activity close. ref b/142840883 + device.waitForIdle(); + device.pressBack(); + device.pressBack(); + device.pressBack(); + super.tearDown(); + } + public void testSearchIconVisible() throws Exception { // The default root (root 0) supports search bots.search.assertInputExists(false); -- cgit v1.2.3