1 /* 2 * Copyright (c) 2024 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 "push_promise_callback.h" 19 20 using namespace testing::ext; 21 namespace OHOS { 22 namespace Notification { 23 class PromiseCallbackInfoTest : public testing::Test { 24 public: SetUpTestCase()25 static void SetUpTestCase() {} TearDownTestCase()26 static void TearDownTestCase() {} SetUp()27 void SetUp() {} TearDown()28 void TearDown() {} 29 }; 30 31 /** 32 * @tc.name: Create_00001 33 * @tc.desc: Test Create. 34 * @tc.type: FUNC 35 * @tc.require: issue 36 */ 37 HWTEST_F(PromiseCallbackInfoTest, Create_00001, Function | SmallTest | Level1) 38 { 39 std::shared_ptr<PushCallBackParam> pushCallBackParam = std::make_shared<PushCallBackParam>(); 40 auto *callbackInfo = PromiseCallbackInfo::Create(pushCallBackParam); 41 EXPECT_NE(callbackInfo, nullptr); 42 auto pushCallBackParam_ = callbackInfo->GetJsCallBackParam(); 43 EXPECT_NE(pushCallBackParam.get(), nullptr); 44 PromiseCallbackInfo::Destroy(callbackInfo); 45 } 46 } 47 } 48