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