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

Side by Side Diff: extensions/test/data/api_test/audio/add_nodes/background.js

Issue 2585413002: Update audio api to use v2 stable device ID (Closed)
Patch Set: Created 4 years 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 2015 The Chromium Authors. All rights reserved. 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 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 chrome.test.runTests([ 5 chrome.test.runTests([
6 function waitForDeviceChangedEventTests() { 6 function waitForDeviceChangedEventTests() {
7 chrome.test.listenOnce(chrome.audio.OnDevicesChanged, function(devices) { 7 chrome.test.listenOnce(chrome.audio.OnDevicesChanged, function(devices) {
8 var deviceList = devices.map(function(device) { 8 var deviceList = devices.map(function(device) {
9 return { 9 return {
10 id: device.id, 10 id: device.id,
11 stableId: device.stableId,
11 stableDeviceId: device.stableDeviceId, 12 stableDeviceId: device.stableDeviceId,
12 isInput: device.isInput, 13 isInput: device.isInput,
13 deviceType: device.deviceType, 14 deviceType: device.deviceType,
14 deviceName: device.deviceName, 15 deviceName: device.deviceName,
15 displayName: device.displayName 16 displayName: device.displayName
16 }; 17 };
17 }).sort(function(lhs, rhs) { 18 }).sort(function(lhs, rhs) {
18 return Number.parseInt(lhs.id) - Number.parseInt(rhs.id); 19 return Number.parseInt(lhs.id) - Number.parseInt(rhs.id);
19 }); 20 });
20 21
22 chrome.test.assertTrue(devices.length > 0);
23 var hasStableId = !!devices[0].stableId;
24
21 chrome.test.assertEq([{ 25 chrome.test.assertEq([{
22 id: '30001', 26 id: '30001',
27 stableId: hasStableId ? '116606' /* 80001 ^ 0xFFFF */ : '',
23 stableDeviceId: '80001', 28 stableDeviceId: '80001',
24 isInput: false, 29 isInput: false,
25 deviceType: 'USB', 30 deviceType: 'USB',
26 deviceName: 'Jabra Speaker', 31 deviceName: 'Jabra Speaker',
27 displayName: 'Jabra Speaker 1' 32 displayName: 'Jabra Speaker 1'
28 }, { 33 }, {
29 id: '30002', 34 id: '30002',
35 stableId: hasStableId ? '116605' /* 80002 ^ 0xFFFF */ : '',
30 stableDeviceId: '80002', 36 stableDeviceId: '80002',
31 isInput: false, 37 isInput: false,
32 deviceType: 'USB', 38 deviceType: 'USB',
33 deviceName: 'Jabra Speaker', 39 deviceName: 'Jabra Speaker',
34 displayName: 'Jabra Speaker 2' 40 displayName: 'Jabra Speaker 2'
35 }, { 41 }, {
36 id: '30003', 42 id: '30003',
43 stableId: hasStableId ? '116604' /* 80003 ^ 0xFFFF */ : '',
37 stableDeviceId: '80003', 44 stableDeviceId: '80003',
38 isInput: false, 45 isInput: false,
39 deviceType: 'HDMI', 46 deviceType: 'HDMI',
40 deviceName: 'HDMI output', 47 deviceName: 'HDMI output',
41 displayName: 'HDA Intel MID' 48 displayName: 'HDA Intel MID'
42 }], deviceList); 49 }], deviceList);
43 }); 50 });
44 } 51 }
45 ]); 52 ]);
46 53
47 chrome.test.sendMessage('loaded'); 54 chrome.test.sendMessage('loaded');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698