Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1183)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java

Issue 2362793002: Wait for async file creation in TabsTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switched to Criteria.equals Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java
index c4529081d8e49c31246a5f78a427c772511b7a57..9330492c1965f277c8f3d59c752e818cd3f9cec1 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java
@@ -1694,8 +1694,8 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
File incognitoTabFile = new File(tabStateDir,
TabState.getTabStateFilename(incognitoModel.getTabAt(0).getId(), true));
- assertTrue(normalTabFile.getAbsolutePath(), normalTabFile.exists());
- assertTrue(incognitoTabFile.getAbsolutePath(), incognitoTabFile.exists());
+ assertFileExists(normalTabFile, true);
+ assertFileExists(incognitoTabFile, true);
// Although we're destroying the activity, the Application will still live on since its in
// the same process as this test.
@@ -1703,8 +1703,8 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
// Activity will be started without a savedInstanceState.
startMainActivityOnBlankPage();
- assertTrue(normalTabFile.exists());
- assertFalse(incognitoTabFile.exists());
+ assertFileExists(normalTabFile, true);
+ assertFileExists(incognitoTabFile, false);
}
@Override
@@ -1722,4 +1722,15 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
}
startMainActivityFromLauncher();
}
+
+ private void assertFileExists(final File fileToCheck, final boolean expected)
+ throws InterruptedException {
+ CriteriaHelper.pollInstrumentationThread(
+ Criteria.equals(expected, new Callable<Boolean>() {
+ @Override
+ public Boolean call() {
+ return fileToCheck.exists();
+ }
+ }));
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698