• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <gtest/gtest.h>
17 
18 #define private public
19 #include "nweb_adapter_helper.h"
20 #include "nweb_cookie_manager.h"
21 #include "nweb_helper.h"
22 #include "nweb.h"
23 
24 using namespace testing;
25 using namespace testing::ext;
26 using namespace OHOS;
27 
28 namespace OHOS::NWeb {
29 namespace {
30 const std::string MOCK_NWEB_INSTALLATION_DIR = "/data/app/el1/bundle/public/com.ohos.arkwebcore";
31 } // namespace
32 
33 class NapiWebCookieManagerTest : public testing::Test {
34 public:
35     static void SetUpTestCase(void);
36     static void TearDownTestCase(void);
37     void SetUp();
38     void TearDown();
39 };
40 
SetUpTestCase(void)41 void NapiWebCookieManagerTest::SetUpTestCase(void)
42 {}
43 
TearDownTestCase(void)44 void NapiWebCookieManagerTest::TearDownTestCase(void)
45 {}
46 
SetUp(void)47 void NapiWebCookieManagerTest::SetUp(void)
48 {}
49 
TearDown(void)50 void NapiWebCookieManagerTest::TearDown(void)
51 {}
52 
53 NWebHelper& g_nwebHelperInstance = NWebHelper::Instance();
54 /**
55  * @tc.name: NapiWebCookieManagerTest_001
56  * @tc.desc: GetCookieManager.
57  * @tc.type: FUNC
58  * @tc.require: I5P91V
59  */
60 HWTEST_F(NapiWebCookieManagerTest, NapiWebCookieManagerTest_001, TestSize.Level1)
61 {
62     std::string hapPath = "";
63     g_nwebHelperInstance.SetBundlePath(hapPath);
64     NWebAdapterHelper::Instance().Init(false);
65     std::shared_ptr<NWebCookieManager> cookieManager = g_nwebHelperInstance.GetCookieManager();
66     EXPECT_EQ(cookieManager, nullptr);
67 }
68 } // namespace OHOS::NWeb
69