Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCYUPE html> | |
| 2 <h1>random</h1> | |
|
tkent
2016/12/14 22:59:43
Is this necessary?
Takashi Toyoshima
2016/12/15 04:45:32
Oops, this should be moved into resource/location-
| |
| 3 <script src="../resources/testharness.js"></script> | |
| 4 <script src="../resources/testharnessreport.js"></script> | |
| 5 <script> | |
| 6 | |
| 7 async_test(t => { | |
| 8 let testWindow = null; | |
| 9 let messageCount = 0; | |
| 10 | |
| 11 // Test will run on testWindow that is opened below. | |
| 12 // This page just received messages to confirm if tests run expectedly. | |
| 13 const checkReady = e => { | |
| 14 t.step(() => { | |
| 15 // Will receive "READY" twice because of a reload, then receive "PASS". | |
| 16 assert_equals(e.data, "READY", "received message is " + e.data); | |
| 17 messageCount++; | |
| 18 | |
| 19 if (messageCount == 2) { | |
| 20 window.removeEventListener("message", checkReady, false); | |
| 21 window.addEventListener("message", e => { | |
| 22 assert_equals(e.data, "PASS", "received message is " + e.data); | |
| 23 t.done(); | |
| 24 }, { once: true }); | |
| 25 } | |
| 26 | |
| 27 // Send back "START" message for "READY". | |
| 28 assert_class_string(testWindow, "Window", "testWindow is invalid"); | |
| 29 testWindow.postMessage("START", location.origin); | |
| 30 }); | |
| 31 }; | |
| 32 window.addEventListener("message", checkReady, false); | |
| 33 | |
| 34 // Start a test in a dedicated window because we can not track navigations | |
| 35 // within a test harness. | |
| 36 t.step(() => { | |
| 37 testWindow = open("./resources/location-reload-window.html", "testWindow"); | |
| 38 assert_class_string(testWindow, "Window", "window.open() failed"); | |
| 39 }); | |
| 40 }, "Test location.reload() cache behaviors"); | |
| 41 </script> | |
| OLD | NEW |