1 // Copyright 2014 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 known_devices
= {};
7 chrome
.usb
.onDeviceRemoved
.addListener(function(device
) {
8 if (device
.device
in known_devices
) {
9 chrome
.test
.sendMessage("success");
11 console
.error("Unexpected device removed: " + device
.device
);
12 chrome
.test
.sendMessage("failure");
16 chrome
.usb
.getDevices({}, function(devices
) {
17 for (var device
of devices
) {
18 known_devices
[device
.device
] = device
;
20 chrome
.test
.sendMessage("loaded");