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 addRemoveDevice() { | 7 function addRemoveDevice() { |
8 var should_be_available = true; | 8 var should_be_available = true; |
9 chrome.gcdPrivate.onCloudDeviceStateChanged.addListener( | 9 chrome.gcdPrivate.onLocalDeviceStateChanged.addListener( |
10 function(available, device) { | 10 function(available, device) { |
11 chrome.test.assertEq(available, should_be_available); | 11 chrome.test.assertEq(available, should_be_available); |
12 should_be_available = false; | 12 should_be_available = false; |
13 | 13 |
14 chrome.test.assertEq(device.setupType, "mdns"); | 14 chrome.test.assertEq(device.setupType, "mdns"); |
15 chrome.test.assertEq(device.idString, | 15 chrome.test.assertEq(device.idString, |
16 "mdns:myService._privet._tcp.local"); | 16 "mdns:myService._privet._tcp.local"); |
17 chrome.test.assertEq(device.deviceType, "printer"); | 17 chrome.test.assertEq(device.deviceType, "printer"); |
18 chrome.test.assertEq(device.deviceName, | 18 chrome.test.assertEq(device.deviceName, |
19 "Sample device"); | 19 "Sample device"); |
20 chrome.test.assertEq(device.deviceDescription, | 20 chrome.test.assertEq(device.deviceDescription, |
21 "Sample device description"); | 21 "Sample device description"); |
22 | 22 |
23 if (!available) { | 23 if (!available) { |
24 // Only pass after device is removed | 24 // Only pass after device is removed |
25 chrome.test.notifyPass(); | 25 chrome.test.notifyPass(); |
26 } | 26 } |
27 }) | 27 }) |
28 }]); | 28 }]); |
29 }; | 29 }; |
OLD | NEW |