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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCYUPE html>
2 <h1>random</h1>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script>
6
7 async_test(t => {
8 const passMessage = "PASS";
9 const readyMessage = "READY";
10 let expectedMessage = readyMessage;
11 let testWindow = null;
12 let messageCount = 0;
13
14 // Test will run on testWindow that is opened below.
15 // This page just received messages to confirm if tests run expectedly.
16 window.addEventListener("message", e => {
17 t.step(() => {
18 // Check if messages are received in an expected order.
19 assert_equals(e.data, expectedMessage, "received message is " + e.data);
20
21 // If all tests pass, "PASS" will be received.
22 if (e.data == passMessage) {
23 t.done();
24 } else {
25 // Will receive "READY" twice because of a reload, then receive "PASS".
26 // Update expectedMessage as it will.
27 messageCount++;
28 if (messageCount == 2)
29 expectedMessage = passMessage;
30
31 // Send back "START" message for "READY".
32 assert_class_string(testWindow, "Window", "testWindow is invalid");
33 testWindow.postMessage("START", location.origin);
34 }
35 });
36 }, 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.
37
38 // Start a test in a dedicated window because we can not track navigations
39 // within a test harness.
40 t.step(() => {
41 testWindow = open("./resources/location-reload-window.html", "testWindow");
42 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.
43 });
44 }, "Test location.reload() cache behaviors");
45 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698