1 /*
2 * Copyright (c) 2021-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 <gtest/gtest.h>
17
18 #define private public
19 #include "app_spawn_client.h"
20 #undef private
21
22 using namespace testing;
23 using namespace testing::ext;
24
25 namespace OHOS {
26 namespace AppExecFwk {
27 class AppSpawnClientTest : public testing::Test {
28 public:
29 static void SetUpTestCase();
30 static void TearDownTestCase();
31 void SetUp() override;
32 void TearDown() override;
33 };
34
SetUpTestCase(void)35 void AppSpawnClientTest::SetUpTestCase(void)
36 {}
37
TearDownTestCase(void)38 void AppSpawnClientTest::TearDownTestCase(void)
39 {}
40
SetUp()41 void AppSpawnClientTest::SetUp()
42 {}
43
TearDown()44 void AppSpawnClientTest::TearDown()
45 {}
46
47 /**
48 * @tc.name: PreStartNWebSpawnProcess_001
49 * @tc.desc: prestart nwebspawn process.
50 * @tc.type: FUNC
51 * @tc.require: issueI5W4S7
52 */
53 HWTEST_F(AppSpawnClientTest, PreStartNWebSpawnProcess_001, TestSize.Level0)
54 {
55 auto asc = std::make_shared<AppSpawnClient>(true);
56 int ret = asc->PreStartNWebSpawnProcess();
57 EXPECT_EQ(ret, ERR_OK);
58 }
59
60 /**
61 * @tc.name: PreStartNWebSpawnProcessImpl_001
62 * @tc.desc: prestart nwebspawn process.
63 * @tc.type: FUNC
64 * @tc.require: issueI5W4S7
65 */
66 HWTEST_F(AppSpawnClientTest, PreStartNWebSpawnProcessImpl_001, TestSize.Level0)
67 {
68 auto asc = std::make_shared<AppSpawnClient>(true);
69 int ret = asc->PreStartNWebSpawnProcessImpl();
70 EXPECT_EQ(ret, ERR_OK);
71 }
72
73 /**
74 * @tc.name: PreStartNWebSpawnProcessImpl_002
75 * @tc.desc: prestart nwebspawn process.
76 * @tc.type: FUNC
77 * @tc.require: issueI5W4S7
78 */
79 HWTEST_F(AppSpawnClientTest, PreStartNWebSpawnProcessImpl_002, TestSize.Level0)
80 {
81 auto asc = std::make_shared<AppSpawnClient>(true);
82 asc->OpenConnection();
83 int ret = asc->PreStartNWebSpawnProcessImpl();
84 EXPECT_EQ(ret, ERR_OK);
85 }
86 } // namespace AppExecFwk
87 } // namespace OHOS
88