From f6e6597e3601482f0ac49bd78d209a7b45db4562 Mon Sep 17 00:00:00 2001 From: Dongsun Lee Date: Wed, 1 Jun 2016 13:32:34 +0900 Subject: [PATCH] [CAPI Changed] Enum value names and scan cloud - enum value changes for csr_wp_ask_user_e, csr_wp_user_response_e, csr_cs_ask_user_e, csr_cs_core_usage_e, and csr_cs_user_response_e - API description changes for csr_cs_malware_list_get_malware and some enums in csr-content-screening-types.h - Parameter(bool) added to scan on cloud option setter API for turning on and off the option. Change-Id: I05672483fda2539b615dcb3db29a27cba703fe8f Signed-off-by: Dongsun Lee --- src/framework/client/content-screening.cpp | 17 +++++++------- src/framework/client/web-protection.cpp | 2 +- src/framework/common/cs-context.cpp | 4 ++-- src/framework/common/cs-detected.cpp | 2 +- src/framework/common/wp-context.cpp | 2 +- src/framework/common/wp-result.cpp | 2 +- src/framework/service/core-usage.cpp | 8 +++---- src/framework/service/cs-logic.cpp | 10 ++++---- src/framework/service/wp-logic.cpp | 4 ++-- src/framework/ui/popup/logic.cpp | 34 +++++++++++++-------------- src/include/csr/csr-content-screening-types.h | 26 ++++++++++---------- src/include/csr/csr-content-screening.h | 17 +++++++++----- src/include/csr/csr-web-protection-types.h | 10 ++++---- src/include/csr/csr-web-protection.h | 6 ++--- test/internals/test-cpucore.cpp | 8 +++---- test/popup/test-popup.cpp | 10 ++++---- test/test-api-content-screening.cpp | 15 ++++++------ test/test-api-web-protection.cpp | 14 +++++------ 18 files changed, 98 insertions(+), 93 deletions(-) diff --git a/src/framework/client/content-screening.cpp b/src/framework/client/content-screening.cpp index 9cd5a04..29d786e 100644 --- a/src/framework/client/content-screening.cpp +++ b/src/framework/client/content-screening.cpp @@ -41,10 +41,10 @@ namespace { bool _isValid(const csr_cs_core_usage_e &value) { switch (value) { - case CSR_CS_USE_CORE_DEFAULT: - case CSR_CS_USE_CORE_ALL: - case CSR_CS_USE_CORE_HALF: - case CSR_CS_USE_CORE_SINGLE: + case CSR_CS_CORE_USAGE_DEFAULT: + case CSR_CS_CORE_USAGE_ALL: + case CSR_CS_CORE_USAGE_HALF: + case CSR_CS_CORE_USAGE_SINGLE: return true; default: @@ -55,8 +55,8 @@ bool _isValid(const csr_cs_core_usage_e &value) bool _isValid(const csr_cs_ask_user_e &value) { switch (value) { - case CSR_CS_NOT_ASK_USER: - case CSR_CS_ASK_USER: + case CSR_CS_ASK_USER_NO: + case CSR_CS_ASK_USER_YES: return true; default: @@ -193,9 +193,8 @@ int csr_cs_set_core_usage(csr_cs_context_h handle, csr_cs_core_usage_e usage) EXCEPTION_SAFE_END } -// TODO: API which unset this option isn't needed? API -int csr_cs_set_scan_on_cloud(csr_cs_context_h handle) +int csr_cs_set_scan_on_cloud(csr_cs_context_h handle, bool is_on_cloud) { EXCEPTION_SAFE_START @@ -203,7 +202,7 @@ int csr_cs_set_scan_on_cloud(csr_cs_context_h handle) return CSR_ERROR_INVALID_HANDLE; reinterpret_cast(handle)->getContext()->set( - static_cast(CsContext::Key::ScanOnCloud), true); + static_cast(CsContext::Key::ScanOnCloud), is_on_cloud); return CSR_ERROR_NONE; diff --git a/src/framework/client/web-protection.cpp b/src/framework/client/web-protection.cpp index c44da80..a05695e 100644 --- a/src/framework/client/web-protection.cpp +++ b/src/framework/client/web-protection.cpp @@ -71,7 +71,7 @@ int csr_wp_set_ask_user(csr_wp_context_h handle, csr_wp_ask_user_e ask_user) if (handle == nullptr) return CSR_ERROR_INVALID_HANDLE; - else if (ask_user != CSR_WP_NOT_ASK_USER && ask_user != CSR_WP_ASK_USER) + else if (ask_user != CSR_WP_ASK_USER_NO && ask_user != CSR_WP_ASK_USER_YES) return CSR_ERROR_INVALID_PARAMETER; reinterpret_cast(handle)->getContext()->set( diff --git a/src/framework/common/cs-context.cpp b/src/framework/common/cs-context.cpp index 978a073..9e5aca5 100644 --- a/src/framework/common/cs-context.cpp +++ b/src/framework/common/cs-context.cpp @@ -27,8 +27,8 @@ namespace Csr { CsContext::CsContext() noexcept : - askUser(CSR_CS_NOT_ASK_USER), - coreUsage(CSR_CS_USE_CORE_DEFAULT), + askUser(CSR_CS_ASK_USER_NO), + coreUsage(CSR_CS_CORE_USAGE_DEFAULT), isScanOnCloud(false) { } diff --git a/src/framework/common/cs-detected.cpp b/src/framework/common/cs-detected.cpp index b6f835f..2871f2f 100644 --- a/src/framework/common/cs-detected.cpp +++ b/src/framework/common/cs-detected.cpp @@ -30,7 +30,7 @@ namespace Csr { CsDetected::CsDetected() noexcept : severity(CSR_CS_SEVERITY_LOW), - response(CSR_CS_NO_ASK_USER), + response(CSR_CS_USER_RESPONSE_USER_NOT_ASKED), isApp(false), ts(0) { diff --git a/src/framework/common/wp-context.cpp b/src/framework/common/wp-context.cpp index a001a96..7d79f8d 100644 --- a/src/framework/common/wp-context.cpp +++ b/src/framework/common/wp-context.cpp @@ -26,7 +26,7 @@ namespace Csr { -WpContext::WpContext() noexcept : askUser(CSR_WP_NOT_ASK_USER) +WpContext::WpContext() noexcept : askUser(CSR_WP_ASK_USER_NO) { } diff --git a/src/framework/common/wp-result.cpp b/src/framework/common/wp-result.cpp index 3e7e8e0..7e82afb 100644 --- a/src/framework/common/wp-result.cpp +++ b/src/framework/common/wp-result.cpp @@ -25,7 +25,7 @@ namespace Csr { WpResult::WpResult() noexcept : riskLevel(CSR_WP_RISK_LOW), - response(CSR_WP_NO_ASK_USER) + response(CSR_WP_USER_RESPONSE_USER_NOT_ASKED) { } diff --git a/src/framework/service/core-usage.cpp b/src/framework/service/core-usage.cpp index e02108d..d727eca 100644 --- a/src/framework/service/core-usage.cpp +++ b/src/framework/service/core-usage.cpp @@ -38,16 +38,16 @@ const int TotalCoreNum = ::sysconf(_SC_NPROCESSORS_ONLN); void CpuUsageManager::set(const csr_cs_core_usage_e &cu) { switch (cu) { - case CSR_CS_USE_CORE_HALF: + case CSR_CS_CORE_USAGE_HALF: CpuUsageManager::setRunningCores(TotalCoreNum / 2); break; - case CSR_CS_USE_CORE_SINGLE: + case CSR_CS_CORE_USAGE_SINGLE: CpuUsageManager::setRunningCores(CpuUsageManager::MinCoreNum); break; - case CSR_CS_USE_CORE_DEFAULT: - case CSR_CS_USE_CORE_ALL: + case CSR_CS_CORE_USAGE_DEFAULT: + case CSR_CS_CORE_USAGE_ALL: CpuUsageManager::reset(); break; diff --git a/src/framework/service/cs-logic.cpp b/src/framework/service/cs-logic.cpp index 7b780c9..b145320 100644 --- a/src/framework/service/cs-logic.cpp +++ b/src/framework/service/cs-logic.cpp @@ -43,8 +43,8 @@ namespace { void setCoreUsage(const csr_cs_core_usage_e &cu) { switch (cu) { - case CSR_CS_USE_CORE_HALF: - case CSR_CS_USE_CORE_SINGLE: + case CSR_CS_CORE_USAGE_HALF: + case CSR_CS_CORE_USAGE_SINGLE: CpuUsageManager::set(cu); break; @@ -624,8 +624,8 @@ RawBuffer CsLogic::getIgnoredList(const StrSet &dirSet) RawBuffer CsLogic::handleAskUser(const CsContext &c, CsDetected &d, FilePtr &&fileptr) { - if (c.askUser == CSR_CS_NOT_ASK_USER) { - d.response = CSR_CS_NO_ASK_USER; + if (c.askUser == CSR_CS_ASK_USER_NO) { + d.response = CSR_CS_USER_RESPONSE_USER_NOT_ASKED; return BinaryQueue::Serialize(CSR_ERROR_NONE, d).pop(); } @@ -660,7 +660,7 @@ RawBuffer CsLogic::handleAskUser(const CsContext &c, CsDetected &d, FilePtr &&fi Ui::AskUser askUser; d.response = askUser.cs(cid, c.popupMessage, d); - if (d.response == CSR_CS_REMOVE && !d.targetName.empty()) { + if (d.response == CSR_CS_USER_RESPONSE_REMOVE && !d.targetName.empty()) { try { FilePtr _fileptr; diff --git a/src/framework/service/wp-logic.cpp b/src/framework/service/wp-logic.cpp index 6c7d824..c4b707f 100644 --- a/src/framework/service/wp-logic.cpp +++ b/src/framework/service/wp-logic.cpp @@ -87,8 +87,8 @@ RawBuffer WpLogic::checkUrl(const WpContext &context, const std::string &url) csr_wp_user_response_e WpLogic::getUserResponse(const WpContext &c, const std::string &url, const WpResult &wr) { - if (c.askUser == CSR_WP_NOT_ASK_USER) - return CSR_WP_NO_ASK_USER; + if (c.askUser == CSR_WP_ASK_USER_NO) + return CSR_WP_USER_RESPONSE_USER_NOT_ASKED; Ui::CommandId cid; diff --git a/src/framework/ui/popup/logic.cpp b/src/framework/ui/popup/logic.cpp index 0caee2d..beaf6fd 100644 --- a/src/framework/ui/popup/logic.cpp +++ b/src/framework/ui/popup/logic.cpp @@ -94,9 +94,9 @@ RawBuffer Logic::csPromptData(const std::string &message, std::unique_ptr resps(new int[2]); - addButton(static_cast(CSR_CS_PROCESSING_ALLOWED), &resps[0], "button1", "yes", + addButton(static_cast(CSR_CS_USER_RESPONSE_PROCESSING_ALLOWED), &resps[0], "button1", "yes", popup, result); - addButton(static_cast(CSR_CS_PROCESSING_DISALLOWED), &resps[1], "button2", "no", + addButton(static_cast(CSR_CS_USER_RESPONSE_PROCESSING_DISALLOWED), &resps[1], "button2", "no", popup, result); popup.start(); @@ -117,11 +117,11 @@ RawBuffer Logic::csPromptFile(const std::string &message, const CsDetected &d) c std::unique_ptr resps(new int[3]); - addButton(static_cast(CSR_CS_REMOVE), &resps[0], "button1", "remove", popup, + addButton(static_cast(CSR_CS_USER_RESPONSE_REMOVE), &resps[0], "button1", "remove", popup, result); - addButton(static_cast(CSR_CS_PROCESSING_ALLOWED), &resps[1], "button2", "allow", + addButton(static_cast(CSR_CS_USER_RESPONSE_PROCESSING_ALLOWED), &resps[1], "button2", "allow", popup, result); - addButton(static_cast(CSR_CS_PROCESSING_DISALLOWED), &resps[2], "button3", "deny", + addButton(static_cast(CSR_CS_USER_RESPONSE_PROCESSING_DISALLOWED), &resps[2], "button3", "deny", popup, result); popup.start(); @@ -142,11 +142,11 @@ RawBuffer Logic::csPromptApp(const std::string &message, const CsDetected &d) co std::unique_ptr resps(new int[3]); - addButton(static_cast(CSR_CS_REMOVE), &resps[0], "button1", "remove", popup, + addButton(static_cast(CSR_CS_USER_RESPONSE_REMOVE), &resps[0], "button1", "remove", popup, result); - addButton(static_cast(CSR_CS_PROCESSING_ALLOWED), &resps[1], "button2", "allow", + addButton(static_cast(CSR_CS_USER_RESPONSE_PROCESSING_ALLOWED), &resps[1], "button2", "allow", popup, result); - addButton(static_cast(CSR_CS_PROCESSING_DISALLOWED), &resps[2], "button3", "deny", + addButton(static_cast(CSR_CS_USER_RESPONSE_PROCESSING_DISALLOWED), &resps[2], "button3", "deny", popup, result); popup.start(); @@ -168,9 +168,9 @@ RawBuffer Logic::csNotifyData(const std::string &message, const CsDetected &d) c std::unique_ptr resps(new int[2]); - addButton(static_cast(CSR_CS_PROCESSING_ALLOWED), &resps[0], "button1", "yes", + addButton(static_cast(CSR_CS_USER_RESPONSE_PROCESSING_ALLOWED), &resps[0], "button1", "yes", popup, result); - addButton(static_cast(CSR_CS_PROCESSING_DISALLOWED), &resps[1], "button2", "no", + addButton(static_cast(CSR_CS_USER_RESPONSE_PROCESSING_DISALLOWED), &resps[1], "button2", "no", popup, result); popup.start(); @@ -191,9 +191,9 @@ RawBuffer Logic::csNotifyFile(const std::string &message, const CsDetected &d) c std::unique_ptr resps(new int[2]); - addButton(static_cast(CSR_CS_REMOVE), &resps[0], "button1", "remove", popup, + addButton(static_cast(CSR_CS_USER_RESPONSE_REMOVE), &resps[0], "button1", "remove", popup, result); - addButton(static_cast(CSR_CS_PROCESSING_DISALLOWED), &resps[1], "button2", "deny", + addButton(static_cast(CSR_CS_USER_RESPONSE_PROCESSING_DISALLOWED), &resps[1], "button2", "deny", popup, result); popup.start(); @@ -214,9 +214,9 @@ RawBuffer Logic::csNotifyApp(const std::string &message, const CsDetected &d) co std::unique_ptr resps(new int[2]); - addButton(static_cast(CSR_CS_REMOVE), &resps[0], "button1", "remove", popup, + addButton(static_cast(CSR_CS_USER_RESPONSE_REMOVE), &resps[0], "button1", "remove", popup, result); - addButton(static_cast(CSR_CS_PROCESSING_DISALLOWED), &resps[1], "button2", "deny", + addButton(static_cast(CSR_CS_USER_RESPONSE_PROCESSING_DISALLOWED), &resps[1], "button2", "deny", popup, result); popup.start(); @@ -238,9 +238,9 @@ RawBuffer Logic::wpPrompt(const std::string &message, const UrlItem &item) const std::unique_ptr resps(new int[2]); - addButton(static_cast(CSR_WP_PROCESSING_ALLOWED), &resps[0], "button1", "allow", + addButton(static_cast(CSR_WP_USER_RESPONSE_PROCESSING_ALLOWED), &resps[0], "button1", "allow", popup, result); - addButton(static_cast(CSR_WP_PROCESSING_DISALLOWED), &resps[1], "button2", "deny", + addButton(static_cast(CSR_WP_USER_RESPONSE_PROCESSING_DISALLOWED), &resps[1], "button2", "deny", popup, result); popup.start(); @@ -262,7 +262,7 @@ RawBuffer Logic::wpNotify(const std::string &message, const UrlItem &item) const std::unique_ptr resp(new int); - addButton(static_cast(CSR_WP_PROCESSING_DISALLOWED), resp.get(), "button1", + addButton(static_cast(CSR_WP_USER_RESPONSE_PROCESSING_DISALLOWED), resp.get(), "button1", "confirm", popup, result); popup.start(); diff --git a/src/include/csr/csr-content-screening-types.h b/src/include/csr/csr-content-screening-types.h index 27cf231..2952f79 100644 --- a/src/include/csr/csr-content-screening-types.h +++ b/src/include/csr/csr-content-screening-types.h @@ -46,8 +46,8 @@ typedef enum { * @since_tizen 3.0 */ typedef enum { - CSR_CS_NOT_ASK_USER = 0x00, /**< Do not ask the user even if malicious contents were found.*/ - CSR_CS_ASK_USER = 0x01 /**< Ask the user when malicious contents were found. */ + CSR_CS_ASK_USER_NO = 0x00, /**< Do not ask the user even if malicious contents were found.*/ + CSR_CS_ASK_USER_YES = 0x01 /**< Ask the user when malicious contents were found. */ } csr_cs_ask_user_e; /** @@ -55,10 +55,10 @@ typedef enum { * @since_tizen 3.0 */ typedef enum { - CSR_CS_NO_ASK_USER = 0x00, /**< No response from user. */ - CSR_CS_REMOVE = 0x01, /**< A user decided to remove a detected malicious content and it was removed. */ - CSR_CS_PROCESSING_ALLOWED = 0x02, /**< A user decided to process a detected malware. */ - CSR_CS_PROCESSING_DISALLOWED = 0x03, /**< A user decided not to process a detected malware. */ + CSR_CS_USER_RESPONSE_USER_NOT_ASKED = 0x00, /**< No response from user. */ + CSR_CS_USER_RESPONSE_REMOVE = 0x01, /**< A user decided to remove a detected malicious content and it was removed. */ + CSR_CS_USER_RESPONSE_PROCESSING_ALLOWED = 0x02, /**< A user decided to process a detected malware. */ + CSR_CS_USER_RESPONSE_PROCESSING_DISALLOWED = 0x03, /**< A user decided not to process a detected malware. */ } csr_cs_user_response_e; /** @@ -66,9 +66,9 @@ typedef enum { * @since_tizen 3.0 */ typedef enum { - CSR_CS_ACTION_REMOVE = 0x00, /* Remove the detected malware file. */ - CSR_CS_ACTION_IGNORE = 0x01, /* Ignore the detected malware file. */ - CSR_CS_ACTION_UNIGNORE = 0x02 /* Unignore the previously ignored file. */ + CSR_CS_ACTION_REMOVE = 0x00, /**< Remove the detected malware file. */ + CSR_CS_ACTION_IGNORE = 0x01, /**< Ignore the detected malware file. */ + CSR_CS_ACTION_UNIGNORE = 0x02 /**< Unignore the previously ignored file. */ } csr_cs_action_e; /** @@ -76,10 +76,10 @@ typedef enum { * @since_tizen 3.0 */ typedef enum { - CSR_CS_USE_CORE_DEFAULT = 0x00, /* Use default setting value. */ - CSR_CS_USE_CORE_ALL = 0x01, /* Use all cores during scanning. */ - CSR_CS_USE_CORE_HALF = 0x02, /* Use half cores during scanning. */ - CSR_CS_USE_CORE_SINGLE = 0x03 /* Use a single core during scanning. */ + CSR_CS_CORE_USAGE_DEFAULT = 0x00, /**< Use default setting value. */ + CSR_CS_CORE_USAGE_ALL = 0x01, /**< Use all cores during scanning. */ + CSR_CS_CORE_USAGE_HALF = 0x02, /**< Use half cores during scanning. */ + CSR_CS_CORE_USAGE_SINGLE = 0x03 /**< Use a single core during scanning. */ } csr_cs_core_usage_e; /** diff --git a/src/include/csr/csr-content-screening.h b/src/include/csr/csr-content-screening.h index e2e7fb5..1762be7 100644 --- a/src/include/csr/csr-content-screening.h +++ b/src/include/csr/csr-content-screening.h @@ -83,15 +83,15 @@ int csr_cs_context_destroy(csr_cs_context_h handle); /** * @brief Sets a popup option for malware detected. * - * @details If #CSR_CS_ASK_USER is set, a popup will be prompted to a user when a malware - * is detected. If #CSR_CS_NOT_ASK_USER is set which is default value, no popup + * @details If #CSR_CS_ASK_USER_YES is set, a popup will be prompted to a user when a malware + * is detected. If #CSR_CS_ASK_USER_NO is set which is default value, no popup * will be prompted even if a malware is detected. User can allow, disallow and * remove detected malware by popup. Selection can be different between malware's * severity. * * @since_tizen 3.0 * - * @remarks This option is disabled(#CSR_CS_NOT_ASK_USER) as a default. + * @remarks This option is disabled(#CSR_CS_ASK_USER_NO) as a default. * * @param[in] handle CSR CS context handle returned by csr_cs_context_create(). * @param[in] ask_user Popup option to set or unset. @@ -140,7 +140,7 @@ int csr_cs_set_popup_message(csr_cs_context_h handle, const char *message); * * @since_tizen 3.0 * - * @remarks If a core usage is not set, #CSR_CS_USE_CORE_DEFAULT will be used. + * @remarks If a core usage is not set, #CSR_CS_CORE_USAGE_DEFAULT will be used. * * @param[in] handle CSR CS context handle returned by csr_cs_context_create(). * @param[in] usage A maximum core usage during scanning. @@ -162,10 +162,12 @@ int csr_cs_set_core_usage(csr_cs_context_h handle, csr_cs_core_usage_e usage); * * @since_tizen 3.0 * + * @remarks Scan on cloud option is turned off as a default. * @remarks If an engine does not support "scanning on cloud", this option is silently * ignored. * - * @param[in] handle CSR CS context handle returned by csr_cs_context_create(). + * @param[in] handle CSR CS context handle returned by csr_cs_context_create(). + * @param[int] is_on_cloud Flag to turn on(#true) or off(#false) of scan on cloud option. * * @return #CSR_ERROR_NONE on success, otherwise a negative error value * @@ -176,7 +178,7 @@ int csr_cs_set_core_usage(csr_cs_context_h handle, csr_cs_core_usage_e usage); * @see csr_cs_context_create() * @see csr_cs_context_destroy() */ -int csr_cs_set_scan_on_cloud(csr_cs_context_h handle); +int csr_cs_set_scan_on_cloud(csr_cs_context_h handle, bool is_on_cloud); /** * @brief Scans a data buffer for malware. @@ -920,6 +922,9 @@ int csr_cs_get_ignored_malwares(csr_cs_context_h handle, const char *dir_paths[] * * @since_tizen 3.0 * + * @remarks The @a malware will be released when a context is released using + * csr_cs_context_destroy(). + * * @param[in] list A detected malware list handle returned by * csr_cs_get_detected_malwares() or * csr_cs_get_ignored_malwares(). diff --git a/src/include/csr/csr-web-protection-types.h b/src/include/csr/csr-web-protection-types.h index 76d3178..56af7f4 100644 --- a/src/include/csr/csr-web-protection-types.h +++ b/src/include/csr/csr-web-protection-types.h @@ -48,8 +48,8 @@ typedef struct __csr_wp_check_result_h *csr_wp_check_result_h; * @since_tizen 3.0 */ typedef enum { - CSR_WP_NOT_ASK_USER = 0x00, /**< Do not ask the user even if a URL turns out risky.*/ - CSR_WP_ASK_USER = 0x01 /**< Ask the user when a URL turns out risky */ + CSR_WP_ASK_USER_NO = 0x00, /**< Do not ask the user even if a URL turns out risky.*/ + CSR_WP_ASK_USER_YES = 0x01 /**< Ask the user when a URL turns out risky */ } csr_wp_ask_user_e; /** @@ -57,9 +57,9 @@ typedef enum { * @since_tizen 3.0 */ typedef enum { - CSR_WP_NO_ASK_USER = 0x00, /**< There was no popup for asking the user. */ - CSR_WP_PROCESSING_ALLOWED = 0x01, /**< A user allowed to process the url. */ - CSR_WP_PROCESSING_DISALLOWED = 0x02 /**< A user disallowed to process the url. */ + CSR_WP_USER_RESPONSE_USER_NOT_ASKED = 0x00, /**< There was no popup for asking the user. */ + CSR_WP_USER_RESPONSE_PROCESSING_ALLOWED = 0x01, /**< A user allowed to process the url. */ + CSR_WP_USER_RESPONSE_PROCESSING_DISALLOWED = 0x02 /**< A user disallowed to process the url. */ } csr_wp_user_response_e; /** diff --git a/src/include/csr/csr-web-protection.h b/src/include/csr/csr-web-protection.h index 2f8e58d..f565bb7 100644 --- a/src/include/csr/csr-web-protection.h +++ b/src/include/csr/csr-web-protection.h @@ -82,13 +82,13 @@ int csr_wp_context_destroy(csr_wp_context_h handle); /** * @brief Sets a popup option for risky URL checked. * - * @details If #CSR_WP_ASK_USER is set, a popup will be prompted to a user when a URL - * turns out risky. If #CSR_WP_NOT_ASK_USER is set, no popup will be prompted + * @details If #CSR_WP_ASK_USER_YES is set, a popup will be prompted to a user when a URL + * turns out risky. If #CSR_WP_ASK_USER_NO is set, no popup will be prompted * even when a URL turns out risky. * * @since_tizen 3.0 * - * @remarks This option is disabled(#CSR_WP_NOT_ASK_USER) as a default. + * @remarks This option is disabled(#CSR_WP_ASK_USER_NO) as a default. * * @param[in] handle CSR WP context handle returned by csr_wp_context_create(). * @param[in] ask_user A popup option in case for a risky URL. diff --git a/test/internals/test-cpucore.cpp b/test/internals/test-cpucore.cpp index 73a16b6..004c9df 100644 --- a/test/internals/test-cpucore.cpp +++ b/test/internals/test-cpucore.cpp @@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE(single) { EXCEPTION_GUARD_START - coreNumTest(CSR_CS_USE_CORE_SINGLE, Csr::CpuUsageManager::MinCoreNum); + coreNumTest(CSR_CS_CORE_USAGE_SINGLE, Csr::CpuUsageManager::MinCoreNum); EXCEPTION_GUARD_END } @@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(half) int total = ::getRunningCores(); - coreNumTest(CSR_CS_USE_CORE_HALF, total / 2); + coreNumTest(CSR_CS_CORE_USAGE_HALF, total / 2); EXCEPTION_GUARD_END } @@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE(default_) int total = ::getRunningCores(); - coreNumTest(CSR_CS_USE_CORE_DEFAULT, total); + coreNumTest(CSR_CS_CORE_USAGE_DEFAULT, total); EXCEPTION_GUARD_END } @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(all) int total = ::getRunningCores(); - coreNumTest(CSR_CS_USE_CORE_ALL, total); + coreNumTest(CSR_CS_CORE_USAGE_ALL, total); EXCEPTION_GUARD_END } diff --git a/test/popup/test-popup.cpp b/test/popup/test-popup.cpp index f643c5d..8883324 100644 --- a/test/popup/test-popup.cpp +++ b/test/popup/test-popup.cpp @@ -42,15 +42,15 @@ void printPressed(csr_cs_user_response_e response) bool isValid = true; switch (response) { - case CSR_CS_REMOVE: + case CSR_CS_USER_RESPONSE_REMOVE: std::cout << "############## REMOVE BUTTON PRESSED #############" << std::endl; break; - case CSR_CS_PROCESSING_ALLOWED: + case CSR_CS_USER_RESPONSE_PROCESSING_ALLOWED: std::cout << "############## ALLOW BUTTON PRESSED #############" << std::endl; break; - case CSR_CS_PROCESSING_DISALLOWED: + case CSR_CS_USER_RESPONSE_PROCESSING_DISALLOWED: std::cout << "############ DISALLOW BUTTON PRESSED ##############" << std::endl; break; @@ -76,11 +76,11 @@ void printPressed(csr_wp_user_response_e response) bool isValid = true; switch (response) { - case CSR_WP_PROCESSING_ALLOWED: + case CSR_WP_USER_RESPONSE_PROCESSING_ALLOWED: std::cout << "############## ALLOW BUTTON PRESSED #############" << std::endl; break; - case CSR_WP_PROCESSING_DISALLOWED: + case CSR_WP_USER_RESPONSE_PROCESSING_DISALLOWED: std::cout << "############ DENY/CONFIRM BUTTON PRESSED ##########" << std::endl; break; diff --git a/test/test-api-content-screening.cpp b/test/test-api-content-screening.cpp index 0209c8c..40b2fd1 100644 --- a/test/test-api-content-screening.cpp +++ b/test/test-api-content-screening.cpp @@ -53,17 +53,18 @@ BOOST_AUTO_TEST_CASE(set_values_to_context_positive) auto c = Test::Context(); auto context = c.get(); - ASSERT_SUCCESS(csr_cs_set_ask_user(context, CSR_CS_NOT_ASK_USER)); - ASSERT_SUCCESS(csr_cs_set_ask_user(context, CSR_CS_ASK_USER)); + ASSERT_SUCCESS(csr_cs_set_ask_user(context, CSR_CS_ASK_USER_NO)); + ASSERT_SUCCESS(csr_cs_set_ask_user(context, CSR_CS_ASK_USER_YES)); ASSERT_SUCCESS(csr_cs_set_popup_message(context, "Test popup message")); - ASSERT_SUCCESS(csr_cs_set_core_usage(context, CSR_CS_USE_CORE_DEFAULT)); - ASSERT_SUCCESS(csr_cs_set_core_usage(context, CSR_CS_USE_CORE_ALL)); - ASSERT_SUCCESS(csr_cs_set_core_usage(context, CSR_CS_USE_CORE_HALF)); - ASSERT_SUCCESS(csr_cs_set_core_usage(context, CSR_CS_USE_CORE_SINGLE)); + ASSERT_SUCCESS(csr_cs_set_core_usage(context, CSR_CS_CORE_USAGE_DEFAULT)); + ASSERT_SUCCESS(csr_cs_set_core_usage(context, CSR_CS_CORE_USAGE_ALL)); + ASSERT_SUCCESS(csr_cs_set_core_usage(context, CSR_CS_CORE_USAGE_HALF)); + ASSERT_SUCCESS(csr_cs_set_core_usage(context, CSR_CS_CORE_USAGE_SINGLE)); - ASSERT_SUCCESS(csr_cs_set_scan_on_cloud(context)); + ASSERT_SUCCESS(csr_cs_set_scan_on_cloud(context, true)); + ASSERT_SUCCESS(csr_cs_set_scan_on_cloud(context, false)); EXCEPTION_GUARD_END } diff --git a/test/test-api-web-protection.cpp b/test/test-api-web-protection.cpp index e154bb2..90ea021 100644 --- a/test/test-api-web-protection.cpp +++ b/test/test-api-web-protection.cpp @@ -65,8 +65,8 @@ BOOST_AUTO_TEST_CASE(set_ask_user) auto c = Test::Context(); auto context = c.get(); - ASSERT_SUCCESS(csr_wp_set_ask_user(context, CSR_WP_ASK_USER)); - ASSERT_SUCCESS(csr_wp_set_ask_user(context, CSR_WP_NOT_ASK_USER)); + ASSERT_SUCCESS(csr_wp_set_ask_user(context, CSR_WP_ASK_USER_YES)); + ASSERT_SUCCESS(csr_wp_set_ask_user(context, CSR_WP_ASK_USER_NO)); EXCEPTION_GUARD_END } @@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(set_ask_user_invalid_param) auto c = Test::Context(); auto context = c.get(); - ASSERT_IF(csr_wp_set_ask_user(nullptr, CSR_WP_ASK_USER), CSR_ERROR_INVALID_HANDLE); + ASSERT_IF(csr_wp_set_ask_user(nullptr, CSR_WP_ASK_USER_YES), CSR_ERROR_INVALID_HANDLE); ASSERT_IF(csr_wp_set_ask_user(context, static_cast(-1)), CSR_ERROR_INVALID_PARAMETER); @@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(check_url_high) CHECK_IS_NOT_NULL(result); - ASSERT_RESULT(result, RISK_HIGH_RISK, RISK_HIGH_DETAILED_URL, CSR_WP_NO_ASK_USER); + ASSERT_RESULT(result, RISK_HIGH_RISK, RISK_HIGH_DETAILED_URL, CSR_WP_USER_RESPONSE_USER_NOT_ASKED); EXCEPTION_GUARD_END } @@ -142,7 +142,7 @@ BOOST_AUTO_TEST_CASE(check_url_medium) CHECK_IS_NOT_NULL(result); - ASSERT_RESULT(result, RISK_MEDIUM_RISK, RISK_MEDIUM_DETAILED_URL, CSR_WP_NO_ASK_USER); + ASSERT_RESULT(result, RISK_MEDIUM_RISK, RISK_MEDIUM_DETAILED_URL, CSR_WP_USER_RESPONSE_USER_NOT_ASKED); EXCEPTION_GUARD_END } @@ -159,7 +159,7 @@ BOOST_AUTO_TEST_CASE(check_url_low) CHECK_IS_NOT_NULL(result); - ASSERT_RESULT(result, RISK_LOW_RISK, RISK_LOW_DETAILED_URL, CSR_WP_NO_ASK_USER); + ASSERT_RESULT(result, RISK_LOW_RISK, RISK_LOW_DETAILED_URL, CSR_WP_USER_RESPONSE_USER_NOT_ASKED); EXCEPTION_GUARD_END } @@ -177,7 +177,7 @@ BOOST_AUTO_TEST_CASE(check_url_unverified) CHECK_IS_NOT_NULL(result); ASSERT_RESULT(result, RISK_UNVERIFIED_RISK, RISK_UNVERIFIED_DETAILED_URL, - CSR_WP_NO_ASK_USER); + CSR_WP_USER_RESPONSE_USER_NOT_ASKED); EXCEPTION_GUARD_END } -- 2.7.4