OLD | NEW |
(Empty) | |
| 1 // Copyright 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 /** |
| 6 * @fileoverview Basic tests of API functions in a real (non-mocked) shell to |
| 7 * ensure they can be called from a particular client or environment. |
| 8 * Tests that verify specific behaviors should be in their own API tests. |
| 9 */ |
| 10 |
| 11 // Tests chrome.bluetooth availability. |
| 12 function bluetoothSanityCheck() { |
| 13 chrome.test.assertTrue( |
| 14 !!chrome.bluetooth, 'chrome.bluetooth should be available'); |
| 15 |
| 16 chrome.bluetooth.getAdapterState(chrome.test.callback()); |
| 17 chrome.bluetooth.getDevice( |
| 18 'AB:CD:EF:01:23:45', chrome.test.callbackFail('Invalid device')); |
| 19 chrome.bluetooth.getDevices(chrome.test.callback()); |
| 20 |
| 21 // TODO(michaelpg): Re-enable on Chrome OS after crbug.com/711484 is fixed. |
| 22 if (!/CrOS/.test(navigator.userAgent)) { |
| 23 var startDiscoveryCallback = chrome.test.callbackAdded(); |
| 24 chrome.bluetooth.startDiscovery(function() { |
| 25 // Ignore errors. |
| 26 chrome.runtime.lastError; |
| 27 startDiscoveryCallback(); |
| 28 }); |
| 29 |
| 30 var stopDiscoveryCallback = chrome.test.callbackAdded(); |
| 31 chrome.bluetooth.stopDiscovery(function() { |
| 32 // Ignore errors. |
| 33 chrome.runtime.lastError; |
| 34 stopDiscoveryCallback(); |
| 35 }); |
| 36 } |
| 37 } |
| 38 |
| 39 chrome.app.runtime.onLaunched.addListener(function() { |
| 40 chrome.test.runTests([bluetoothSanityCheck]); |
| 41 }); |
OLD | NEW |