OLD | NEW |
(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) { |
| 9 // The result is undefined because the manifest does not specify the experimen
tal permission. |
| 10 chrome.test.assertEq(undefined, acceptInfo); |
| 11 chrome.test.succeed(); |
| 12 }; |
| 13 |
| 14 var onListen = function(result) { |
| 15 // The result is undefined because the manifest does not specify the experimen
tal permission. |
| 16 chrome.test.assertEq(undefined, result); |
| 17 socket.accept(sid, onAccept); |
| 18 }; |
| 19 |
| 20 var onCreate = function(socketInfo) { |
| 21 sid = socketInfo.socketId; |
| 22 socket.listen(sid, '127.0.0.1', 1234, onListen); |
| 23 }; |
| 24 |
| 25 var onMessageReply = function() { |
| 26 socket.create('tcp', {}, onCreate); |
| 27 }; |
| 28 |
| 29 chrome.test.sendMessage("ready", onMessageReply); |
OLD | NEW |