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

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

Issue 8775046: Convert another batch of extension tests to manifest_version 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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
(Empty)
1 // Copyright (c) 2011 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 chrome.test.runTests([
6 function echoTest() {
7 var ws = new WebSocket(
8 "ws://localhost:8880/websocket/tests/hybi/workers/resources/echo");
9 var MESSAGE_A = "message a";
10 var MESSAGE_B = "message b";
11
12 ws.onopen = function() {
13 chrome.test.log("websocket opened.");
14 ws.send(MESSAGE_A);
15 };
16
17 ws.onclose = function() {
18 chrome.test.log("websocket closed.");
19 }
20
21 ws.onmessage = function(messageEvent) {
22 chrome.test.log("message received: " + messageEvent.data);
23 chrome.test.assertEq(MESSAGE_A, messageEvent.data);
24
25 ws.onmessage = function(messageEvent) {
26 chrome.test.log("message received: " + messageEvent.data);
27 chrome.test.assertEq(MESSAGE_B, messageEvent.data);
28 ws.close();
29
30 chrome.test.succeed();
31 };
32
33 ws.send(MESSAGE_B);
34 };
35 }
36 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698