OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var error; | 5 var error; |
6 | 6 |
7 function testGetDescriptors() { | 7 function testGetDescriptors() { |
8 if (error !== undefined) { | 8 if (error !== undefined) { |
9 chrome.test.sendMessage('fail'); | 9 chrome.test.sendMessage('fail'); |
10 chrome.test.fail(error); | 10 chrome.test.fail(error); |
11 } | 11 } |
12 chrome.test.assertEq(2, descrs.length); | 12 chrome.test.assertEq(2, descrs.length); |
13 | 13 |
14 chrome.test.assertEq('desc_id0', descrs[0].instanceId); | 14 chrome.test.assertEq('desc_id0', descrs[0].instanceId); |
15 chrome.test.assertEq('00001221-0000-1000-8000-00805f9b34fb', descrs[0].uuid); | 15 chrome.test.assertEq('00001221-0000-1000-8000-00805f9b34fb', descrs[0].uuid); |
16 chrome.test.assertEq(false, descrs[0].isLocal); | |
17 chrome.test.assertEq(charId, descrs[0].characteristic.instanceId); | 16 chrome.test.assertEq(charId, descrs[0].characteristic.instanceId); |
18 | 17 |
19 var valueBytes = new Uint8Array(descrs[0].value); | 18 var valueBytes = new Uint8Array(descrs[0].value); |
20 chrome.test.assertEq(3, descrs[0].value.byteLength); | 19 chrome.test.assertEq(3, descrs[0].value.byteLength); |
21 chrome.test.assertEq(0x01, valueBytes[0]); | 20 chrome.test.assertEq(0x01, valueBytes[0]); |
22 chrome.test.assertEq(0x02, valueBytes[1]); | 21 chrome.test.assertEq(0x02, valueBytes[1]); |
23 chrome.test.assertEq(0x03, valueBytes[2]); | 22 chrome.test.assertEq(0x03, valueBytes[2]); |
24 | 23 |
25 chrome.test.assertEq('desc_id1', descrs[1].instanceId); | 24 chrome.test.assertEq('desc_id1', descrs[1].instanceId); |
26 chrome.test.assertEq('00001222-0000-1000-8000-00805f9b34fb', descrs[1].uuid); | 25 chrome.test.assertEq('00001222-0000-1000-8000-00805f9b34fb', descrs[1].uuid); |
27 chrome.test.assertEq(false, descrs[1].isLocal); | |
28 chrome.test.assertEq(charId, descrs[1].characteristic.instanceId); | 26 chrome.test.assertEq(charId, descrs[1].characteristic.instanceId); |
29 | 27 |
30 valueBytes = new Uint8Array(descrs[1].value); | 28 valueBytes = new Uint8Array(descrs[1].value); |
31 chrome.test.assertEq(2, descrs[1].value.byteLength); | 29 chrome.test.assertEq(2, descrs[1].value.byteLength); |
32 chrome.test.assertEq(0x04, valueBytes[0]); | 30 chrome.test.assertEq(0x04, valueBytes[0]); |
33 chrome.test.assertEq(0x05, valueBytes[1]); | 31 chrome.test.assertEq(0x05, valueBytes[1]); |
34 | 32 |
35 chrome.test.succeed(); | 33 chrome.test.succeed(); |
36 } | 34 } |
37 | 35 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 83 |
86 descrs = result; | 84 descrs = result; |
87 | 85 |
88 chrome.test.sendMessage('ready', function (message) { | 86 chrome.test.sendMessage('ready', function (message) { |
89 chrome.test.runTests([testGetDescriptors]); | 87 chrome.test.runTests([testGetDescriptors]); |
90 }); | 88 }); |
91 }); | 89 }); |
92 }); | 90 }); |
93 }); | 91 }); |
94 }); | 92 }); |
OLD | NEW |