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

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

Issue 891853002: Add a UsbService::Observer function for cleanup actions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
(Empty)
1 // Copyright 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.
4
5 var device_from_user = undefined;
6
7 chrome.test.runWithUserGesture(function() {
8 chrome.usb.getDevices({}, function(devices) {
9 chrome.test.assertEq(0, devices.length);
10 chrome.usb.getUserSelectedDevices({ multiple: false }, function(devices) {
11 chrome.test.assertEq(1, devices.length);
12 device_from_user = devices[0];
13 chrome.usb.openDevice(device_from_user, function(connection) {
14 chrome.usb.closeDevice(connection);
15 chrome.test.sendMessage("opened_device");
16 });
17 });
18 });
19 });
20
21 chrome.usb.onDeviceRemoved.addListener(function(device) {
22 if (device.device == device_from_user.device) {
23 chrome.test.sendMessage("success");
24 } else {
25 chrome.test.sendMessage("failure");
26 }
27 });
OLDNEW
« no previous file with comments | « extensions/browser/api/usb/usb_apitest.cc ('k') | extensions/test/data/api_test/usb/get_user_selected_devices/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698