Skip to content

Commit

Permalink
test websocket origin set in worker
Browse files Browse the repository at this point in the history
  • Loading branch information
g-k authored and Ms2ger committed Mar 15, 2016
1 parent a42ba9c commit c809161
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions websockets/opening-handshake/003-sets-origin.worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
importScripts("/resources/testharness.js");
importScripts('../constants.js?pipe=sub');
importScripts('../websocket.js?pipe=sub');

async_test(function(t) {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/origin');
ws.onmessage = t.step_func(function(e) {
assert_equals(e.data, location.protocol+'//'+location.host);
ws.onclose = t.step_func(function(e) {
assert_equals(e.wasClean, true);
ws.onclose = t.step_func(function() {assert_unreached()});
setTimeout(t.step_func_done(), 50)
})
ws.close();
})
ws.onerror = ws.onclose = t.step_func(function() {assert_unreached()});
}, "W3C WebSocket API - origin set in a Worker");

done();

0 comments on commit c809161

Please sign in to comment.