1 /* 2 * Copyright (c) 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 16 #include <gtest/gtest.h> 17 18 #define private public 19 #include "app_scheduler_proxy.h" 20 #include "fault_data.h" 21 #undef private 22 23 using namespace testing; 24 using namespace testing::ext; 25 26 namespace OHOS { 27 namespace AppExecFwk { 28 class AppSchedulerProxyTest : public testing::Test { 29 public: 30 static void SetUpTestCase(); 31 static void TearDownTestCase(); 32 void SetUp() override; 33 void TearDown() override; 34 }; 35 SetUpTestCase(void)36void AppSchedulerProxyTest::SetUpTestCase(void) 37 {} 38 TearDownTestCase(void)39void AppSchedulerProxyTest::TearDownTestCase(void) 40 {} 41 SetUp()42void AppSchedulerProxyTest::SetUp() 43 {} 44 TearDown()45void AppSchedulerProxyTest::TearDown() 46 {} 47 48 /** 49 * @tc.name: ScheduleNotifyAppFault_001 50 * @tc.desc: Verify that the ScheduleNotifyAppFault interface calls normally 51 * @tc.type: FUNC 52 */ 53 HWTEST_F(AppSchedulerProxyTest, ScheduleNotifyAppFault_001, TestSize.Level1) 54 { 55 sptr<IRemoteObject> impl; 56 sptr<AppSchedulerProxy> appSchedulerProxy = new (std::nothrow) AppSchedulerProxy(impl); 57 FaultData faultData; 58 faultData.faultType = FaultDataType::APP_FREEZE; 59 faultData.errorObject.message = "msgContent"; 60 faultData.errorObject.stack = "stack"; 61 faultData.errorObject.name = "eventType"; 62 int32_t result = appSchedulerProxy->ScheduleNotifyAppFault(faultData); 63 EXPECT_EQ(result, ERR_NULL_OBJECT); 64 } 65 } // namespace AppExecFwk 66 } // namespace OHOS 67