Index: chrome/test/data/extensions/api_test/socket/api/background.js |
diff --git a/chrome/test/data/extensions/api_test/socket/api/background.js b/chrome/test/data/extensions/api_test/socket/api/background.js |
index 09e74dd4be7e79dc368a0f2cfbc7f1b8539730d9..8dcd32ab4c1bb9262d4a53eae0a60bca6add1056 100644 |
--- a/chrome/test/data/extensions/api_test/socket/api/background.js |
+++ b/chrome/test/data/extensions/api_test/socket/api/background.js |
@@ -103,11 +103,31 @@ function onSetNoDelay(result) { |
socket.setKeepAlive(socketId, true, 1000, onSetKeepAlive); |
} |
+function onGetInfo(result) { |
+ chrome.test.assertTrue(!!result.local, |
+ "Bound socket should always have local part"); |
+ chrome.test.assertEq(result.socketType, protocol, "Unexpected socketType"); |
+ |
+ if (protocol == "tcp") { |
+ // NOTE: We're always called with 'localhost', but getInfo will only return |
+ // IPs, not names. |
+ chrome.test.assertEq(result.peer, "127.0.0.1:" + port, |
+ "Peer address was not the listen server"); |
+ chrome.test.assertTrue(result.connected, "Socket should be connected"); |
+ } else { |
+ chrome.test.assertFalse(result.connected, "UDP socket was not connected"); |
+ chrome.test.assertTrue(!result.peer, |
+ "Unconnected UDP socket must not have peer"); |
+ } |
+ |
+ socket.setNoDelay(socketId, true, onSetNoDelay);; |
+} |
+ |
function onConnectOrBindComplete(result) { |
chrome.test.assertEq(0, result, |
"Connect or bind failed with error " + result); |
if (result == 0) { |
- socket.setNoDelay(socketId, true, onSetNoDelay); |
+ socket.getInfo(socketId, onGetInfo); |
} |
} |