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