1 /* 2 * Copyright (c) 2022 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 <iservice_registry.h> 20 #include <system_ability_definition.h> 21 22 #include "background_task_mgr_service.h" 23 24 using namespace testing::ext; 25 26 namespace OHOS { 27 namespace BackgroundTaskMgr { 28 class BackgroundTaskMgrServiceTest : public testing::Test { 29 public: SetUpTestCase()30 static void SetUpTestCase() {} TearDownTestCase()31 static void TearDownTestCase() {} SetUp()32 void SetUp() {} TearDown()33 void TearDown() {} 34 }; 35 36 /** 37 * @tc.name: BackgroundTaskMgrServiceTest_001 38 * @tc.desc: Test BackgroundTaskMgrService service ready. 39 * @tc.type: FUNC 40 * @tc.require: SR000GGTET SR000GMUG8 AR000GH86O AR000GH86Q AR000GMUIA AR000GMUHN 41 */ 42 HWTEST_F(BackgroundTaskMgrServiceTest, BackgroundTaskMgrServiceTest_001, TestSize.Level1) 43 { 44 sptr<ISystemAbilityManager> sm = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 45 EXPECT_TRUE(sm != nullptr) << "BackgroundTaskMgrServiceTest fail to get GetSystemAbilityManager"; 46 sptr<IRemoteObject> remoteObject = sm->CheckSystemAbility(BACKGROUND_TASK_MANAGER_SERVICE_ID); 47 EXPECT_TRUE(remoteObject != nullptr) << "GetSystemAbility failed"; 48 } 49 } // namespace BackgroundTaskMgr 50 } // namespace OHOS 51