1 /* 2 * Copyright (c) 2021 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 "iremote_proxy.h" 18 #define private public 19 #define protected public 20 #include "mock_ability_connect_callback_stub.h" 21 #include "ability_connect_callback_proxy.h" 22 #undef private 23 #undef protected 24 25 using namespace testing::ext; 26 using namespace OHOS::AAFwk; 27 using namespace OHOS; 28 using namespace testing; 29 30 class AbilityConnectCallbackRecipientTest : public testing::Test { 31 public: 32 static void SetUpTestCase(void); 33 static void TearDownTestCase(void); 34 void SetUp(); 35 void TearDown(); 36 }; 37 SetUpTestCase(void)38void AbilityConnectCallbackRecipientTest::SetUpTestCase(void) 39 {} TearDownTestCase(void)40void AbilityConnectCallbackRecipientTest::TearDownTestCase(void) 41 {} SetUp()42void AbilityConnectCallbackRecipientTest::SetUp() 43 {} TearDown()44void AbilityConnectCallbackRecipientTest::TearDown() 45 {} 46 47 /** 48 * @tc.name: AbilityConnectCallbackRecipientTest_001 49 * @tc.desc: OnRemoteDied 50 * @tc.type: FUNC 51 */ 52 HWTEST_F(AbilityConnectCallbackRecipientTest, AbilityConnectCallbackRecipientTest_001, TestSize.Level1) 53 { 54 GTEST_LOG_(INFO) << "AbilityConnectCallbackRecipientTest_001 start"; 55 sptr<IRemoteObject> remoteObject; 56 wptr<IRemoteObject> remote(remoteObject); 57 OHOS::AAFwk::AbilityConnectCallbackRecipient::RemoteDiedHandler handler; 58 std::shared_ptr<AbilityConnectCallbackRecipient> recipient = 59 std::make_shared<AbilityConnectCallbackRecipient>(handler); 60 recipient->OnRemoteDied(remote); 61 62 EXPECT_TRUE(true); 63 GTEST_LOG_(INFO) << "AbilityConnectCallbackRecipientTest_001 end"; 64 } 65