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

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

Issue 10273016: Refactor the socket API to remove onEvent callback in socket.create() function. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/resources/extensions/experimental.socket_custom_bindings.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fef33472f497ba631d9d99317cc74856190f3039..b9d1801805abed19fd5b1aa0e843c5e7f9c45210 100644
--- a/chrome/test/data/extensions/api_test/socket/api/background.js
+++ b/chrome/test/data/extensions/api_test/socket/api/background.js
@@ -72,7 +72,7 @@ var testSocketCreation = function() {
chrome.test.succeed();
}
- socket.create(protocol, {onEvent: function(e) {}}, onCreate);
+ socket.create(protocol, {}, onCreate);
};
function onDataRead(readInfo) {
@@ -88,7 +88,6 @@ function onDataRead(readInfo) {
chrome.test.succeed();
}
});
- // Blocked. Wait for onEvent.
}
function onWriteOrSendToComplete(writeInfo) {
@@ -99,7 +98,6 @@ function onWriteOrSendToComplete(writeInfo) {
else
socket.recvFrom(socketId, onDataRead);
}
- // Blocked. Wait for onEvent.
}
function onConnectOrBindComplete(connectResult) {
@@ -113,7 +111,6 @@ function onConnectOrBindComplete(connectResult) {
onWriteOrSendToComplete);
});
}
- // Blocked. Wait for onEvent.
}
function onCreate(socketInfo) {
@@ -125,18 +122,6 @@ function onCreate(socketInfo) {
socket.bind(socketId, "0.0.0.0", 0, onConnectOrBindComplete);
}
-function onEvent(socketEvent) {
- if (socketEvent.type == "connectComplete") {
- onConnectOrBindComplete(socketEvent.resultCode);
- } else if (socketEvent.type == "dataRead") {
- onDataRead({resultCode: socketEvent.resultCode, data: socketEvent.data});
- } else if (socketEvent.type == "writeComplete") {
- onWriteOnSendToComplete(socketEvent.resultCode);
- } else {
- console.log("Received unhandled socketEvent of type " + socketEvent.type);
- }
-};
-
function waitForBlockingOperation() {
if (++waitCount < 10) {
setTimeout(waitForBlockingOperation, 1000);
@@ -153,7 +138,7 @@ var testSending = function() {
waitCount = 0;
setTimeout(waitForBlockingOperation, 1000);
- socket.create(protocol, {onEvent: onEvent}, onCreate);
+ socket.create(protocol, {}, onCreate);
};
var onMessageReply = function(message) {
« no previous file with comments | « chrome/renderer/resources/extensions/experimental.socket_custom_bindings.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698