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 #include "child_process.h" 19 #include "hilog_wrapper.h" 20 #include "runtime.h" 21 22 using namespace testing; 23 using namespace testing::ext; 24 25 namespace OHOS { 26 namespace AbilityRuntime { 27 class ChildProcessTest : public testing::Test { 28 public: 29 static void SetUpTestCase(); 30 static void TearDownTestCase(); 31 void SetUp() override; 32 void TearDown() override; 33 }; 34 SetUpTestCase()35void ChildProcessTest::SetUpTestCase() 36 {} 37 TearDownTestCase()38void ChildProcessTest::TearDownTestCase() 39 {} 40 SetUp()41void ChildProcessTest::SetUp() 42 {} 43 TearDown()44void ChildProcessTest::TearDown() 45 {} 46 47 /** 48 * @tc.number: ChildProcessCreate_0100 49 * @tc.desc: Test ChildProcess Create works 50 * @tc.type: FUNC 51 */ 52 HWTEST_F(ChildProcessTest, ChildProcessCreate_0100, TestSize.Level0) 53 { 54 HILOG_DEBUG("ChildProcessCreate_0100 called."); 55 std::unique_ptr<Runtime> runtime; 56 auto process = ChildProcess::Create(runtime); 57 EXPECT_TRUE(process != nullptr); 58 } 59 60 /** 61 * @tc.number: ChildProcessInit_0100 62 * @tc.desc: Test ChildProcess Init works 63 * @tc.type: FUNC 64 */ 65 HWTEST_F(ChildProcessTest, ChildProcessInit_0100, TestSize.Level0) 66 { 67 HILOG_DEBUG("ChildProcessInit_0100 called."); 68 std::unique_ptr<Runtime> runtime; 69 auto process = ChildProcess::Create(runtime); 70 EXPECT_TRUE(process != nullptr); 71 72 std::shared_ptr<ChildProcessStartInfo> info = std::make_shared<ChildProcessStartInfo>(); 73 auto ret = process->Init(info); 74 EXPECT_TRUE(ret); 75 } 76 } // namespace AbilityRuntime 77 } // namespace OHOS