- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / api_test / bluetooth / get_profiles / runtest.js
1 // Copyright 2013 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 function testGetProfiles() {
6   chrome.test.assertEq(2, profiles.length);
7   chrome.test.assertEq('1234', profiles[0].uuid);
8   chrome.test.assertEq('5678', profiles[1].uuid);
9   chrome.test.succeed();
10 }
11
12 var profiles = [];
13
14 function failOnError() {
15   if (chrome.runtime.lastError) {
16     chrome.test.fail(chrome.runtime.lastError.message);
17   }
18 }
19
20 chrome.bluetooth.getProfiles(
21   {
22     device: {
23     name: 'device',
24     address: '11:12:13:14:15:16',
25     paired: false,
26     connected: false
27     }
28   },
29   function(results) {
30     failOnError();
31     profiles = results;
32     chrome.test.sendMessage('ready',
33       function(message) {
34         chrome.test.runTests([testGetProfiles]);
35       });
36   });