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

Side by Side Diff: LayoutTests/http/tests/eventsource/script-tests/eventsource-cors-no-server.js

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 unified diff | Download patch
OLDNEW
(Empty)
1 if (self.importScripts)
2 importScripts("/js-test-resources/js-test.js");
3
4 description("Test that EventSource tries to reconnect if there's no server respo nse when making cross-origin requests.");
5
6 self.jsTestIsAsync = true;
7
8 var count = 0;
9 var hosts = ["http://127.0.0.1:12345/event-stream", "http://localhost:54321/even t-stream"];
10
11 var es;
12
13 function runTest() {
14 shouldNotThrow("es = new EventSource(\"" + hosts[count] + "\")");
15 es.onerror = function () {
16 if (es.readyState == es.CONNECTING) {
17 testPassed("got error event and readyState is CONNECTING");
18 es.close();
19 } else
20 shouldBeTrue("es.readyState !== es.CLOSED");
21 if (++count == hosts.length) {
22 finishJSTest();
23 return;
24 }
25 setTimeout(runTest);
26 };
27 }
28 runTest();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698