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

Side by Side Diff: net/data/websocket/websocket_worker_simple.js

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « net/data/websocket/websocket_shared_worker.html ('k') | net/disk_cache/backend_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 if (!self.postMessage) {
6 // This is a shared worker - mimic dedicated worker APIs
7 onconnect = function(event) {
8 event.ports[0].onmessage = function(e) {
9 self.postMessage = function (msg) {
10 event.ports[0].postMessage(msg);
11 };
12 runTests(e.data);
13 };
14 };
15 } else {
16 runTests(event.data);
17 }
18
19 // This test is compatible with shared-worker-simple.html layout test.
20 runTests = function (url) {
21 var ws;
22 var greeting = "hello";
23 try {
24 ws = new WebSocket(url);
25 ws.onopen = function() {
26 ws.send(greeting);
27 };
28 ws.onmessage = function(e) {
29 // Receive echoed "hello".
30 if (e.data != greeting) {
31 postMessage("FAIL: received data is wrong: " + e.data);
32 } else {
33 ws.close();
34 }
35 };
36 ws.onclose = function(e) {
37 if (!e.wasClean) {
38 postMessage("FAIL: close is not clean");
39 } else {
40 postMessage("DONE");
41 }
42 };
43 } catch (e) {
44 postMessage("FAIL: worker: Unexpected exception: " + e);
45 }
46 };
OLDNEW
« no previous file with comments | « net/data/websocket/websocket_shared_worker.html ('k') | net/disk_cache/backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698