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

Unified Diff: LayoutTests/http/tests/eventsource/eventsource-cors-no-server.html

Issue 345813005: Rework EventSource CORS tests to be usable from Workers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Generalize redirect.php?cors_enabled to cors_allow_origin Created 6 years, 6 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
Index: LayoutTests/http/tests/eventsource/eventsource-cors-no-server.html
diff --git a/LayoutTests/http/tests/eventsource/eventsource-cors-no-server.html b/LayoutTests/http/tests/eventsource/eventsource-cors-no-server.html
index e8798d29020d820ed614727d272924a547498c05..29a51969b025df6c12ef7c29a7718c79fe144f43 100644
--- a/LayoutTests/http/tests/eventsource/eventsource-cors-no-server.html
+++ b/LayoutTests/http/tests/eventsource/eventsource-cors-no-server.html
@@ -1,55 +1,3 @@
-<html>
-<body>
-<p>Test that EventSource tries to reconnect if there's no server response when making cross-origin requests. Should print a series of PASS messages followed by DONE.</p>
-<div id="result"></div>
-<script>
-function log(msg) {
- document.getElementById("result").innerHTML += msg + "<br>";
-}
-
-if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.waitUntilDone();
-}
-
-function end() {
- if (window.testRunner)
- testRunner.notifyDone();
-}
-
-var count = 0;
-var hosts = ["http://127.0.0.1:12345/event-stream", "http://localhost:54321/event-stream"];
-
-function create_es() {
- try {
- var es = new EventSource(hosts[count]);
- }
- catch (ex) {
- log("FAIL: EventSource constructor threw exception: " + ex);
- end();
- return;
- }
-
- es.onerror = function () {
- if (es.readyState == es.CONNECTING) {
- log("PASS: got error event and readyState is CONNECTING");
- es.close();
- end();
- return;
- }
-
- if (es.readyState == es.CLOSED)
- log("FAIL: got error event but readyState is CLOSED");
-
- if (++count == hosts.length) {
- log("DONE");
- end();
- }
- else
- setTimeout(create_es);
- };
-}
-create_es();
-</script>
-</body>
-</html>
+<!DOCTYPE HTML>
+<script src="/js-test-resources/js-test.js"></script>
+<script src="script-tests/eventsource-cors-no-server.js"></script>

Powered by Google App Engine
This is Rietveld 408576698