summaryrefslogtreecommitdiffstats
path: root/extensions/test
diff options
context:
space:
mode:
authorreillyg <reillyg@chromium.org>2015-09-17 19:52:02 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-18 02:52:47 +0000
commit98624c769a5268117f4336a46d68c1e5bd5050bd (patch)
tree23e7044ef0c1aff2a41c383d494639d86fe0551e /extensions/test
parent717e49ce3d4eb2949bd1568011de98003667fd07 (diff)
downloadchromium_src-98624c769a5268117f4336a46d68c1e5bd5050bd.zip
chromium_src-98624c769a5268117f4336a46d68c1e5bd5050bd.tar.gz
chromium_src-98624c769a5268117f4336a46d68c1e5bd5050bd.tar.bz2
Add chrome.usb.getConfigurations function.
Add a new extension function that returns all of the configuration descriptors from the provided USB device. In addition to exposing this useful information to applications (as otherwise they would need to call chrome.usb.setConfiguration blindly to set a non-default configuration) it is also now available without having to call chrome.usb.openDevice first. BUG=531586 Review URL: https://codereview.chromium.org/1357523005 Cr-Commit-Position: refs/heads/master@{#349592}
Diffstat (limited to 'extensions/test')
-rw-r--r--extensions/test/data/api_test/usb/device_handling/test.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/extensions/test/data/api_test/usb/device_handling/test.js b/extensions/test/data/api_test/usb/device_handling/test.js
index a546564..5914f6a 100644
--- a/extensions/test/data/api_test/usb/device_handling/test.js
+++ b/extensions/test/data/api_test/usb/device_handling/test.js
@@ -22,6 +22,22 @@ function getDevices() {
});
}
+function getConfigurations() {
+ usb.getDevices({}, function(devices) {
+ chrome.test.assertNoLastError();
+ chrome.test.assertEq(1, devices.length);
+ chrome.usb.getConfigurations(devices[0], function(configs) {
+ chrome.test.assertNoLastError();
+ chrome.test.assertEq(2, configs.length);
+ chrome.test.assertTrue(configs[0].active);
+ chrome.test.assertEq(1, configs[0].configurationValue);
+ chrome.test.assertFalse(configs[1].active);
+ chrome.test.assertEq(2, configs[1].configurationValue);
+ chrome.test.succeed();
+ });
+ });
+}
+
function explicitCloseDevice() {
usb.findDevices({
vendorId: 0,
@@ -33,5 +49,5 @@ function explicitCloseDevice() {
}
chrome.test.runTests([
- getDevices, explicitCloseDevice
+ getDevices, getConfigurations, explicitCloseDevice
]);