From: Piotr Czaja
Date: Tue, 17 Feb 2015 11:23:12 +0000 (+0100)
Subject: [TVAudio] Throw exception if 'setVolume' is called without argument
X-Git-Tag: submit/tizen_tv/20150603.064601~1^2~415
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=51a092ee7b4c444004c88f02a85617721e96ec74;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[TVAudio] Throw exception if 'setVolume' is called without argument
[Verification] 'setVolume' called without argument throws
InvalidValuesError.
Change-Id: I2f847be94a46342916cd3fb791b87f3882e98ca6
Signed-off-by: Piotr Czaja
---
diff --git a/src/tvaudio/tvaudio_api.js b/src/tvaudio/tvaudio_api.js
index 8613d67c..58a9ffc3 100644
--- a/src/tvaudio/tvaudio_api.js
+++ b/src/tvaudio/tvaudio_api.js
@@ -83,6 +83,11 @@ AudioControlManager.prototype.setVolume = function(volume) {
'Volume is out of range: ' + args.volume, 'InvalidValuesError');
}
+ if (arguments.length < 1) {
+ throw new tizen.WebAPIException(tizen.WebAPIException.INVALID_VALUES_ERR,
+ 'no volume argument: ' + arguments.length, 'InvalidValuesError');
+ }
+
var ret = native.callSync('AudioControlManager_setVolume', {
volume: args.volume
});