Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / bluetooth / get_device / runtest.js
blob8d736244f2484c608defa72e35864d323632b0a8
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.
5 function testGetDevice() {
6   chrome.test.assertEq(1, devices.length);
7   chrome.test.assertEq('d1', devices[0].name);
9   chrome.test.succeed();
12 var devices = [];
14 function failOnError() {
15   if (chrome.runtime.lastError) {
16     chrome.test.fail(chrome.runtime.lastError.message);
17   }
20 chrome.bluetooth.getDevice('11:12:13:14:15:16',
21   function(device) {
22     failOnError();
23     devices.push(device);
25     chrome.bluetooth.getDevice('21:22:23:24:25:26',
26       function(device) {
27         // device should not exists
28         if (device || !chrome.runtime.lastError) {
29           chrome.test.fail('Unexpected device or missing error');
30         }
32         chrome.test.sendMessage('ready',
33           function(message) {
34             chrome.test.runTests([testGetDevice]);
35           });
36       });
37   });