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

Side by Side Diff: LayoutTests/http/tests/eventsource/script-tests/eventsource-events-after-close.js

Issue 347043002: Rework EventSource tests for better Worker test coverage. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move out CORS tests 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 no more message events are fired after EventSource.close( ) is called, even if it means discarding events that were already processed.");
5
6 self.jsTestIsAsync = true;
7 var es;
8 shouldNotThrow("es = new EventSource(\"/eventsource/resources/event-stream.php\" );");
9 var counter = 0;
10 es.addEventListener('message', function (e) {
11 testPassed("Got message #" + ++counter);
12 if (counter > 1)
13 testFailed("Handler called after the source was closed explicitly.");
14 es.close();
15 // Need to wait to see if we're called again.
16 // event-stream.php sends a bunch of events before flushing, so if close() d idn't take
17 // effect we'd get a second message practically instantaneously, waiting 100 ms should be ok.
18 setTimeout(finishJSTest, 100);
19 }, false);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698