• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 "define_multimodal.h"
19 #include "dfx_hisysevent_device.h"
20 #include "mmi_log.h"
21 
22 #undef MMI_LOG_TAG
23 #define MMI_LOG_TAG "DfxHisysEventTest"
24 
25 namespace OHOS {
26 namespace MMI {
27 namespace {
28 using namespace testing::ext;
29 } // namespace
30 
31 class DfxHisysEventDeviceTest : public testing::Test {
32 public:
SetUpTestCase(void)33     static void SetUpTestCase(void) {}
TearDownTestCase(void)34     static void TearDownTestCase(void) {}
SetUp()35     void SetUp() {}
TearDown()36     void TearDown() {}
37 };
38 
39 HWTEST_F(DfxHisysEventDeviceTest, ReportDeviceFault_001, TestSize.Level1)
40 {
41     CALL_TEST_DEBUG;
42     int32_t id = 1;
43     auto type = DfxHisyseventDeivce::DeviceFaultType::DEVICE_FAULT_TYPE_SYS;
44     ASSERT_NO_FATAL_FAILURE(DfxHisyseventDeivce::ReportDeviceFault(type, "test fault 1"));
45     type = DfxHisyseventDeivce::DeviceFaultType::DEVICE_FAULT_TYPE_INNER;
46     ASSERT_NO_FATAL_FAILURE(DfxHisyseventDeivce::ReportDeviceFault(id, type, "test fault 2"));
47 }
48 
49 HWTEST_F(DfxHisysEventDeviceTest, ReportDeviceBehavior_001, TestSize.Level1)
50 {
51     CALL_TEST_DEBUG;
52     int32_t id = -1;
53     ASSERT_NO_FATAL_FAILURE(DfxHisyseventDeivce::ReportDeviceBehavior(id, "test behavior"));
54     id = 1;
55     ASSERT_NO_FATAL_FAILURE(DfxHisyseventDeivce::ReportDeviceBehavior(id, "test behavior"));
56 }
57 
58 } // namespace MMI
59 } // namespace OHOS