• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 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 "event_server_test.h"
16 
17 #include "event_server.h"
18 #include "file_util.h"
19 
20 using namespace testing::ext;
21 using namespace OHOS::HiviewDFX;
22 
23 namespace {
24 const std::string BBOX_PATH = "/dev/bbox";
25 }
26 
SetUp()27 void EventServerTest::SetUp()
28 {
29     printf("EventServerTest SetUp\n");
30 }
31 
TearDown()32 void EventServerTest::TearDown()
33 {
34     printf("EventServerTest TearDown\n");
35 }
36 
37 /**
38  * @tc.name: EventServerTest001
39  * @tc.desc: BBoxDevice test.
40  * @tc.type: FUNC
41  * @tc.require: issueI5NULM
42  */
43 HWTEST_F(EventServerTest, EventServerTest001, TestSize.Level3)
44 {
45     /**
46      * @tc.steps: step1. check whether the node file exists.
47      * @tc.steps: step2. check whether the node file is valid.
48      */
49     if (!FileUtil::FileExists("/dev/bbox")) {
50         printf("The device does not support bbox node\n");
51         return;
52     }
53     BBoxDevice bbox;
54     ASSERT_TRUE(bbox.GetEvents() > 0);
55     ASSERT_NE(bbox.GetName(), "");
56     int res = bbox.Open();
57     ASSERT_TRUE(res >= 0);
58     res = bbox.Close();
59     ASSERT_TRUE(res >= 0);
60 }
61