16ea96550Sopenharmony_ci/*
26ea96550Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
36ea96550Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
46ea96550Sopenharmony_ci * you may not use this file except in compliance with the License.
56ea96550Sopenharmony_ci * You may obtain a copy of the License at
66ea96550Sopenharmony_ci *
76ea96550Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
86ea96550Sopenharmony_ci *
96ea96550Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
106ea96550Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
116ea96550Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
126ea96550Sopenharmony_ci * See the License for the specific language governing permissions and
136ea96550Sopenharmony_ci * limitations under the License.
146ea96550Sopenharmony_ci */
156ea96550Sopenharmony_ci
166ea96550Sopenharmony_ci#ifndef SECURITY_GUARD_PREFERENCE_MOCK_H
176ea96550Sopenharmony_ci#define SECURITY_GUARD_PREFERENCE_MOCK_H
186ea96550Sopenharmony_ci
196ea96550Sopenharmony_ci#include <memory>
206ea96550Sopenharmony_ci#include <mutex>
216ea96550Sopenharmony_ci#include <string>
226ea96550Sopenharmony_ci
236ea96550Sopenharmony_ci#include "gmock/gmock.h"
246ea96550Sopenharmony_ci
256ea96550Sopenharmony_cinamespace OHOS::NativePreferences {
266ea96550Sopenharmony_ciconstexpr int E_ERROR = -1;
276ea96550Sopenharmony_ciconstexpr int E_OK = 0;
286ea96550Sopenharmony_ci
296ea96550Sopenharmony_ciclass PreferencesInterface {
306ea96550Sopenharmony_cipublic:
316ea96550Sopenharmony_ci    virtual ~PreferencesInterface() = default;
326ea96550Sopenharmony_ci    virtual int GetInt(const std::string &key, const int &defValue) = 0;
336ea96550Sopenharmony_ci    virtual int PutInt(const std::string &key, int value) = 0;
346ea96550Sopenharmony_ci    virtual void Flush() = 0;
356ea96550Sopenharmony_ci};
366ea96550Sopenharmony_ci
376ea96550Sopenharmony_ciclass Preferences : public PreferencesInterface {
386ea96550Sopenharmony_cipublic:
396ea96550Sopenharmony_ci    Preferences() = default;
406ea96550Sopenharmony_ci    ~Preferences() override = default;
416ea96550Sopenharmony_ci    MOCK_METHOD2(GetInt, int(const std::string &key, const int &defValue));
426ea96550Sopenharmony_ci    MOCK_METHOD2(PutInt, int(const std::string &key, int value));
436ea96550Sopenharmony_ci    MOCK_METHOD0(Flush, void());
446ea96550Sopenharmony_ci};
456ea96550Sopenharmony_ci} // OHOS::NativePreferences
466ea96550Sopenharmony_ci#endif // SECURITY_GUARD_PREFERENCE_MOCK_H