1 // Copyright (c) 2012 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.
8 function controlTransfer() {
9 usb.findDevices({vendorId: 0, productId: 0}, function (devices) {
10 var device = devices[0];
11 var transfer = new Object();
12 transfer.direction = "out";
13 transfer.recipient = "device";
14 transfer.requestType = "standard";
18 transfer.data = new ArrayBuffer(1);
20 usb.controlTransfer(device, transfer, function (result) {
21 chrome.test.succeed();
25 function bulkTransfer() {
26 usb.findDevices({vendorId: 0, productId: 0}, function (devices) {
27 var device = devices[0];
28 var transfer = new Object();
29 transfer.direction = "out";
30 transfer.endpoint = 1;
31 transfer.data = new ArrayBuffer(1);
33 usb.bulkTransfer(device, transfer, function (result) {
34 chrome.test.succeed();
38 function interruptTransfer() {
39 usb.findDevices({vendorId: 0, productId: 0}, function (devices) {
40 var device = devices[0];
41 var transfer = new Object();
42 transfer.direction = "out";
43 transfer.endpoint = 2;
44 transfer.data = new ArrayBuffer(1);
46 usb.interruptTransfer(device, transfer, function (result) {
47 chrome.test.succeed();
51 function isochronousTransfer() {
52 usb.findDevices({vendorId: 0, productId: 0}, function (devices) {
53 var device = devices[0];
54 var transfer = new Object();
55 transfer.direction = "out";
56 transfer.endpoint = 3;
57 transfer.data = new ArrayBuffer(1);
59 var isoTransfer = new Object();
60 isoTransfer.transferInfo = transfer;
61 isoTransfer.packets = 1;
62 isoTransfer.packetLength = 1;
64 usb.isochronousTransfer(device, isoTransfer, function (result) {
65 chrome.test.succeed();
71 chrome.test.runTests(tests);