Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(717)

Side by Side Diff: extensions/test/data/api_test/usb/reset_device/test.js

Issue 980023002: Move device/usb classes from the FILE thread to UI thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed first round of rocket@ feedback. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var usb = chrome.usb; 5 var usb = chrome.usb;
6 6
7 function resetDevice() { 7 function resetDevice() {
8 usb.findDevices({vendorId: 0, productId: 0}, function(devices) { 8 usb.findDevices({vendorId: 0, productId: 0}, function(devices) {
9 usb.resetDevice(devices[0], function(result) { 9 usb.resetDevice(devices[0], function(result) {
10 chrome.test.assertEq(result, true); 10 chrome.test.assertEq(result, true);
11 // Ensure the device is still open. 11 // Ensure the device is still open.
12 var transfer = { 12 var transfer = {
13 direction: "out", 13 direction: "out",
14 endpoint: 2, 14 endpoint: 2,
15 data: new ArrayBuffer(1) 15 data: new ArrayBuffer(1)
16 }; 16 };
17 usb.interruptTransfer(devices[0], transfer, function(result) { 17 usb.interruptTransfer(devices[0], transfer, function(result) {
18 // This is designed to fail. 18 // This is designed to fail.
19 usb.resetDevice(devices[0], function(result) { 19 usb.resetDevice(devices[0], function(result) {
20 chrome.test.assertLastError( 20 chrome.test.assertLastError(
21 'Error resetting the device. The device has been closed.'); 21 'Error resetting the device. The device has been closed.');
22 chrome.test.assertEq(result, false); 22 chrome.test.assertEq(false, result);
23 usb.interruptTransfer(devices[0], transfer, function(result) { 23 usb.interruptTransfer(devices[0], transfer, function(result) {
24 chrome.test.assertEq(result, undefined); 24 chrome.test.assertEq(undefined, result);
25 chrome.test.assertLastError('No such device.'); 25 chrome.test.assertLastError('No such connection.');
26 chrome.test.succeed(); 26 chrome.test.succeed();
27 }); 27 });
28 }); 28 });
29 }); 29 });
30 }); 30 });
31 }); 31 });
32 } 32 }
33 33
34 chrome.test.runTests([resetDevice]); 34 chrome.test.runTests([resetDevice]);
OLDNEW
« extensions/browser/api/usb/usb_api.h ('K') | « extensions/shell/browser/shell_device_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698