• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <functional>
17 #include <gtest/gtest.h>
18 
19 #include "scheduler_bg_task_subscriber.h"
20 
21 using namespace testing::ext;
22 
23 namespace OHOS {
24 namespace WorkScheduler {
25 
26 class SchedulerBgTaskSubscriberTest : public testing::Test {
27 public:
28     static void SetUpTestCase();
TearDownTestCase()29     static void TearDownTestCase() {}
SetUp()30     void SetUp() {}
TearDown()31     void TearDown() {}
32     static std::shared_ptr<SchedulerBgTaskSubscriber> schedulerBgTaskSubscriber_;
33 };
34 
35 std::shared_ptr<SchedulerBgTaskSubscriber> SchedulerBgTaskSubscriberTest::schedulerBgTaskSubscriber_ = nullptr;
36 
SetUpTestCase()37 void SchedulerBgTaskSubscriberTest::SetUpTestCase()
38 {
39     schedulerBgTaskSubscriber_ = std::make_shared<SchedulerBgTaskSubscriber>();
40 }
41 
42 /**
43  * @tc.name: OnRemoteDied_001
44  * @tc.desc: Test SchedulerBgTaskSubscriber OnRemoteDied.
45  * @tc.type: FUNC
46  * @tc.require: I8JBRY
47  */
48 HWTEST_F(SchedulerBgTaskSubscriberTest, OnRemoteDied_001, TestSize.Level3)
49 {
50     schedulerBgTaskSubscriber_->OnRemoteDied(nullptr);
51     EXPECT_TRUE(schedulerBgTaskSubscriber_ != nullptr);
52 }
53 }
54 }