Update broken references to image assets
[chromium-blink-merge.git] / extensions / test / data / api_test / usb / reset_device / test.js
blobe709fff913485533687bb010aec093762bbe2592
1 // Copyright 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.
5 var usb = chrome.usb;
7 function resetDevice() {
8 usb.findDevices({vendorId: 0, productId: 0}, function(devices) {
9 usb.resetDevice(devices[0], function(result) {
10 chrome.test.assertEq(result, true);
11 // Ensure the device is still open.
12 var transfer = {
13 direction: "out",
14 endpoint: 2,
15 data: new ArrayBuffer(1)
17 usb.interruptTransfer(devices[0], transfer, function(result) {
18 // This is designed to fail.
19 usb.resetDevice(devices[0], function(result) {
20 chrome.test.assertLastError(
21 'Error resetting the device. The device has been closed.');
22 chrome.test.assertEq(false, result);
23 usb.interruptTransfer(devices[0], transfer, function(result) {
24 chrome.test.assertEq(undefined, result);
25 chrome.test.assertLastError('No such connection.');
26 chrome.test.succeed();
27 });
28 });
29 });
30 });
31 });
34 chrome.test.runTests([resetDevice]);