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

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

Issue 2351113005: [Reland] Refactor WebappRegistry into a singleton instance. (Closed)
Patch Set: Comments Created 4 years, 2 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
Index: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestBase.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestBase.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestBase.java
index ec1f26a1bd1fb623e199c01278aef335753d9c5c..e63b80f5f4cd68e990db62e09173a9e072aad64e 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestBase.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestBase.java
@@ -92,16 +92,12 @@ public abstract class WebappActivityTestBase extends ChromeActivityTestCaseBase<
protected void setUp() throws Exception {
super.setUp();
- // Register the webapp so when the data storage is opened, the test doesn't crash. There is
- // no race condition with the retrieval as AsyncTasks are run sequentially on the background
- // thread.
- WebappRegistry.registerWebapp(
- WEBAPP_ID, new WebappRegistry.FetchWebappDataStorageCallback() {
- @Override
- public void onWebappDataStorageRetrieved(WebappDataStorage storage) {
- storage.updateFromShortcutIntent(createIntent());
- }
- });
+ // Register the webapp so when the data storage is opened, the test doesn't crash.
+ WebappRegistry.refreshSharedPrefsForTesting();
+ TestFetchStorageCallback callback = new TestFetchStorageCallback();
+ WebappRegistry.getInstance().register(WEBAPP_ID, callback);
+ callback.waitForCallback(0);
+ callback.getStorage().updateFromShortcutIntent(createIntent());
}
/**

Powered by Google App Engine
This is Rietveld 408576698