From 973286791d6502044d4605bab8cb3a95ad37e400 Mon Sep 17 00:00:00 2001 From: Pawel Wasowski Date: Wed, 4 Aug 2021 18:16:42 +0200 Subject: [PATCH] [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 --- src/iotcon/iotcon_api.js | 9 +++++++++ 1 file changed, 9 insertions(+) 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', -- 2.34.1