• 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 // head file
22 namespace {
23 using namespace testing::ext;
24 using namespace OHOS::MMI;
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 HWTEST_F(InjectionEventDispatchTest, Test_Init, TestSize.Level1)
33 {
34     InjectionEventDispatch injectionEventDispatch;
35     injectionEventDispatch.Init();
36 }
37 
38 HWTEST_F(InjectionEventDispatchTest, Test_OnJson, TestSize.Level1)
39 {
40     const std::string path = "/data/json/Test_InjectionEventDispatchTestOnJson.json";
41     InjectionEventDispatch injectionEventDispatch;
42     injectionEventDispatch.injectArgvs_.push_back("json");
43     injectionEventDispatch.injectArgvs_.push_back(path);
44     int32_t ret = injectionEventDispatch.OnJson();
45     EXPECT_EQ(ret, RET_ERR);
46 }
47 } // namespace
48