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

Unified Diff: LayoutTests/http/tests/eventsource/eventsource-parse-event-stream.html

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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/eventsource/eventsource-parse-event-stream.html
diff --git a/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream.html b/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream.html
index e78b64b987aeb919f479d104ce678fdf42115411..1ab98a7f8fa8ba693dd524629a3df2434c6f37a9 100644
--- a/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream.html
+++ b/LayoutTests/http/tests/eventsource/eventsource-parse-event-stream.html
@@ -1,78 +1,3 @@
-<html>
-<body>
-<p>Test EventSource text/event-stream parsing. 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();
-}
-
-var count = -1;
-var es = new EventSource("resources/event-stream.php");
-
-es.onopen = function (evt) {
- if (!evt.data)
- log("PASS: got open event");
- else
- log("PASS: got open event from server");
-};
-
-es.onmessage = function (evt) {
- switch(count++) {
- case -1:
- if (evt.data == "\n\n")
- log("PASS: received event with two newlines");
- break;
- case 0:
- if (evt.data == "simple")
- log("PASS: received event with data \"simple\"");
- break;
- case 1:
- if (evt.data == "spanning\nmultiple\n\nlines\n")
- log("PASS: received event with data spanning multiple lines");
- break;
- case 2:
- if (evt.data == "id is 1" && evt.lastEventId == "1")
- log("PASS: received event and lastEventId is \"1\"");
- break
- case 3:
- if (evt.data == "id is still 1" && evt.lastEventId == "1")
- log("PASS: received event and lastEventId is still \"1\"");
- break;
- case 4:
- if (evt.data == "no id" && evt.lastEventId == "")
- log("PASS: received event and lastEventId has been cleared");
- break;
- case 5:
- if (evt.data == "a message event with the name \"message\"")
- log("PASS: received event and the event name has been reset");
- break;
- case 6:
- if (evt.data == "a line ending with crlf\na line with a : (colon)\na line ending with cr");
- log("PASS: received event with data that contains a colon");
- break;
- default:
- log("FAIL: got unexpected event");
- es.close();
- }
-};
-
-es.onerror = function () {
- es.close();
-
- if (count != 7)
- log("FAIL: got unexpected error event");
- else
- log("DONE");
-
- if (window.testRunner)
- testRunner.notifyDone();
-};
-</script>
-</body>
-</html>
+<!DOCTYPE HTML>
+<script src="/js-test-resources/js-test.js"></script>
+<script src="script-tests/eventsource-parse-event-stream.js"></script>

Powered by Google App Engine
This is Rietveld 408576698