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

Side by Side Diff: chrome/test/data/extensions/api_test/websocket/test.js

Issue 11091059: Revert 161304 - WebSocket test server migration on ExtensionApiTest.WebSocket (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 function echoTest(port) { 5 function echoTest(port) {
6 var url = "ws://localhost:" + port + "/echo"; 6 var url =
7 "ws://localhost:" + port + "/websocket/tests/hybi/workers/resources/echo";
7 var ws = new WebSocket(url); 8 var ws = new WebSocket(url);
8 var MESSAGE_A = "message a"; 9 var MESSAGE_A = "message a";
9 var MESSAGE_B = "message b"; 10 var MESSAGE_B = "message b";
10 11
11 ws.onopen = function() { 12 ws.onopen = function() {
12 chrome.test.log("websocket opened."); 13 chrome.test.log("websocket opened.");
13 ws.send(MESSAGE_A); 14 ws.send(MESSAGE_A);
14 }; 15 };
15 16
16 ws.onclose = function() { 17 ws.onclose = function() {
17 chrome.test.log("websocket closed."); 18 chrome.test.log("websocket closed.");
18 } 19 }
19 20
20 ws.onmessage = function(messageEvent) { 21 ws.onmessage = function(messageEvent) {
21 chrome.test.log("message received: " + messageEvent.data); 22 chrome.test.log("message received: " + messageEvent.data);
22 chrome.test.assertEq(MESSAGE_A, messageEvent.data); 23 chrome.test.assertEq(MESSAGE_A, messageEvent.data);
23 24
24 ws.onmessage = function(messageEvent) { 25 ws.onmessage = function(messageEvent) {
25 chrome.test.log("message received: " + messageEvent.data); 26 chrome.test.log("message received: " + messageEvent.data);
26 chrome.test.assertEq(MESSAGE_B, messageEvent.data); 27 chrome.test.assertEq(MESSAGE_B, messageEvent.data);
27 ws.close(); 28 ws.close();
28 29
29 chrome.test.succeed(); 30 chrome.test.succeed();
30 }; 31 };
31 32
32 ws.send(MESSAGE_B); 33 ws.send(MESSAGE_B);
33 }; 34 };
34 } 35 }
35 36
36 chrome.test.getConfig(function(config) { 37 chrome.test.runTests([
37 chrome.test.runTests([ 38 chrome.test.getConfig(function(config) {
38 function runEchoTest() { 39 echoTest(config.testWebSocketPort);
39 echoTest(config.testWebSocketPort); 40 })
40 } 41 ]);
41 ]);
42 });
43
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_websocket_apitest.cc ('k') | net/data/websocket/echo_wsh.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698