OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 usb = chrome.usb; | 5 var usb = chrome.usb; |
6 | 6 |
7 var tests = [ | 7 var tests = [ |
8 function explicitCloseDevice() { | |
9 usb.findDevices({vendorId: 0, productId: 0}, function(devices) { | |
10 usb.closeDevice(devices[0]); | |
11 chrome.test.succeed(); | |
12 }); | |
13 }, | |
14 function resetDevice() { | 8 function resetDevice() { |
15 usb.findDevices({vendorId: 0, productId: 0}, function(devices) { | 9 usb.findDevices({vendorId: 0, productId: 0}, function(devices) { |
16 usb.resetDevice(devices[0], function(result) { | 10 usb.resetDevice(devices[0], function(result) { |
17 chrome.test.assertEq(result, true); | 11 chrome.test.assertEq(result, true); |
18 // Ensure the device is still open. | 12 // Ensure the device is still open. |
19 var transfer = { | 13 var transfer = { |
20 direction: "out", | 14 direction: "out", |
21 endpoint: 2, | 15 endpoint: 2, |
22 data: new ArrayBuffer(1) | 16 data: new ArrayBuffer(1) |
23 }; | 17 }; |
(...skipping 10 matching lines...) Expand all Loading... |
34 chrome.test.succeed(); | 28 chrome.test.succeed(); |
35 }); | 29 }); |
36 }); | 30 }); |
37 }); | 31 }); |
38 }); | 32 }); |
39 }); | 33 }); |
40 }, | 34 }, |
41 ]; | 35 ]; |
42 | 36 |
43 chrome.test.runTests(tests); | 37 chrome.test.runTests(tests); |
OLD | NEW |