Update broken references to image assets
[chromium-blink-merge.git] / extensions / test / data / api_test / usb / transfer_event / test.js
blob294864a7595ef248a4dd626d2460a302b450e612
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.
5 var usb = chrome.usb;
7 var tests = [
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";
15 transfer.request = 1;
16 transfer.value = 2;
17 transfer.index = 3;
18 transfer.data = new ArrayBuffer(1);
20 usb.controlTransfer(device, transfer, function (result) {
21 chrome.test.succeed();
22 });
23 });
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();
35 });
36 });
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();
48 });
49 });
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();
66 });
67 });
71 chrome.test.runTests(tests);