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.
5 chrome
.audio
.OnDevicesChanged
.addListener(function (devices
) {
6 if (devices
.length
=== 3) {
7 if (devices
[0].id
!= "30001" ||
8 devices
[0].isInput
!= false ||
9 devices
[0].deviceType
!= "USB" ||
10 devices
[0].deviceName
!= "Jabra Speaker" ||
11 devices
[0].displayName
!= "Jabra Speaker 1") {
12 console
.error("Got wrong device property for device:" +
13 JSON
.stringify(devices
[0]));
14 chrome
.test
.sendMessage("failure");
16 if (devices
[1].id
!= "30002" ||
17 devices
[1].isInput
!= false ||
18 devices
[1].deviceType
!= "USB" ||
19 devices
[1].deviceName
!= "Jabra Speaker" ||
20 devices
[1].displayName
!= "Jabra Speaker 2") {
21 console
.error("Got wrong device property for device:" +
22 JSON
.stringify(devices
[1]));
23 chrome
.test
.sendMessage("failure");
25 if (devices
[2].id
!= "30003" ||
26 devices
[2].isInput
!= false ||
27 devices
[2].deviceType
!= "HDMI" ||
28 devices
[2].deviceName
!= "HDMI output" ||
29 devices
[2].displayName
!= "HDA Intel MID") {
30 console
.error("Got wrong device property for device:" +
31 JSON
.stringify(devices
[2]));
32 chrome
.test
.sendMessage("failure");
34 chrome
.test
.sendMessage("success");
36 console
.error("Got unexpected OnNodesChanged event failed");
37 chrome
.test
.sendMessage("failure");
40 chrome
.test
.sendMessage("loaded");