Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / bluetooth / device_info / runtest.js
blobbe22e1628b7b03f23549c24db5a4e186d5501b19
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 testDeviceInfo() {
6   chrome.test.assertEq(2, devices.length);
8   chrome.test.assertEq('Chromebook Pixel', devices[0].name);
9   chrome.test.assertEq(0x080104, devices[0].deviceClass);
10   chrome.test.assertEq('bluetooth', devices[0].vendorIdSource);
11   chrome.test.assertEq(0x00E0, devices[0].vendorId);
12   chrome.test.assertEq(0x240A, devices[0].productId);
13   chrome.test.assertEq(0x0400, devices[0].deviceId);
14   chrome.test.assertEq('computer', devices[0].type);
16   chrome.test.assertEq(2, devices[0].uuids.length);
17   chrome.test.assertEq('00001105-0000-1000-8000-00805f9b34fb',
18                        devices[0].uuids[0]);
19   chrome.test.assertEq('00001106-0000-1000-8000-00805f9b34fb',
20                        devices[0].uuids[1]);
22   chrome.test.assertEq('d2', devices[1].name);
23   chrome.test.assertEq(0, devices[1].deviceClass);
24   chrome.test.assertEq(undefined, devices[1].vendorIdSource);
25   chrome.test.assertEq(undefined, devices[1].vendorId);
26   chrome.test.assertEq(undefined, devices[1].productId);
27   chrome.test.assertEq(undefined, devices[1].deviceId);
28   chrome.test.assertEq(undefined, devices[1].type);
29   chrome.test.assertEq(0, devices[1].uuids.length);
31   chrome.test.succeed();
34 var devices = [];
36 function failOnError() {
37   if (chrome.runtime.lastError) {
38     chrome.test.fail(chrome.runtime.lastError.message);
39   }
42 chrome.bluetooth.getDevices(
43   function(result) {
44     failOnError();
45     devices = result;
46     chrome.test.sendMessage('ready',
47       function(message) {
48         chrome.test.runTests([testDeviceInfo]);
49       });
50   });