OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 onload = function() { |
| 6 chrome.test.runTests([ |
| 7 function session() { |
| 8 function onConfirmCode(sessionId, status, code, method) { |
| 9 chrome.test.assertEq("success", status); |
| 10 chrome.test.assertEq("01234", code); |
| 11 chrome.gcdPrivate.confirmCode(sessionId, |
| 12 onSessionEstablished.bind(null, |
| 13 sessionId)); |
| 14 } |
| 15 |
| 16 function onSessionEstablished(sessionId, status) { |
| 17 chrome.test.assertEq("success", status); |
| 18 |
| 19 chrome.gcdPrivate.sendMessage(sessionId, "/privet/ping", {}, |
| 20 onMessageSent); |
| 21 } |
| 22 |
| 23 function onMessageSent(status, output) { |
| 24 chrome.test.assertEq("success", status); |
| 25 chrome.test.assertEq("pong", output.response); |
| 26 |
| 27 chrome.test.notifyPass(); |
| 28 } |
| 29 |
| 30 chrome.gcdPrivate.establishSession("1.2.3.4", 9090, onConfirmCode); |
| 31 } |
| 32 ]); |
| 33 }; |
OLD | NEW |