Index: LayoutTests/http/tests/security/mixedContent/websocket/resources/expect-successful-construction.js |
diff --git a/LayoutTests/http/tests/security/mixedContent/websocket/resources/expect-successful-construction.js b/LayoutTests/http/tests/security/mixedContent/websocket/resources/expect-successful-construction.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..083fd8f48d0a6b3dede477044c8643cf5fb54759 |
--- /dev/null |
+++ b/LayoutTests/http/tests/security/mixedContent/websocket/resources/expect-successful-construction.js |
@@ -0,0 +1,29 @@ |
+function reportResult(msg) { |
+ if ("opener" in self) |
+ self.opener.postMessage(msg, "*"); |
+ else |
+ postMessage(msg); |
+} |
+ |
+new Promise(function (resolve, reject) { |
+ var ws = new WebSocket("ws://127.0.0.1:8880/echo"); |
+ ws.onopen = function () { |
+ resolve(); |
+ }; |
+ ws.onmessage = function () { |
+ reject("Unexpected message event"); |
+ }; |
+ ws.onerror = function () { |
+ reject("Unexpected error event"); |
+ }; |
+ ws.onclose = function () { |
+ reject("Unexpected close event before open event"); |
+ }; |
+}).then( |
+ function () { |
+ reportResult("DONE"); |
+ }, |
+ function (reason) { |
+ reportResult("FAIL: " + reason); |
+ } |
+); |