1 /*
2 * Copyright (c) 2025 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 #include "napi_common_want_agent.h"
18 #include "napi/native_api.h"
19
20 namespace OHOS {
21 namespace AppExecFwk {
22 using namespace testing;
23 using namespace testing::ext;
24
25 class NapiCommonWantAgentTest : public testing::Test {
26 public:
27 static void SetUpTestCase(void);
28 static void TearDownTestCase(void);
29 void SetUp();
30 void TearDown();
31 };
32
SetUpTestCase()33 void NapiCommonWantAgentTest::SetUpTestCase()
34 {
35 }
36
TearDownTestCase()37 void NapiCommonWantAgentTest::TearDownTestCase()
38 {
39 }
40
SetUp()41 void NapiCommonWantAgentTest::SetUp()
42 {
43 }
44
TearDown()45 void NapiCommonWantAgentTest::TearDown()
46 {
47 }
48
49 /**
50 * @tc.number: WrapWantAgent_0100
51 * @tc.name: WrapWantAgent_0100
52 * @tc.desc: WrapWantAgent.
53 */
54 HWTEST_F(NapiCommonWantAgentTest, WrapWantAgent_0100, Function | MediumTest | Level1)
55 {
56 napi_env env = nullptr;
57 AbilityRuntime::WantAgent::WantAgent* wantAgent = nullptr;
58 napi_finalize finalizeCb = nullptr;
59 auto test = OHOS::AppExecFwk::WrapWantAgent(env, wantAgent, finalizeCb);
60 EXPECT_EQ(test, nullptr);
61 }
62
63 /**
64 * @tc.number: UnwrapWantAgent_0100
65 * @tc.name: UnwrapWantAgent_0100
66 * @tc.desc: UnwrapWantAgent.
67 */
68 HWTEST_F(NapiCommonWantAgentTest, UnwrapWantAgent_0100, Function | MediumTest | Level1)
69 {
70 napi_env env = nullptr;
71 napi_value jsParam = nullptr;
72 void **result = nullptr;
73 OHOS::AppExecFwk::UnwrapWantAgent(env, jsParam, result);
74 EXPECT_EQ(result, nullptr);
75 }
76 } // namespace AppExecFwk
77 } // namespace OHOS
78
79