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