From: Pawel Wasowski
Date: Wed, 4 Aug 2021 16:16:42 +0000 (+0200)
Subject: [Iotcon] Add NotSupportedError to initialize()
X-Git-Tag: submit/tizen/20210823.074335~1
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=973286791d6502044d4605bab8cb3a95ad37e400;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[Iotcon] Add NotSupportedError to initialize()
ACR: TWDAPI-279
[Verification] After disabling iotcon support in
/etc/config/model-config.xml, tizen.iotcon.initialize() throws
NotSupportedError, as expected.
Auto tct-iotcon-tizen-tests pass rate: 100% (with the iotcon support
enabled in model-config.xml)
No tct-iotcon-tizen-tests are run when the iotcon support is disabled
in model-config.xml
Change-Id: I41be8376bcc1bca5b919daa0a5d0a9651b14d335
Signed-off-by: Pawel Wasowski
---
diff --git a/src/iotcon/iotcon_api.js b/src/iotcon/iotcon_api.js
index 954068d5..2d3ee8d6 100644
--- a/src/iotcon/iotcon_api.js
+++ b/src/iotcon/iotcon_api.js
@@ -1439,6 +1439,15 @@ function Iotcon() {
}
Iotcon.prototype.initialize = function() {
+ var kIotconFeature = 'http://tizen.org/feature/iot.ocf';
+
+ if (!tizen.systeminfo.getCapability(kIotconFeature)) {
+ throw new WebAPIException(
+ 'NotSupportedError',
+ 'The feature "' + kIotconFeature + '" is not supported'
+ );
+ }
+
var args = validator.validateArgs(arguments, [
{
name: 'filePath',