Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9490)

Unified Diff: chrome/test/data/extensions/api_test/usb/device_handling/test.js

Issue 22914023: Introducing chrome.usb.getDevices/openDevice API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@usb-interface
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/usb/device_handling/test.js
diff --git a/chrome/test/data/extensions/api_test/usb/device_handling/test.js b/chrome/test/data/extensions/api_test/usb/device_handling/test.js
index 55d657c1d71930aa99b9c968c17b4513a7b36e62..fefe916028ba927fd646be9a1b5084f31291c56e 100644
--- a/chrome/test/data/extensions/api_test/usb/device_handling/test.js
+++ b/chrome/test/data/extensions/api_test/usb/device_handling/test.js
@@ -5,39 +5,21 @@
var usb = chrome.usb;
var tests = [
+ function getDevices() {
+ usb.getDevices({vendorId: 0, productId: 0}, function(devices) {
+ console.log(devices);
+ usb.openDevice(devices[0], function(handle){
+ usb.closeDevice(handle);
+ chrome.test.succeed();
+ });
+ });
+ },
function explicitCloseDevice() {
usb.findDevices({vendorId: 0, productId: 0}, function(devices) {
usb.closeDevice(devices[0]);
chrome.test.succeed();
});
- },
- function resetDevice() {
- usb.findDevices({vendorId: 0, productId: 0}, function(devices) {
- usb.resetDevice(devices[0], function(result) {
- chrome.test.assertEq(result, true);
- // Ensure the device is still open.
- var transfer = {
- direction: "out",
- endpoint: 2,
- data: new ArrayBuffer(1)
- };
- usb.interruptTransfer(devices[0], transfer, function(result) {
- // This is designed to fail.
- usb.resetDevice(devices[0], function(result) {
- chrome.test.assertEq(result, false);
- usb.interruptTransfer(devices[0], transfer, function(result) {
- chrome.test.assertEq(result, undefined);
- chrome.test.assertEq(
- chrome.runtime.lastError && chrome.runtime.lastError.message,
- 'No such device.'
- );
- chrome.test.succeed();
- });
- });
- });
- });
- });
- },
+ }
];
chrome.test.runTests(tests);

Powered by Google App Engine
This is Rietveld 408576698