diff options
author | AKalinich-Luxoft <AKalinich@luxoft.com> | 2017-06-13 16:12:01 +0300 |
---|---|---|
committer | AKalinich-Luxoft <AKalinich@luxoft.com> | 2017-06-14 13:56:43 +0300 |
commit | 638d17aa4821c5d1eb4b4e9009c027086d26d88a (patch) | |
tree | af536a7c2d089f297f8aa9496825cb4a69920468 | |
parent | d4d66bafe7c9bc6982140ee662de0c263e45f154 (diff) | |
download | sdl_core-638d17aa4821c5d1eb4b4e9009c027086d26d88a.tar.gz |
Fixed sending timeout param via OnSystemRequest
Also added const for methods TimeoutExchangeSec/TimeoutExchangeMSec
Changes from PR #1496
5 files changed, 12 insertions, 8 deletions
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h index 3d6a125251..0b808b13f5 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_handler.h +++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h @@ -123,8 +123,8 @@ class PolicyHandler : public PolicyHandlerInterface, EndpointUrls& out_end_points) OVERRIDE; virtual std::string GetLockScreenIconUrl() const OVERRIDE; uint32_t NextRetryTimeout() OVERRIDE; - uint32_t TimeoutExchangeSec() OVERRIDE; - uint32_t TimeoutExchangeMSec() OVERRIDE; + uint32_t TimeoutExchangeSec() const OVERRIDE; + uint32_t TimeoutExchangeMSec() const OVERRIDE; void OnExceededTimeout() OVERRIDE; void OnSystemReady() OVERRIDE; void PTUpdatedAt(Counters counter, int value) OVERRIDE; diff --git a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc index a17c76d9c1..c29ff3e2d3 100644 --- a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc @@ -99,6 +99,10 @@ void OnSystemRequestNotification::Run() { (*message_)[strings::msg_params][strings::file_type] = FileType::JSON; } else if (RequestType::HTTP == request_type) { (*message_)[strings::msg_params][strings::file_type] = FileType::BINARY; + if ((*message_)[strings::msg_params].keyExists(strings::url)) { + (*message_)[strings::msg_params][strings::timeout] = + policy_handler.TimeoutExchangeSec(); + } } SendNotification(); diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index f3ab96a0fe..89ae6c2c4b 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -1565,11 +1565,11 @@ uint32_t PolicyHandler::NextRetryTimeout() { return policy_manager_->NextRetryTimeout(); } -uint32_t PolicyHandler::TimeoutExchangeSec() { +uint32_t PolicyHandler::TimeoutExchangeSec() const { return TimeoutExchangeMSec() / date_time::DateTime::MILLISECONDS_IN_SECOND; } -uint32_t PolicyHandler::TimeoutExchangeMSec() { +uint32_t PolicyHandler::TimeoutExchangeMSec() const { POLICY_LIB_CHECK(0); return policy_manager_->TimeoutExchangeMSec(); } diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h index c5af16863a..a1c45c0bd6 100644 --- a/src/components/include/application_manager/policies/policy_handler_interface.h +++ b/src/components/include/application_manager/policies/policy_handler_interface.h @@ -105,8 +105,8 @@ class PolicyHandlerInterface { EndpointUrls& out_end_points) = 0; virtual std::string GetLockScreenIconUrl() const = 0; virtual uint32_t NextRetryTimeout() = 0; - virtual uint32_t TimeoutExchangeSec() = 0; - virtual uint32_t TimeoutExchangeMSec() = 0; + virtual uint32_t TimeoutExchangeSec() const = 0; + virtual uint32_t TimeoutExchangeMSec() const = 0; virtual void OnExceededTimeout() = 0; virtual void OnSystemReady() = 0; virtual void PTUpdatedAt(Counters counter, int value) = 0; diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h index 8f6972fd52..2fad7b757e 100644 --- a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h +++ b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h @@ -104,8 +104,8 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface { MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string()); MOCK_METHOD0(ResetRetrySequence, void()); MOCK_METHOD0(NextRetryTimeout, uint32_t()); - MOCK_METHOD0(TimeoutExchangeSec, uint32_t()); - MOCK_METHOD0(TimeoutExchangeMSec, uint32_t()); + MOCK_CONST_METHOD0(TimeoutExchangeSec, uint32_t()); + MOCK_CONST_METHOD0(TimeoutExchangeMSec, uint32_t()); MOCK_METHOD0(OnExceededTimeout, void()); MOCK_METHOD0(OnSystemReady, void()); MOCK_METHOD2(PTUpdatedAt, void(policy::Counters counter, int value)); |