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