Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / extensions / test / data / api_test / usb / invalid_timeout / test.js
blob1138a9b09fea987cebe04c1673b34d5494a91e51
1 // Copyright (c) 2015 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 genericTransfer = {
8   "direction": "in",
9   "endpoint": 1,
10   "length": 0,
11   "timeout": -1
13 var controlTransfer = {
14   "index": 0,
15   "direction": "in",
16   "requestType": "standard",
17   "recipient": "device",
18   "request": 0,
19   "value": 0,
20   "length": 0,
21   "timeout": -1
23 var isoTransfer = {
24   "packetLength": 0,
25   "transferInfo": genericTransfer,
26   "packets": 0
28 var errorTimeout = 'Transfer timeout must be greater than or equal to 0.';
30 function createInvalidTransferTest(usbFunction, transferInfo) {
31   return function() {
32     usb.findDevices({vendorId: 0, productId: 0}, function(devices) {
33       var device = devices[0];
34       usbFunction(device, transferInfo, chrome.test.callbackFail(errorTimeout));
35     });
36   };
39 var tests = [
40   createInvalidTransferTest(usb.bulkTransfer, genericTransfer),
41   createInvalidTransferTest(usb.controlTransfer, controlTransfer),
42   createInvalidTransferTest(usb.interruptTransfer, genericTransfer),
43   createInvalidTransferTest(usb.isochronousTransfer, isoTransfer),
46 chrome.test.runTests(tests);