Update broken references to image assets
[chromium-blink-merge.git] / extensions / test / data / api_test / usb / transfer_failure / test.js
blob09c53759a2f17df83dd58d888e676791ebf2903c
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 function createErrorTest(resultCode, errorMessage) {
8 return function() {
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.endpoint = 1;
14 transfer.data = new ArrayBuffer(0);
15 usb.bulkTransfer(device, transfer, function (result) {
16 if (errorMessage) {
17 chrome.test.assertLastError(errorMessage);
18 } else {
19 chrome.test.assertNoLastError();
21 chrome.test.assertTrue(resultCode == result.resultCode);
22 chrome.test.succeed();
23 });
24 });
28 var tests = [
29 createErrorTest(0, undefined),
30 createErrorTest(1, "Transfer failed."),
31 createErrorTest(2, "Transfer timed out."),
34 chrome.test.runTests(tests);