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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/cache/location-reload.html

Issue 2555963003: FasterLocationReload: use ReloadMainResource for JS exposed reloads (Closed)
Patch Set: more comments Created 4 years 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: third_party/WebKit/LayoutTests/http/tests/cache/location-reload.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/cache/location-reload.html b/third_party/WebKit/LayoutTests/http/tests/cache/location-reload.html
new file mode 100644
index 0000000000000000000000000000000000000000..c04cc375fd693f01ddb668621ca90d51bf73b7ea
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/cache/location-reload.html
@@ -0,0 +1,45 @@
+<!DOCYUPE html>
+<h1>random</h1>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script>
+
+async_test(t => {
+ const passMessage = "PASS";
+ const readyMessage = "READY";
+ let expectedMessage = readyMessage;
+ let testWindow = null;
+ let messageCount = 0;
+
+ // Test will run on testWindow that is opened below.
+ // This page just received messages to confirm if tests run expectedly.
+ window.addEventListener("message", e => {
+ t.step(() => {
+ // Check if messages are received in an expected order.
+ assert_equals(e.data, expectedMessage, "received message is " + e.data);
+
+ // If all tests pass, "PASS" will be received.
+ if (e.data == passMessage) {
+ t.done();
+ } else {
+ // Will receive "READY" twice because of a reload, then receive "PASS".
+ // Update expectedMessage as it will.
+ messageCount++;
+ if (messageCount == 2)
+ expectedMessage = passMessage;
+
+ // Send back "START" message for "READY".
+ assert_class_string(testWindow, "Window", "testWindow is invalid");
+ testWindow.postMessage("START", location.origin);
+ }
+ });
+ }, false);
kouhei (in TOK) 2016/12/14 10:57:41 Try addEventListener("msg", e => {...}, {once: tr
Takashi Toyoshima 2016/12/14 12:31:10 Done.
+
+ // Start a test in a dedicated window because we can not track navigations
+ // within a test harness.
+ t.step(() => {
+ testWindow = open("./resources/location-reload-window.html", "testWindow");
+ assert_class_string(testWindow, "Window", "window.open() fails");
kouhei (in TOK) 2016/12/14 10:57:41 s/fails/failed
Takashi Toyoshima 2016/12/14 12:31:10 Done.
+ });
+}, "Test location.reload() cache behaviors");
+</script>

Powered by Google App Engine
This is Rietveld 408576698