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

Unified Diff: LayoutTests/http/tests/resources/srcset-helper.js

Issue 23861003: Enable srcset support in HTMLImageElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed a flaky test Created 7 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 | « LayoutTests/http/tests/loading/resources/preloaded.js ('k') | Source/core/core.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/resources/srcset-helper.js
diff --git a/LayoutTests/http/tests/resources/srcset-helper.js b/LayoutTests/http/tests/resources/srcset-helper.js
new file mode 100644
index 0000000000000000000000000000000000000000..703b266e967682203b850d9759ac3870c624b9db
--- /dev/null
+++ b/LayoutTests/http/tests/resources/srcset-helper.js
@@ -0,0 +1,29 @@
+function runTest() {
+ if (!window.testRunner || !window.sessionStorage)
+ return;
+
+ if (!window.targetScaleFactor)
+ window.targetScaleFactor = 2;
+
+ if (!sessionStorage.scaleFactorIsSet) {
+ testRunner.waitUntilDone();
+ testRunner.setBackingScaleFactor(targetScaleFactor, scaleFactorIsSet);
+ }
+
+ if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) {
+ delete sessionStorage.pageReloaded;
+ delete sessionStorage.scaleFactorIsSet;
+ testRunner.notifyDone();
+ } else {
+ // Right now there is a bug that srcset does not properly deal with dynamic changes to the scale factor,
+ // so to work around that, we must reload the page to get the new image.
+ sessionStorage.pageReloaded = true;
+ document.location.reload(true);
+ }
+}
+
+function scaleFactorIsSet() {
+ sessionStorage.scaleFactorIsSet = true;
+}
+
+window.addEventListener("load", runTest, false);
« no previous file with comments | « LayoutTests/http/tests/loading/resources/preloaded.js ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698