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

Side by Side Diff: chrome/test/data/extensions/api_test/socket/api/background.js

Issue 15359007: Allow missing socketType in SocketInfo if socket is not connected (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes as per asargent Created 7 years, 6 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
« no previous file with comments | « chrome/browser/extensions/api/socket/socket_api.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // net/tools/testserver/testserver.py is picky about the format of what it 5 // net/tools/testserver/testserver.py is picky about the format of what it
6 // calls its "echo" messages. One might go so far as to mutter to oneself that 6 // calls its "echo" messages. One might go so far as to mutter to oneself that
7 // it isn't an echo server at all. 7 // it isn't an echo server at all.
8 // 8 //
9 // The response is based on the request but obfuscated using a random key. 9 // The response is based on the request but obfuscated using a random key.
10 const request = "0100000005320000005hello"; 10 const request = "0100000005320000005hello";
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 chrome.test.assertFalse(info.connected); 48 chrome.test.assertFalse(info.connected);
49 49
50 if (info.peerAddress || info.peerPort) { 50 if (info.peerAddress || info.peerPort) {
51 chrome.test.fail('Unconnected socket should not have peer'); 51 chrome.test.fail('Unconnected socket should not have peer');
52 } 52 }
53 if (info.localAddress || info.localPort) { 53 if (info.localAddress || info.localPort) {
54 chrome.test.fail('Unconnected socket should not have local binding'); 54 chrome.test.fail('Unconnected socket should not have local binding');
55 } 55 }
56 56
57 socket.destroy(socketInfo.socketId); 57 socket.destroy(socketInfo.socketId);
58 58 socket.getInfo(socketInfo.socketId, function(info) {
59 chrome.test.succeed(); 59 chrome.test.assertEq(undefined, info);
60 chrome.test.succeed();
61 });
60 } 62 }
61 63
62 chrome.test.assertTrue(socketInfo.socketId > 0); 64 chrome.test.assertTrue(socketInfo.socketId > 0);
63 65
64 // Obtaining socket information before a connect() call should be safe, but 66 // Obtaining socket information before a connect() call should be safe, but
65 // return empty values. 67 // return empty values.
66 socket.getInfo(socketInfo.socketId, onGetInfo); 68 socket.getInfo(socketInfo.socketId, onGetInfo);
67 } 69 }
68 70
69 socket.create(protocol, {}, onCreate); 71 socket.create(protocol, {}, onCreate);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 chrome.test.runTests([ testMulticast ]); 247 chrome.test.runTests([ testMulticast ]);
246 } else { 248 } else {
247 protocol = test_type; 249 protocol = test_type;
248 chrome.test.runTests([ testSocketCreation, testSending ]); 250 chrome.test.runTests([ testSocketCreation, testSending ]);
249 } 251 }
250 }; 252 };
251 253
252 // Find out which protocol we're supposed to test, and which echo server we 254 // Find out which protocol we're supposed to test, and which echo server we
253 // should be using, then kick off the tests. 255 // should be using, then kick off the tests.
254 chrome.test.sendMessage("info_please", onMessageReply); 256 chrome.test.sendMessage("info_please", onMessageReply);
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/socket/socket_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698