diff options
Diffstat (limited to 'src/components/policy/test/include/mock_cache_manager.h')
-rw-r--r-- | src/components/policy/test/include/mock_cache_manager.h | 183 |
1 files changed, 183 insertions, 0 deletions
diff --git a/src/components/policy/test/include/mock_cache_manager.h b/src/components/policy/test/include/mock_cache_manager.h new file mode 100644 index 0000000000..610a7a3fb0 --- /dev/null +++ b/src/components/policy/test/include/mock_cache_manager.h @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2014, 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_POLICY_TEST_POLICY_INCLUDE_MOCK_CACHE_MANAGER_H_ +#define SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_CACHE_MANAGER_H_ + + +#include <string> +#include <vector> + +#include "gmock/gmock.h" + +#include "policy/cache_manager_interface.h" + +namespace policy_table = rpc::policy_table_interface_base; + +namespace policy { + +class MockCacheManagerInterface : public CacheManagerInterface { + public: + MOCK_METHOD4(CheckPermissions, + void(const PTString& app_id, const PTString& hmi_level, const PTString& rpc, CheckPermissionResult& result)); + MOCK_METHOD0(IsPTPreloaded, + bool()); + MOCK_METHOD0(IgnitionCyclesBeforeExchange, + int()); + MOCK_METHOD1(KilometersBeforeExchange, + int(int current)); + MOCK_METHOD2(SetCountersPassedForSuccessfulUpdate, + bool(int kilometers, int days_after_epoch)); + MOCK_METHOD1(DaysBeforeExchange, + int(int current)); + MOCK_METHOD0(IncrementIgnitionCycles, + void()); + MOCK_METHOD0(ResetIgnitionCycles, + void()); + MOCK_METHOD0(TimeoutResponse, + int()); + MOCK_METHOD1(SecondsBetweenRetries, + bool(std::vector<int> &seconds)); + MOCK_METHOD0(GetVehicleData, + VehicleData()); + MOCK_METHOD1(SetVINValue, + bool(const std::string& value)); + MOCK_METHOD2(GetUserFriendlyMsg, + std::vector<UserFriendlyMessage>(const std::vector<std::string>& msg_codes, const std::string& language)); + MOCK_METHOD1(GetUpdateUrls, + EndpointUrls(int service_type)); + MOCK_METHOD1(GetNotificationsNumber, + int(const std::string& priority)); + MOCK_METHOD2(GetPriority, + bool(const std::string& policy_app_id, std::string& priority)); + MOCK_METHOD1(Init, + bool(const std::string& file_name)); + MOCK_METHOD0(GenerateSnapshot, + utils::SharedPtr<policy_table::Table>()); + MOCK_METHOD1(ApplyUpdate, + bool(const policy_table::Table& update_pt)); + MOCK_METHOD1(Save, + bool(const policy_table::Table& table)); + MOCK_CONST_METHOD0(UpdateRequired, + bool()); + MOCK_METHOD1(SaveUpdateRequired, + void(bool status)); + MOCK_METHOD3(GetInitialAppData, + bool(const std::string& app_id, StringArray& nicknames, StringArray& app_hmi_types)); + MOCK_METHOD1(IsApplicationRevoked, + bool(const std::string& app_id)); + MOCK_METHOD1(GetFunctionalGroupings, + bool(policy_table::FunctionalGroupings& groups)); + MOCK_CONST_METHOD1(IsApplicationRepresented, + bool(const std::string& app_id)); + MOCK_METHOD1(IsDefaultPolicy, + bool(const std::string& app_id)); + MOCK_METHOD2(SetIsDefault, + bool(const std::string& app_id, bool is_default)); + MOCK_METHOD1(IsPredataPolicy, + bool(const std::string& app_id)); + MOCK_METHOD1(SetDefaultPolicy, + bool(const std::string& app_id)); + MOCK_METHOD1(CanAppKeepContext, + bool(const std::string& app_id)); + MOCK_METHOD1(CanAppStealFocus, + bool(const std::string& app_id)); + MOCK_METHOD2(GetDefaultHMI, + bool(const std::string& app_id, std::string &default_hmi)); + MOCK_METHOD0(ResetUserConsent, + bool()); + MOCK_METHOD3(GetUserPermissionsForDevice, + bool(const std::string& device_id, StringArray &consented_groups, StringArray &disallowed_groups)); + MOCK_METHOD3(GetPermissionsForApp, + bool(const std::string& device_id, const std::string& app_id, FunctionalIdType &group_types)); + MOCK_METHOD2(GetDeviceGroupsFromPolicies, + bool(rpc::policy_table_interface_base::Strings &groups, rpc::policy_table_interface_base::Strings &preconsented_groups)); + MOCK_METHOD8(SetDeviceData, + bool(const std::string& device_id, const std::string& hardware, const std::string& firmware, const std::string& os, const std::string& os_version, const std::string& carrier, const uint32_t number_of_ports, const std::string& connection_type)); + MOCK_METHOD3(SetUserPermissionsForDevice, + bool(const std::string& device_id, const StringArray& consented_groups, const StringArray& disallowed_groups)); + MOCK_METHOD2(ReactOnUserDevConsentForApp, + bool(const std::string& app_id, bool is_device_allowed)); + MOCK_METHOD1(SetUserPermissionsForApp, + bool(const PermissionConsent& permissions)); + MOCK_METHOD3(SetMetaInfo, + bool(const std::string& ccpu_version, const std::string& wers_country_code, const std::string& language)); + MOCK_CONST_METHOD0(IsMetaInfoPresent, + bool()); + MOCK_METHOD1(SetSystemLanguage, + bool(const std::string& language)); + 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, int seconds)); + MOCK_METHOD3(CountUnconsentedGroups, + bool(const std::string& policy_app_id, const std::string& device_id, int& result)); + MOCK_METHOD1(GetFunctionalGroupNames, + bool(FunctionalGroupNames& names)); + MOCK_METHOD2(GetAllAppGroups, + void(const std::string& app_id, FunctionalGroupIDs& all_group_ids)); + MOCK_METHOD2(GetPreConsentedGroups, + void(const std::string &app_id, FunctionalGroupIDs& preconsented_groups)); + MOCK_METHOD4(GetConsentedGroups, + void(const std::string &device_id, const std::string &app_id, FunctionalGroupIDs& allowed_groups, FunctionalGroupIDs& disallowed_groups)); + MOCK_METHOD3(GetUnconsentedGroups, + void(const std::string& device_id, const std::string& policy_app_id, FunctionalGroupIDs& unconsented_groups)); + MOCK_METHOD2(RemoveAppConsentForGroup, + void(const std::string& app_id, const std::string& group_name)); + MOCK_METHOD1(SetPredataPolicy, + bool(const std::string& app_id)); + MOCK_METHOD2(SetIsPredata, + bool(const std::string& app_id, bool is_pre_data)); + MOCK_METHOD1(CleanupUnpairedDevices, + bool(const DeviceIds& device_ids)); + MOCK_METHOD1(SetUnpairedDevice, + bool(const std::string& device_id)); + MOCK_METHOD1(UnpairedDevicesList, + bool(DeviceIds& device_ids)); + MOCK_METHOD1(ResetPT, + bool(const std::string& file_name)); + MOCK_METHOD0(LoadFromBackup, + bool()); + MOCK_METHOD1(LoadFromFile, + bool(const std::string& file_name)); + MOCK_METHOD0(Backup, + void()); + MOCK_CONST_METHOD1(HeartBeatTimeout, + uint16_t(const std::string& app_id)); +}; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_CACHE_MANAGER_H_ |