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

Unified Diff: extensions/test/data/api_test/usb/set_configuration/test.js

Issue 826283002: Add support for sending a USB SET_CONFIGURATION request. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 11 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: extensions/test/data/api_test/usb/set_configuration/test.js
diff --git a/extensions/test/data/api_test/usb/set_configuration/test.js b/extensions/test/data/api_test/usb/set_configuration/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..6533c864eba35bc460d50c3be1b4765231675972
--- /dev/null
+++ b/extensions/test/data/api_test/usb/set_configuration/test.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var usb = chrome.usb;
+
+var tests = [
+ function setConfiguration() {
+ usb.findDevices({vendorId: 0, productId: 0}, function (devices) {
+ var device = devices[0];
+ usb.getConfiguration(device, function (result) {
+ chrome.test.assertLastError("The device is not in a configured state.");
+ usb.setConfiguration(device, 1, function (result) {
+ chrome.test.assertNoLastError();
+ chrome.test.assertTrue(result);
+ usb.getConfiguration(device, function (result) {
+ chrome.test.assertNoLastError();
+ chrome.test.succeed();
+ });
+ });
+ });
+ });
+ }
+];
+
+chrome.test.runTests(tests);

Powered by Google App Engine
This is Rietveld 408576698