Chromium Code Reviews| 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..b069a032e1c0daebad1888e440c651d8d0e98471 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/cache/location-reload.html |
| @@ -0,0 +1,41 @@ |
| +<!DOCYUPE html> |
| +<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-
|
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script> |
| + |
| +async_test(t => { |
| + 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. |
| + const checkReady = e => { |
| + t.step(() => { |
| + // Will receive "READY" twice because of a reload, then receive "PASS". |
| + assert_equals(e.data, "READY", "received message is " + e.data); |
| + messageCount++; |
| + |
| + if (messageCount == 2) { |
| + window.removeEventListener("message", checkReady, false); |
| + window.addEventListener("message", e => { |
| + assert_equals(e.data, "PASS", "received message is " + e.data); |
| + t.done(); |
| + }, { once: true }); |
| + } |
| + |
| + // Send back "START" message for "READY". |
| + assert_class_string(testWindow, "Window", "testWindow is invalid"); |
| + testWindow.postMessage("START", location.origin); |
| + }); |
| + }; |
| + window.addEventListener("message", checkReady, false); |
| + |
| + // 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() failed"); |
| + }); |
| +}, "Test location.reload() cache behaviors"); |
| +</script> |