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 var kAdvertisement = { | |
6 type: 'broadcast', | |
7 serviceUuids: ['value1', 'value2'], | |
8 manufacturerData: [{id: 321, data: [1, 2, 3]}, | |
tbarzic
2017/06/27 22:49:12
nit:
manufacturerData: [
{},
{}
],
Sonny Sasaka
2017/06/27 23:14:01
The dummy fields are actually required fields.
tbarzic
2017/06/27 23:17:05
yes, I was just to lazy to write all of it down, t
Sonny Sasaka
2017/06/27 23:21:45
Done.
| |
9 {id: 567, data: [8, 2, 3]}], | |
10 solicitUuids: ['value3', 'value4'], | |
11 serviceData: [{uuid: 'uuid8', data: [1, 2, 3]}, | |
12 {uuid: 'uuid36', data: [8, 2, 3]}] | |
13 }; | |
14 | |
15 var registeredAdvertisements = []; | |
16 | |
17 chrome.test.runTests([ | |
18 function registerFirstAdvertisement() { | |
19 chrome.bluetoothLowEnergy.registerAdvertisement( | |
20 kAdvertisement, | |
21 chrome.test.callbackPass(function(id) { | |
22 chrome.test.assertTrue(!!id); | |
23 registeredAdvertisements.push(id); | |
24 })); | |
25 }, | |
26 | |
27 function registerSecondAdvertisement() { | |
28 chrome.bluetoothLowEnergy.registerAdvertisement( | |
29 kAdvertisement, | |
30 chrome.test.callbackPass(function(id) { | |
31 chrome.test.assertTrue(!!id); | |
32 chrome.test.assertEq(-1, registeredAdvertisements.indexOf(id)); | |
33 registeredAdvertisements.push(id); | |
34 })); | |
35 }, | |
36 | |
37 function resetAdvertising() { | |
38 chrome.bluetoothLowEnergy.resetAdvertising(chrome.test.callbackPass()); | |
39 }, | |
40 | |
41 function unregisterFails() { | |
42 registeredAdvertisements.forEach(function(id) { | |
43 chrome.bluetoothLowEnergy.unregisterAdvertisement( | |
44 id, | |
45 chrome.test.callbackFail("This advertisement does not exist")); | |
46 }); | |
47 } | |
48 ]); | |
OLD | NEW |