OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017 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 fetchDeviceDecription() { |
| 8 const fetchDeviceDescriptionCallback = result => { |
| 9 chrome.test.assertNoLastError(); |
| 10 chrome.test.assertEq('object', typeof(result)); |
| 11 chrome.test.assertEq('http://127.0.0.1/apps', result.appUrl); |
| 12 chrome.test.assertEq('<xml>testDescription</xml>', |
| 13 result.deviceDescription); |
| 14 chrome.test.succeed(); |
| 15 }; |
| 16 chrome.dial.fetchDeviceDescription('testDevice', |
| 17 fetchDeviceDescriptionCallback); |
| 18 }, |
| 19 function fetchDeviceDecriptionFails() { |
| 20 const fetchDeviceDescriptionCallbackFails = result => { |
| 21 chrome.test.assertEq(undefined, result); |
| 22 chrome.test.assertLastError('Device not found'); |
| 23 chrome.test.succeed(); |
| 24 }; |
| 25 chrome.dial.fetchDeviceDescription('unknownDevice', |
| 26 fetchDeviceDescriptionCallbackFails); |
| 27 } |
| 28 // TODO(mfoltz): Test other fetch errors |
| 29 ]); |
| 30 }; |
OLD | NEW |