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