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

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

Issue 2462833002: Refactor audio API tests (Closed)
Patch Set: Refactor audio API tests Created 4 years, 1 month 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.audio.OnDevicesChanged.addListener(function (devices) { 5 chrome.test.runTests([
6 if (devices.length === 3) { 6 function waitForDeviceChangedEventTests() {
7 if (devices[0].id != "30001" || 7 chrome.test.listenOnce(chrome.audio.OnDevicesChanged, function(devices) {
8 devices[0].stableDeviceId != "80001" || 8 var deviceList = devices.map(function(device) {
9 devices[0].isInput != false || 9 return {
10 devices[0].deviceType != "USB" || 10 id: device.id,
11 devices[0].deviceName != "Jabra Speaker" || 11 stableDeviceId: device.stableDeviceId,
12 devices[0].displayName != "Jabra Speaker 1") { 12 isInput: device.isInput,
13 console.error("Got wrong device property for device:" + 13 deviceType: device.deviceType,
14 JSON.stringify(devices[0])); 14 deviceName: device.deviceName,
15 chrome.test.sendMessage("failure"); 15 displayName: device.displayName
16 } 16 };
17 if (devices[1].id != "30002" || 17 }).sort(function(lhs, rhs) {
18 devices[1].stableDeviceId != "80002" || 18 return Number.parseInt(lhs.id) - Number.parseInt(rhs.id);
19 devices[1].isInput != false || 19 });
20 devices[1].deviceType != "USB" || 20
21 devices[1].deviceName != "Jabra Speaker" || 21 chrome.test.assertEq([{
22 devices[1].displayName != "Jabra Speaker 2") { 22 id: '30001',
23 console.error("Got wrong device property for device:" + 23 stableDeviceId: '80001',
24 JSON.stringify(devices[1])); 24 isInput: false,
25 chrome.test.sendMessage("failure"); 25 deviceType: 'USB',
26 } 26 deviceName: 'Jabra Speaker',
27 if (devices[2].id != "30003" || 27 displayName: 'Jabra Speaker 1'
28 devices[2].stableDeviceId != "80003" || 28 }, {
29 devices[2].isInput != false || 29 id: '30002',
30 devices[2].deviceType != "HDMI" || 30 stableDeviceId: '80002',
31 devices[2].deviceName != "HDMI output" || 31 isInput: false,
32 devices[2].displayName != "HDA Intel MID") { 32 deviceType: 'USB',
33 console.error("Got wrong device property for device:" + 33 deviceName: 'Jabra Speaker',
34 JSON.stringify(devices[2])); 34 displayName: 'Jabra Speaker 2'
35 chrome.test.sendMessage("failure"); 35 }, {
36 } 36 id: '30003',
37 chrome.test.sendMessage("success"); 37 stableDeviceId: '80003',
38 } else { 38 isInput: false,
39 console.error("Got unexpected OnNodesChanged event failed"); 39 deviceType: 'HDMI',
40 chrome.test.sendMessage("failure"); 40 deviceName: 'HDMI output',
41 displayName: 'HDA Intel MID'
42 }], deviceList);
43 });
41 } 44 }
42 }); 45 ]);
43 chrome.test.sendMessage("loaded"); 46
47 chrome.test.sendMessage('loaded');
OLDNEW
« no previous file with comments | « extensions/browser/api/audio/audio_apitest.cc ('k') | extensions/test/data/api_test/audio/input_mute_change/background.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698