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

Unified Diff: LayoutTests/http/tests/websocket/workers/resources/close-before-open.js

Issue 211093005: [WebSocket] Add close-before-open layout test for workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed #2 Created 6 years, 9 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
« no previous file with comments | « LayoutTests/http/tests/websocket/workers/close-before-open-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/websocket/workers/resources/close-before-open.js
diff --git a/LayoutTests/http/tests/websocket/workers/resources/close-before-open.js b/LayoutTests/http/tests/websocket/workers/resources/close-before-open.js
new file mode 100644
index 0000000000000000000000000000000000000000..44bb8a5a2420de67314184b33dcc0cd84f748217
--- /dev/null
+++ b/LayoutTests/http/tests/websocket/workers/resources/close-before-open.js
@@ -0,0 +1,18 @@
+var ws = new WebSocket("ws://127.0.0.1:8880/echo");
+var errorCalled = false;
+ws.onopen = function () {
+ postMessage("FAIL: Unexpected open event on ws");
+};
+ws.onmessage = function () {
+ postMessage("FAIL: Unexpected message event on ws");
+};
+ws.onerror = function () {
+ errorCalled = true;
+};
+ws.onclose = function () {
+ if (errorCalled)
+ postMessage("DONE");
+ else
+ postMessage("FAIL: Error event was not dispatched");
+};
+ws.close();
« no previous file with comments | « LayoutTests/http/tests/websocket/workers/close-before-open-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698