• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 #ifndef WALLPAPER_MGR_CJSON_MOCK_H
16 #define WALLPAPER_MGR_CJSON_MOCK_H
17 
18 #include <gmock/gmock.h>
19 
20 #include "cJSON.h"
21 
22 namespace OHOS {
23 class WallpaperMgrCjson {
24 public:
WallpaperMgrCjson()25     WallpaperMgrCjson(){};
~WallpaperMgrCjson()26     virtual ~WallpaperMgrCjson(){};
27     virtual cJSON *cJSON_AddNumberToObject(cJSON *const object, const char *const name, const double number) = 0;
28     virtual char *cJSON_Print(const cJSON *item) = 0;
29     virtual cJSON *cJSON_Parse(const char *item) = 0;
30     virtual cJSON *cJSON_GetObjectItemCaseSensitive(const cJSON *const object, const char *const string) = 0;
31     static inline std::shared_ptr<WallpaperMgrCjson> wallpaperMgrCjson = nullptr;
32 };
33 
34 class WallpaperMgrCjsonMock : public WallpaperMgrCjson {
35 public:
36     WallpaperMgrCjsonMock();
37     ~WallpaperMgrCjsonMock() override;
38 
39     MOCK_METHOD(cJSON *, cJSON_AddNumberToObject, (cJSON *, const char *, const double), (override));
40     MOCK_METHOD(char *, cJSON_Print, (const cJSON *), (override));
41     MOCK_METHOD(cJSON *, cJSON_Parse, (const char *), (override));
42     MOCK_METHOD(cJSON *, cJSON_GetObjectItemCaseSensitive, (const cJSON *, const char *), (override));
43 };
44 } // namespace OHOS
45 
46 #endif // WALLPAPER_MGR_CJSON_MOCK_H
47