1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef MULTIMODAL_INPUT_PREFERENCES_MANAGER_H
17 #define MULTIMODAL_INPUT_PREFERENCES_MANAGER_H
18 
19 #include <gmock/gmock.h>
20 #include "nocopyable.h"
21 
22 #include "i_preference_manager.h"
23 
24 namespace OHOS {
25 namespace MMI {
26 class PreferencesManagerMock final : public IPreferenceManager {
27 public:
28     PreferencesManagerMock() = default;
29     ~PreferencesManagerMock() = default;
30     DISALLOW_COPY_AND_MOVE(PreferencesManagerMock);
31 
32     MOCK_METHOD(int32_t, InitPreferences, ());
33     MOCK_METHOD(bool, GetBoolValue, (const std::string&, bool));
34     MOCK_METHOD(int32_t, GetIntValue, (const std::string&, int32_t));
35     MOCK_METHOD(int32_t, SetIntValue, (const std::string&, const std::string&, int32_t));
36     MOCK_METHOD(int32_t, SetBoolValue, (const std::string&, const std::string&, bool));
37     MOCK_METHOD(int32_t, GetShortKeyDuration, (const std::string&));
38     MOCK_METHOD(int32_t, SetShortKeyDuration, (const std::string&, int32_t));
39 
40     static std::shared_ptr<PreferencesManagerMock> GetInstance();
41 
42 private:
43     static std::mutex mutex_;
44     static std::shared_ptr<PreferencesManagerMock> instance_;
45 };
46 
47 #define PREFERENCES_MGR_MOCK ::OHOS::MMI::PreferencesManagerMock::GetInstance()
48 } // namespace MMI
49 } // namespace OHOS
50 #endif // MULTIMODAL_INPUT_PREFERENCES_MANAGER_H
51