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); |