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

Side by Side Diff: LayoutTests/http/tests/eventsource/script-tests/eventsource-eof.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 EventSource discards event data if there is no newline be fore eof.");
5
6 self.jsTestIsAsync = true;
7
8 var count = 1;
9
10 var es = new EventSource("/eventsource/resources/es-eof.php");
11
12 es.onerror = function () {
13 if (count++ == 3) {
14 es.close();
15 finishJSTest();
16 }
17 };
18
19 var evt;
20
21 es.onmessage = function (arg) {
22 evt = arg;
23 if (evt.data == ("DATA" + count)) {
24 shouldBeEqualToString("evt.type", "message");
25 shouldBeEqualToString("evt.data", "DATA" + count);
26 shouldBeEqualToString("evt.lastEventId", count.toString());
27 return;
28 }
29 shouldBeEqualToString("evt.type", "msg");
30 shouldBeEqualToString("evt.data", "DATA");
31 shouldBeEqualToString("evt.lastEventId", "3.1");
32 };
33 es.addEventListener("msg", es.onmessage);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698