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

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

Issue 10827390: Implement chrome.socket.bind/listen/accept for TCP server socket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments, add permissions test, fix bug with accept() 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
(Empty)
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
3 // found in the LICENSE file.
4
5 const socket = chrome.socket;
6 var sid;
7
8 var onAccept = function(acceptInfo) {
miket_OOO 2012/09/26 21:02:44 Perfect. For the sanity of future engineers in thi
justinlin 2012/09/26 23:03:57 Done. :)
9 chrome.test.assertEq(undefined, acceptInfo);
10 chrome.test.succeed();
11 };
12
13 var onListen = function(result) {
14 chrome.test.assertEq(undefined, result);
15 socket.accept(sid, onAccept);
16 };
17
18 var onCreate = function(socketInfo) {
19 sid = socketInfo.socketId;
20 socket.listen(sid, '127.0.0.1', 1234, onListen);
21 };
22
23 var onMessageReply = function() {
24 socket.create('tcp', {}, onCreate);
25 };
26
27 chrome.test.sendMessage("ready", onMessageReply);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698