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 testGetDescriptor() { | 7 function testGetDescriptor() { |
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.assertTrue(descriptor != null, '\'descriptor\' is null'); | 12 chrome.test.assertTrue(descriptor != null, '\'descriptor\' is null'); |
13 | 13 |
14 chrome.test.assertEq('desc_id0', descriptor.instanceId); | 14 chrome.test.assertEq('desc_id0', descriptor.instanceId); |
15 chrome.test.assertEq('00001221-0000-1000-8000-00805f9b34fb', descriptor.uuid); | 15 chrome.test.assertEq('00001221-0000-1000-8000-00805f9b34fb', descriptor.uuid); |
16 chrome.test.assertEq(false, descriptor.isLocal); | |
17 chrome.test.assertEq(charId, descriptor.characteristic.instanceId); | 16 chrome.test.assertEq(charId, descriptor.characteristic.instanceId); |
18 | 17 |
19 var valueBytes = new Uint8Array(descriptor.value); | 18 var valueBytes = new Uint8Array(descriptor.value); |
20 chrome.test.assertEq(3, descriptor.value.byteLength); | 19 chrome.test.assertEq(3, descriptor.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.succeed(); | 24 chrome.test.succeed(); |
26 } | 25 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 84 |
86 chrome.test.sendMessage('ready', function (message) { | 85 chrome.test.sendMessage('ready', function (message) { |
87 chrome.test.runTests([testGetDescriptor]); | 86 chrome.test.runTests([testGetDescriptor]); |
88 }); | 87 }); |
89 }); | 88 }); |
90 }); | 89 }); |
91 }); | 90 }); |
92 }); | 91 }); |
93 }); | 92 }); |
94 }); | 93 }); |
OLD | NEW |