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

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: Fix IDL 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..9bcc2d4132aedc756ffb0bf0ce0e8013d49b983d 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
@@ -4,40 +4,28 @@
var usb = chrome.usb;
-var tests = [
- function explicitCloseDevice() {
- usb.findDevices({vendorId: 0, productId: 0}, function(devices) {
- usb.closeDevice(devices[0]);
+function getDevices() {
+ usb.getDevices({
+ vendorId: 0,
+ productId: 0
+ }, function(devices) {
+ usb.openDevice(devices[0], function(handle) {
+ usb.closeDevice(handle);
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();
- });
- });
- });
- });
- });
- },
-];
+ });
+}
+
+function explicitCloseDevice() {
+ usb.findDevices({
+ vendorId: 0,
+ productId: 0
+ }, function(devices) {
+ usb.closeDevice(devices[0]);
+ chrome.test.succeed();
+ });
+}
-chrome.test.runTests(tests);
+chrome.test.runTests([
+ getDevices, explicitCloseDevice
+]);

Powered by Google App Engine
This is Rietveld 408576698