• 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 "watchdog.h"
20 
21 using namespace testing::ext;
22 
23 namespace OHOS {
24 namespace WorkScheduler {
25 
26 class WatchdogTest : 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<Watchdog> watchdog_;
33 };
34 
35 std::shared_ptr<Watchdog> WatchdogTest::watchdog_ = nullptr;
36 
SetUpTestCase()37 void WatchdogTest::SetUpTestCase()
38 {
39     std::shared_ptr<WorkPolicyManager> service;
40     std::shared_ptr<AppExecFwk::EventRunner> runner;
41     watchdog_ = std::make_shared<Watchdog>(service, runner);
42 }
43 
44 /**
45  * @tc.name: watchdog_001
46  * @tc.desc: Test Watchdog AddWatchdog.
47  * @tc.type: FUNC
48  * @tc.require: I8JBRY
49  */
50 HWTEST_F(WatchdogTest, watchdog_001, TestSize.Level1)
51 {
52     bool result = watchdog_->AddWatchdog(1, 1);
53     EXPECT_EQ(result, false);
54 }
55 
56 }
57 }