diff options
author | Veronica Veremjova <vveremjova@luxoft.com> | 2016-05-13 15:49:50 +0300 |
---|---|---|
committer | Veronica Veremjova <vveremjova@luxoft.com> | 2016-05-16 10:23:40 +0300 |
commit | 03031022dbde0e3aa6af85a31acc20ecf81b19c0 (patch) | |
tree | 78fa8fa4254f640696faac919aee1ea737bd7a7f /src/components | |
parent | 225fcbd84b85d2bb8c75b4c29ba8c9bf994b0517 (diff) | |
download | sdl_core-03031022dbde0e3aa6af85a31acc20ecf81b19c0.tar.gz |
Formatted code according google style
Diffstat (limited to 'src/components')
5 files changed, 190 insertions, 52 deletions
diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h index b1043d6b2a..75496b2761 100644 --- a/src/components/application_manager/include/application_manager/application_impl.h +++ b/src/components/application_manager/include/application_manager/application_impl.h @@ -423,7 +423,6 @@ bool ApplicationImpl::IsRegistered() const { return app_state_ == kRegistered; } - } // namespace application_manager #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_IMPL_H_ diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc index c0374ca8eb..f3cc9c6af1 100644 --- a/src/components/application_manager/test/policy_handler_test.cc +++ b/src/components/application_manager/test/policy_handler_test.cc @@ -324,7 +324,8 @@ TEST_F(PolicyHandlerTest, EXPECT_CALL(mock_state_controller, SetRegularState(_, new_hmi_level, true)); // Act Permissions perms; - policy_handler_.OnPermissionsUpdated(kPolicyAppId_, perms, new_kHmiLevel_string); + policy_handler_.OnPermissionsUpdated( + kPolicyAppId_, perms, new_kHmiLevel_string); } TEST_F(PolicyHandlerTest, @@ -352,7 +353,8 @@ TEST_F(PolicyHandlerTest, EXPECT_CALL(mock_state_controller, SetRegularState(_, new_hmi_level, false)); // Act Permissions perms; - policy_handler_.OnPermissionsUpdated(kPolicyAppId_, perms, new_kHmiLevel_string); + policy_handler_.OnPermissionsUpdated( + kPolicyAppId_, perms, new_kHmiLevel_string); } TEST_F(PolicyHandlerTest, @@ -377,7 +379,8 @@ TEST_F(PolicyHandlerTest, EXPECT_CALL(app_manager_, state_controller()).Times(0); // Act Permissions perms; - policy_handler_.OnPermissionsUpdated(kPolicyAppId_, perms, new_kHmiLevel_string); + policy_handler_.OnPermissionsUpdated( + kPolicyAppId_, perms, new_kHmiLevel_string); } TEST_F(PolicyHandlerTest, GetPriority) { @@ -395,8 +398,9 @@ TEST_F(PolicyHandlerTest, CheckPermissions) { CheckPermissionResult result; RPCParams kRpc_params; // Check expectations - EXPECT_CALL(*mock_policy_manager_, - CheckPermissions(kPolicyAppId_, kHmiLevel_, kRpc_, kRpc_params, _)); + EXPECT_CALL( + *mock_policy_manager_, + CheckPermissions(kPolicyAppId_, kHmiLevel_, kRpc_, kRpc_params, _)); // Act policy_handler_.CheckPermissions( kPolicyAppId_, kHmiLevel_, kRpc_, kRpc_params, result); @@ -425,7 +429,8 @@ TEST_F(PolicyHandlerTest, GetDefaultHmi) { // Arrange EnablePolicyAndPolicyManagerMock(); // Check expectations - EXPECT_CALL(*mock_policy_manager_, GetDefaultHmi(kPolicyAppId_, &default_hmi_)); + EXPECT_CALL(*mock_policy_manager_, + GetDefaultHmi(kPolicyAppId_, &default_hmi_)); // Act policy_handler_.GetDefaultHmi(kPolicyAppId_, &default_hmi_); } @@ -730,10 +735,10 @@ TEST_F(PolicyHandlerTest, EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_)) .WillOnce(Return(permissions)); - EXPECT_CALL( - *MockMessageHelper::message_helper_mock(), - GetOnAppInterfaceUnregisteredNotificationToMobile( - kAppId_, mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED)) + EXPECT_CALL(*MockMessageHelper::message_helper_mock(), + GetOnAppInterfaceUnregisteredNotificationToMobile( + kAppId_, + mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED)) .WillOnce(Return(message)); EXPECT_CALL(app_manager_, ManageMobileCommand(_, commands::Command::ORIGIN_SDL)); @@ -763,10 +768,10 @@ TEST_F(PolicyHandlerTest, EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_)) .WillOnce(Return(permissions)); - EXPECT_CALL( - *MockMessageHelper::message_helper_mock(), - GetOnAppInterfaceUnregisteredNotificationToMobile( - kAppId_, mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED)) + EXPECT_CALL(*MockMessageHelper::message_helper_mock(), + GetOnAppInterfaceUnregisteredNotificationToMobile( + kAppId_, + mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED)) .WillOnce(Return(message)); EXPECT_CALL(app_manager_, ManageMobileCommand(_, commands::Command::ORIGIN_SDL)); @@ -1216,8 +1221,9 @@ TEST_F(PolicyHandlerTest, OnSnapshotCreated_UrlAdded) { .WillRepeatedly(Return(mock_app_)); EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_)); - EXPECT_CALL(*MockMessageHelper::message_helper_mock(), - SendPolicySnapshotNotification(kAppId_, msg, data.url.front(), _)); + EXPECT_CALL( + *MockMessageHelper::message_helper_mock(), + SendPolicySnapshotNotification(kAppId_, msg, data.url.front(), _)); policy_handler_.OnSnapshotCreated(msg); } @@ -1240,7 +1246,8 @@ TEST_F(PolicyHandlerTest, EXPECT_CALL(conn_handler, GetDeviceID(kPolicyAppId_, _)) .WillRepeatedly(Return(true)); - policy_handler_.OnAllowSDLFunctionalityNotification(is_allowed, kPolicyAppId_); + policy_handler_.OnAllowSDLFunctionalityNotification(is_allowed, + kPolicyAppId_); } TEST_F(PolicyHandlerTest, diff --git a/src/components/include/test/policy/mock_policy_manager.h b/src/components/include/test/policy/mock_policy_manager.h index d5c370ca99..a6169cdebc 100644 --- a/src/components/include/test/policy/mock_policy_manager.h +++ b/src/components/include/test/policy/mock_policy_manager.h @@ -54,8 +54,9 @@ namespace policy_manager_test { class MockPolicyManager : public PolicyManager { public: MOCK_METHOD1(set_listener, void(PolicyListener* listener)); - MOCK_METHOD2(InitPT, bool(const std::string& file_name, - const PolicySettings* settings)); + MOCK_METHOD2(InitPT, + bool(const std::string& file_name, + const PolicySettings* settings)); MOCK_METHOD2(LoadPT, bool(const std::string& file, const BinaryMessage& pt_content)); MOCK_METHOD1(ResetPT, bool(const std::string& file_name)); @@ -63,8 +64,10 @@ class MockPolicyManager : public PolicyManager { MOCK_METHOD2(GetUpdateUrls, void(int service_type, EndpointUrls& end_points)); MOCK_METHOD0(RequestPTUpdate, bool()); MOCK_METHOD5(CheckPermissions, - void(const PTString& app_id, const PTString& hmi_level, - const PTString& rpc, const RPCParams& rpc_params, + void(const PTString& app_id, + const PTString& hmi_level, + const PTString& rpc, + const RPCParams& rpc_params, CheckPermissionResult& result)); MOCK_METHOD0(ResetUserConsent, bool()); MOCK_CONST_METHOD0(GetPolicyTableStatus, std::string()); @@ -78,11 +81,12 @@ class MockPolicyManager : public PolicyManager { MOCK_METHOD0(OnExceededTimeout, void()); MOCK_METHOD0(OnUpdateStarted, void()); MOCK_CONST_METHOD1(GetUserConsentForDevice, - DeviceConsent(const std::string& device_id)); - MOCK_METHOD3(GetUserConsentForApp, - void(const std::string& device_id, - const std::string& policy_app_id, - std::vector<policy::FunctionalGroupPermission>& permissions)); + DeviceConsent(const std::string& device_id)); + MOCK_METHOD3( + GetUserConsentForApp, + void(const std::string& device_id, + const std::string& policy_app_id, + std::vector<policy::FunctionalGroupPermission>& permissions)); MOCK_METHOD2(SetUserConsentForDevice, void(const std::string& device_id, const bool is_allowed)); MOCK_METHOD2(ReactOnUserDevConsentForApp, @@ -94,34 +98,40 @@ class MockPolicyManager : public PolicyManager { policy::StringArray*, policy::StringArray*)); - MOCK_METHOD2(AddDevice, void(const std::string& device_id, - const std::string& connection_type)); - MOCK_METHOD2(SetDeviceInfo, void(const std::string& device_id, - const policy::DeviceInfo& device_info)); + MOCK_METHOD2(AddDevice, + void(const std::string& device_id, + const std::string& connection_type)); + MOCK_METHOD2(SetDeviceInfo, + void(const std::string& device_id, + const policy::DeviceInfo& device_info)); MOCK_METHOD1(SetUserConsentForApp, void(const policy::PermissionConsent& permissions)); - MOCK_CONST_METHOD2(GetDefaultHmi, bool(const std::string& policy_app_id, - std::string* default_hmi)); + MOCK_CONST_METHOD2(GetDefaultHmi, + bool(const std::string& policy_app_id, + std::string* default_hmi)); MOCK_CONST_METHOD2(GetPriority, - bool(const std::string& policy_app_id, std::string* priority)); + bool(const std::string& policy_app_id, + std::string* priority)); MOCK_METHOD2(GetUserFriendlyMessages, std::vector<policy::UserFriendlyMessage>( const std::vector<std::string>& message_code, const std::string& language)); MOCK_CONST_METHOD1(IsApplicationRevoked, bool(const std::string& app_id)); - MOCK_METHOD3(GetPermissionsForApp, + MOCK_METHOD3( + GetPermissionsForApp, void(const std::string& device_id, - const std::string& policy_app_id, - std::vector<policy::FunctionalGroupPermission>& permissions)); + const std::string& policy_app_id, + std::vector<policy::FunctionalGroupPermission>& permissions)); MOCK_METHOD1(GetAppPermissionsChanges, policy::AppPermissions(const std::string& policy_app_id)); MOCK_METHOD1(RemovePendingPermissionChanges, void(const std::string& app_id)); MOCK_CONST_METHOD1(GetCurrentDeviceId, - std::string&(const std::string& policy_app_id)); + std::string&(const std::string& policy_app_id)); MOCK_METHOD1(SetSystemLanguage, void(const std::string& language)); - MOCK_METHOD3(SetSystemInfo, void(const std::string& ccpu_version, - const std::string& wers_country_code, - const std::string& language)); + MOCK_METHOD3(SetSystemInfo, + void(const std::string& ccpu_version, + const std::string& wers_country_code, + const std::string& language)); MOCK_METHOD1(SendNotificationOnPermissionsUpdated, void(const std::string& application_id)); MOCK_METHOD1(MarkUnpairedDevice, void(const std::string& device_id)); @@ -130,7 +140,8 @@ class MockPolicyManager : public PolicyManager { MOCK_CONST_METHOD1(CanAppKeepContext, bool(const std::string& app_id)); MOCK_CONST_METHOD1(CanAppStealFocus, bool(const std::string& app_id)); MOCK_METHOD0(OnSystemReady, void()); - MOCK_CONST_METHOD1(GetNotificationsNumber, uint32_t(const std::string& priority)); + MOCK_CONST_METHOD1(GetNotificationsNumber, + uint32_t(const std::string& priority)); MOCK_METHOD1(SetVINValue, void(const std::string& value)); MOCK_METHOD1(IsPredataPolicy, bool(const std::string& policy_app_id)); MOCK_CONST_METHOD1(HeartBeatTimeout, uint32_t(const std::string& app_id)); @@ -139,8 +150,9 @@ class MockPolicyManager : public PolicyManager { MOCK_METHOD0(OnAppsSearchCompleted, void()); MOCK_METHOD1(OnAppRegisteredOnMobile, void(const std::string& application_id)); - MOCK_CONST_METHOD1(GetAppRequestTypes, const std::vector<std::string>( - const std::string policy_app_id)); + MOCK_CONST_METHOD1( + GetAppRequestTypes, + const std::vector<std::string>(const std::string policy_app_id)); MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo()); MOCK_CONST_METHOD0(GetMetaInfo, const policy::MetaInfo()); MOCK_CONST_METHOD0(RetrieveCertificate, std::string()); @@ -149,19 +161,22 @@ class MockPolicyManager : public PolicyManager { MOCK_METHOD0(ExceededDays, bool()); MOCK_METHOD0(StartPTExchange, void()); MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type)); - MOCK_METHOD2(Increment, void(const std::string& app_id, - usage_statistics::AppCounterId type)); + MOCK_METHOD2(Increment, + void(const std::string& app_id, + usage_statistics::AppCounterId type)); MOCK_METHOD3(Set, - void(const std::string& app_id, usage_statistics::AppInfoId type, + void(const std::string& app_id, + usage_statistics::AppInfoId type, const std::string& value)); - MOCK_METHOD3(Add, void(const std::string& app_id, - usage_statistics::AppStopwatchId type, - int32_t timespan_seconds)); + MOCK_METHOD3(Add, + void(const std::string& app_id, + usage_statistics::AppStopwatchId type, + int32_t timespan_seconds)); MOCK_CONST_METHOD0(get_settings, const PolicySettings&()); MOCK_METHOD1(set_settings, void(const PolicySettings* get_settings)); MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string()); - MOCK_METHOD2(GetServiceUrls, void(const std::string& service_type, - EndpointUrls& end_points)); + MOCK_METHOD2(GetServiceUrls, + void(const std::string& service_type, EndpointUrls& end_points)); }; } // namespace policy_manager_test } // namespace components diff --git a/src/components/include/test/policy/usage_statistics/mock_app_stopwatch.h b/src/components/include/test/policy/usage_statistics/mock_app_stopwatch.h new file mode 100644 index 0000000000..481d887cb2 --- /dev/null +++ b/src/components/include/test/policy/usage_statistics/mock_app_stopwatch.h @@ -0,0 +1,54 @@ +/* Copyright (c) 2016, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_USAGE_STATISTICS_MOCK_APP_STOPWATCH_H_ +#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_USAGE_STATISTICS_MOCK_APP_STOPWATCH_H_ + +#include "gmock/gmock.h" +#include "policy/usage_statistics/app_stopwatch.h" +#include "policy/usage_statistics/statistics_manager.h" + +namespace test { +namespace components { +namespace usage_statistics_test { + +class MockAppStopwatch : public usage_statistics::AppStopwatch { + public: + MOCK_METHOD1(Start, void(usage_statistics::AppStopwatchId stopwatch_type)); + MOCK_METHOD1(Switch, void(usage_statistics::AppStopwatchId stopwatch_type)); + MOCK_METHOD0(WriteTime, void()); +}; + +} // namespace usage_statistics_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_USAGE_STATISTICS_MOCK_APP_STOPWATCH_H_ diff --git a/src/components/include/test/policy/usage_statistics/mock_statistics_manager.h b/src/components/include/test/policy/usage_statistics/mock_statistics_manager.h new file mode 100644 index 0000000000..e58adea124 --- /dev/null +++ b/src/components/include/test/policy/usage_statistics/mock_statistics_manager.h @@ -0,0 +1,63 @@ +/* Copyright (c) 2016, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_USAGE_STATISTICS_MOCK_STATISTICS_MANAGER_H_ +#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_USAGE_STATISTICS_MOCK_STATISTICS_MANAGER_H_ + +#include <string> + +#include "gmock/gmock.h" +#include "policy/usage_statistics/statistics_manager.h" + +namespace test { +namespace components { +namespace usage_statistics_test { + +class MockStatisticsManager : public usage_statistics::StatisticsManager { + public: + MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type)); + MOCK_METHOD2(Increment, + void(const std::string& app_id, + usage_statistics::AppCounterId type)); + MOCK_METHOD3(Set, + void(const std::string& app_id, + usage_statistics::AppInfoId type, + const std::string& value)); + MOCK_METHOD3(Add, + void(const std::string& app_id, + usage_statistics::AppStopwatchId type, + int32_t timespan_seconds)); +}; + +} // namespace usage_statistics_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_USAGE_STATISTICS_MOCK_STATISTICS_MANAGER_H_ |