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

Unified Diff: extensions/test/data/api_test/audio/test.js

Issue 2578473002: chrome.audio API: treat mute as system wide property (Closed)
Patch Set: . Created 3 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: extensions/test/data/api_test/audio/test.js
diff --git a/extensions/test/data/api_test/audio/test.js b/extensions/test/data/api_test/audio/test.js
index 8aa3e477caff743ac07946de5e48a1ec02392b90..10af90c8e5edfea7698a5922a322fc302efb6696 100644
--- a/extensions/test/data/api_test/audio/test.js
+++ b/extensions/test/data/api_test/audio/test.js
@@ -167,11 +167,9 @@ chrome.test.runTests([
var updatedOutput = expectedOutput['30001'];
chrome.test.assertFalse(updatedOutput.isMuted);
chrome.test.assertFalse(updatedOutput.volume === 35);
- updatedOutput.isMuted = true;
updatedOutput.volume = 35;
chrome.audio.setProperties('30001', {
- isMuted: true,
volume: 35
}, chrome.test.callbackPass(function() {
chrome.audio.setProperties('40002', {
@@ -188,28 +186,61 @@ chrome.test.runTests([
});
},
+ function inputMuteTest() {
+ var getMute = function(callback) {
+ chrome.audio.getMute('INPUT', chrome.test.callbackPass(callback));
+ };
+ getMute(function(originalValue) {
+ chrome.audio.setMute(
+ 'INPUT', !originalValue, chrome.test.callbackPass(function() {
+ getMute(function(value) {
+ chrome.test.assertEq(!originalValue, value);
+ });
+ }));
+ });
+ },
+
+ function outputMuteTest() {
+ var getMute = function(callback) {
+ chrome.audio.getMute('OUTPUT', chrome.test.callbackPass(callback));
+ };
+ getMute(function(originalValue) {
+ chrome.audio.setMute(
+ 'OUTPUT', !originalValue, chrome.test.callbackPass(function() {
+ getMute(function(value) {
+ chrome.test.assertEq(!originalValue, value);
+ });
+ }));
+ });
+ },
+
function setPropertiesInvalidValuesTest() {
getDevices(function(originalOutputInfo, originalInputInfo) {
var expectedInput = deviceListToExpectedDevicesMap(originalInputInfo);
var expectedOutput = deviceListToExpectedDevicesMap(originalOutputInfo);
+ var expectedError = 'Could not set volume/gain properties';
- chrome.audio.setProperties('30001', {
- isMuted: true,
- // Output device - should have volume set.
- gain: 55
- }, chrome.test.callbackFail('Could not set properties', function() {
- chrome.audio.setProperties('40002', {
- isMuted: true,
- // Input device - should have gain set.
- volume:55
- }, chrome.test.callbackFail('Could not set properties', function() {
- // Assert that device properties haven't changed.
- getDevices(function(outputInfo, inputInfo) {
- assertDevicesMatch(expectedOutput, outputInfo);
- assertDevicesMatch(expectedInput, inputInfo);
- });
- }));
- }));
+ chrome.audio.setProperties(
+ '30001', {
+ isMuted: true,
+ // Output device - should have volume set.
+ gain: 55
+ },
+ chrome.test.callbackFail(expectedError, function() {
+ chrome.audio.setProperties(
+ '40002', {
+ isMuted: true,
+ // Input device - should have gain set.
+ volume: 55
+ },
+ chrome.test.callbackFail(expectedError, function() {
+ // Assert that device properties haven't changed.
+ getDevices(function(outputInfo, inputInfo) {
+ assertDevicesMatch(expectedOutput, outputInfo);
+ assertDevicesMatch(expectedInput, inputInfo);
+ });
+ }));
+ }));
});
},
« no previous file with comments | « extensions/test/data/api_test/audio/output_mute_change/background.js ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698