| 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 wifiMessage() { | |
| 8 var messages_needed = 3; | |
| 9 function onConfirmCode(sessionId, status, code, method) { | |
| 10 chrome.test.assertEq("success", status); | |
| 11 chrome.test.assertEq("01234", code); | |
| 12 chrome.gcdPrivate.confirmCode(sessionId, | |
| 13 onSessionEstablished.bind(null, | |
| 14 sessionId)); | |
| 15 } | |
| 16 | |
| 17 function onSessionEstablished(sessionId, status) { | |
| 18 chrome.test.assertEq("success", status); | |
| 19 | |
| 20 chrome.gcdPrivate.sendMessage(sessionId, "/privet/v3/setup/start", { | |
| 21 "wifi" : { | |
| 22 } | |
| 23 }, onMessageSent.bind(null, "setupParseError")); | |
| 24 | |
| 25 chrome.gcdPrivate.sendMessage(sessionId, "/privet/v3/setup/start", { | |
| 26 "wifi" : { | |
| 27 "passphrase": "Blah" | |
| 28 } | |
| 29 }, onMessageSent.bind(null, "setupParseError")); | |
| 30 | |
| 31 chrome.gcdPrivate.sendMessage(sessionId, "/privet/v3/setup/start", { | |
| 32 "wifi" : { | |
| 33 "ssid": "Blah" | |
| 34 } | |
| 35 }, onMessageSent.bind(null, "wifiPasswordError")); | |
| 36 } | |
| 37 | |
| 38 function onMessageSent(expected_status, status, output) { | |
| 39 chrome.test.assertEq(expected_status, status); | |
| 40 messages_needed--; | |
| 41 console.log("Messages needed " + messages_needed); | |
| 42 | |
| 43 if (messages_needed == 0) { | |
| 44 chrome.test.notifyPass(); | |
| 45 } | |
| 46 } | |
| 47 | |
| 48 chrome.gcdPrivate.establishSession("1.2.3.4", 9090, onConfirmCode); | |
| 49 } | |
| 50 ]); | |
| 51 }; | |
| OLD | NEW |