Index: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java |
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java |
index 5845ad57a3d9533996df0b4dfee0ab5758dcdade..fd3b21ad5be6cb0dd2c2e095f7f04d288fd8399e 100644 |
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java |
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java |
@@ -24,11 +24,13 @@ import org.chromium.base.ContextUtils; |
import org.chromium.base.test.util.CommandLineFlags; |
import org.chromium.base.test.util.Feature; |
import org.chromium.base.test.util.RetryOnFailure; |
+import org.chromium.base.test.util.ScalableTimeout; |
import org.chromium.base.test.util.UrlUtils; |
import org.chromium.blink_public.platform.WebDisplayMode; |
import org.chromium.chrome.browser.ChromeActivity; |
import org.chromium.chrome.browser.ChromeSwitches; |
import org.chromium.chrome.browser.ChromeTabbedActivity; |
+import org.chromium.chrome.browser.DeferredStartupHandler; |
import org.chromium.chrome.browser.ShortcutHelper; |
import org.chromium.chrome.browser.ShortcutSource; |
import org.chromium.chrome.browser.tab.Tab; |
@@ -267,6 +269,28 @@ public class WebappModeTest { |
}); |
} |
+ /** Test that on first launch {@link WebappDataStorage#hasBeenLaunched()} is set. */ |
+ @Test |
+ @MediumTest |
+ @Feature({"Webapps"}) |
+ public void testSetsHasBeenLaunchedOnFirstLaunch() throws Exception { |
+ WebappDataStorage storage = WebappRegistry.getInstance().getWebappDataStorage(WEBAPP_1_ID); |
+ Assert.assertFalse(storage.hasBeenLaunched()); |
+ |
+ startWebappActivity(WEBAPP_1_ID, WEBAPP_1_URL, WEBAPP_1_TITLE, WEBAPP_ICON); |
+ |
+ // Use a longer timeout because the DeferredStartupHandler is called after the page has |
+ // finished loading. |
+ CriteriaHelper.pollUiThread(new Criteria("Deferred startup never completed") { |
+ @Override |
+ public boolean isSatisfied() { |
+ return DeferredStartupHandler.getInstance().isDeferredStartupCompleteForApp(); |
+ } |
+ }, ScalableTimeout.scaleTimeout(5000), CriteriaHelper.DEFAULT_POLLING_INTERVAL); |
+ |
+ Assert.assertTrue(storage.hasBeenLaunched()); |
+ } |
+ |
/** |
* Starts a WebappActivity for the given data and waits for it to be initialized. We can't use |
* ActivityUtils.waitForActivity() because of the way WebappActivity is instanced on pre-L |