OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 onload = function() { | 5 onload = function() { |
6 chrome.test.runTests([ | 6 chrome.test.runTests([ |
7 function session() { | 7 function session() { |
8 function onConfirmCode(sessionId, status, code, method) { | 8 function onConfirmCode(sessionId, status, confirmationInfo) { |
9 chrome.test.assertEq("success", status); | 9 chrome.test.assertEq("success", status); |
10 chrome.test.assertEq("01234", code); | 10 chrome.test.assertEq("01234", confirmationInfo.code); |
| 11 chrome.test.assertEq("displayCode", confirmationInfo.type); |
| 12 |
11 chrome.gcdPrivate.confirmCode(sessionId, | 13 chrome.gcdPrivate.confirmCode(sessionId, |
| 14 "01234", |
12 onSessionEstablished.bind(null, | 15 onSessionEstablished.bind(null, |
13 sessionId)); | 16 sessionId)); |
14 } | 17 } |
15 | 18 |
16 function onSessionEstablished(sessionId, status) { | 19 function onSessionEstablished(sessionId, status) { |
17 chrome.test.assertEq("success", status); | 20 chrome.test.assertEq("success", status); |
18 | 21 |
19 chrome.gcdPrivate.sendMessage(sessionId, "/privet/ping", {}, | 22 chrome.gcdPrivate.sendMessage(sessionId, "/privet/ping", {}, |
20 onMessageSent); | 23 onMessageSent); |
21 } | 24 } |
22 | 25 |
23 function onMessageSent(status, output) { | 26 function onMessageSent(status, output) { |
24 chrome.test.assertEq("success", status); | 27 chrome.test.assertEq("success", status); |
25 chrome.test.assertEq("pong", output.response); | 28 chrome.test.assertEq("pong", output.response); |
26 | 29 |
27 chrome.test.notifyPass(); | 30 chrome.test.notifyPass(); |
28 } | 31 } |
29 | 32 |
30 chrome.gcdPrivate.establishSession("1.2.3.4", 9090, onConfirmCode); | 33 chrome.gcdPrivate.establishSession("1.2.3.4", 9090, onConfirmCode); |
31 } | 34 } |
32 ]); | 35 ]); |
33 }; | 36 }; |
OLD | NEW |