1 /*
2 * Copyright (c) 2021-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 #include <gtest/gtest.h>
17
18 #include "injection_event_dispatch.h"
19
20 namespace OHOS {
21 namespace MMI {
22 namespace {
23 using namespace testing::ext;
24 } // namespace
25
26 class InjectionEventDispatchTest : public testing::Test {
27 public:
SetUpTestCase(void)28 static void SetUpTestCase(void) {}
TearDownTestCase(void)29 static void TearDownTestCase(void) {}
30 };
31
32 /**
33 * @tc.name:Test_Init
34 * @tc.desc:Verify InjectionEventDispatch Init
35 * @tc.type: FUNC
36 * @tc.require:
37 */
HWTEST_F(InjectionEventDispatchTest, Test_Init, TestSize.Level1)38 HWTEST_F(InjectionEventDispatchTest, Test_Init, TestSize.Level1)
39 {
40 InjectionEventDispatch injectionEventDispatch;
41 injectionEventDispatch.Init();
42 }
43
44 /**
45 * @tc.name:Test_OnJson
46 * @tc.desc:Verify InjectionEventDispatch OnJson
47 * @tc.type: FUNC
48 * @tc.require:
49 */
HWTEST_F(InjectionEventDispatchTest, Test_OnJson, TestSize.Level1)50 HWTEST_F(InjectionEventDispatchTest, Test_OnJson, TestSize.Level1)
51 {
52 const std::string path = "/data/json/Test_InjectionEventDispatchTestOnJson.json";
53 InjectionEventDispatch injectionEventDispatch;
54 injectionEventDispatch.injectArgvs_.push_back("json");
55 injectionEventDispatch.injectArgvs_.push_back(path);
56 int32_t ret = injectionEventDispatch.OnJson();
57 EXPECT_EQ(ret, RET_ERR);
58 }
59 } // namespace MMI
60 } // namespace OHOS
61