1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
14 function listInterfaces() {
15 chrome.permissions.request({
16 permissions: [{'usbDevices': [DEVICE_ID]}]
17 }, function(granted) {
19 chrome.test.fail('Could not get optional permisson');
21 usb.findDevices(DEVICE_ID, function(devices) {
22 if (typeof devices === 'undefined') {
23 chrome.test.fail('Device optional_permissions seem to be missing');
25 for (var i = 0; i < devices.length; i++) {
26 var device = devices[i];
27 console.log('device: ' + JSON.stringify(device));
28 usb.listInterfaces(device, function(result) {
29 if (typeof result !== 'object') {
30 chrome.test.fail('should be object type. was: '
33 console.log(JSON.stringify(result));
34 chrome.test.succeed();
45 chrome.test.runTests(tests);