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 #include <cJSON.h>
16 #include <gtest/gtest.h>
17 #include "power_mgr_service.h"
18 #include "power_mode_policy.h"
19 #include "power_log.h"
20 #include "setting_helper.h"
21 #include "shutdown_dialog.h"
22 #include "vibrator_source_parser.h"
23 #include "wakeup_controller.h"
24 #include "wakeup_source_parser.h"
25
26 using namespace testing;
27 using namespace testing::ext;
28 using namespace OHOS::PowerMgr;
29 using namespace OHOS;
30 using namespace std;
31
32 class PowerConfigParseTestTwo : public Test {
33 public:
SetUp()34 void SetUp() override
35 {
36 }
37
TearDown()38 void TearDown() override
39 {
40 }
41 };
42
cJSON_Parse(const char * value)43 CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value)
44 {
45 return nullptr;
46 }
47
48 namespace {
49 HWTEST_F(PowerConfigParseTestTwo, PowerConfigParseTestTwo001, TestSize.Level0)
50 {
51 POWER_HILOGI(LABEL_TEST, "PowerConfigParseTestTwo001 function start!");
52 const std::string json = R"("this is a string")";
53 VibratorSourceParser vibratorSourceParser;
54 auto parseSources = vibratorSourceParser.ParseSources(json);
55 EXPECT_EQ(parseSources.size(), 0);
56 POWER_HILOGI(LABEL_TEST, "PowerConfigParseTestTwo001 function end!");
57 }
58 } // namespace
59