Commit d19c087b authored by dominickn's avatar dominickn Committed by Commit bot

Speculatively deflake some web app tests on low-end Lollipop.

This attempts to deflake two tests which flake on the Lollipop low-end
tester.

WebappSplashScreenIconTest#setUp decodes a string into a bitmap, which
is then encoded back into a string. Remove both of these steps so that
the string is directly inserted into WebappDataStorage. This
speculatively deflakes WebappSplashScreenIconTest#testShowSplashScreen,
which has a criteria takes too long timeout.

WebappSplashScreenTest#testUmaWhenSplashHides fails an assert for
a histogram value representing the number of milliseconds that the
splashscreen was shown. On the theory that the slow device is showing
the splash screen for longer, the speculative fix is to check more of
the histogram buckets.

BUG=636633

Review-Url: https://codereview.chromium.org/2337843003
Cr-Commit-Position: refs/heads/master@{#418438}
parent e5dd14ac
......@@ -264,6 +264,16 @@ public class WebappDataStorage {
}.execute();
}
/**
* Update the information associated with the web app with the specified data. Used for testing.
* @param splashScreenImage The image encoded as a string which should be shown on the splash
* screen of the web app.
*/
@VisibleForTesting
void updateSplashScreenImageForTests(String splashScreenImage) {
mPreferences.edit().putString(KEY_SPLASH_ICON, splashScreenImage).apply();
}
/**
* Creates and returns a web app launch intent from the data stored in this object. Must not be
* called on the UI thread as a Bitmap is decoded from a String (a potentially expensive
......
......@@ -32,7 +32,7 @@ public class WebappSplashScreenIconTest extends WebappActivityTestBase {
@Override
protected void setUp() throws Exception {
WebappDataStorage.open(getInstrumentation().getTargetContext(), WEBAPP_ID)
.updateSplashScreenImage(ShortcutHelper.decodeBitmapFromString(TEST_SPLASH_ICON));
.updateSplashScreenImageForTests(TEST_SPLASH_ICON);
super.setUp();
startWebappActivity();
......
......@@ -204,7 +204,7 @@ public class WebappSplashScreenTest extends WebappActivityTestBase {
waitUntilSplashscreenHides();
// DURATION and HIDES should now have a value.
assertTrue(hasHistogramEntry(WebappUma.HISTOGRAM_SPLASHSCREEN_DURATION, 3000));
assertTrue(hasHistogramEntry(WebappUma.HISTOGRAM_SPLASHSCREEN_DURATION, 5000));
assertEquals(1, getHistogramTotalCountFor(WebappUma.HISTOGRAM_SPLASHSCREEN_HIDES,
WebappUma.SPLASHSCREEN_HIDES_REASON_MAX));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment