• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 <string>
18 #include <vector>
19 #include <iostream>
20 
21 #include "distributed_device_profile_constants.h"
22 #include "distributed_device_profile_log.h"
23 #include "distributed_device_profile_errors.h"
24 #define private public
25 #define protected public
26 
27 #include "sync_subscriber_death_recipient.h"
28 
29 #undef private
30 #undef protected
31 
32 using namespace testing::ext;
33 namespace OHOS {
34 namespace DistributedDeviceProfile {
35 using namespace std;
36 namespace {
37     const std::string TAG = "SyncSubscriberDeathRecipientTest";
38 }
39 class SyncSubscriberDeathRecipientTest : public testing::Test {
40 public:
41     static void SetUpTestCase();
42     static void TearDownTestCase();
43     void SetUp();
44     void TearDown();
45 };
46 
SetUpTestCase()47 void SyncSubscriberDeathRecipientTest::SetUpTestCase()
48 {
49 }
50 
TearDownTestCase()51 void SyncSubscriberDeathRecipientTest::TearDownTestCase()
52 {
53 }
54 
SetUp()55 void SyncSubscriberDeathRecipientTest::SetUp()
56 {
57 }
58 
TearDown()59 void SyncSubscriberDeathRecipientTest::TearDown()
60 {
61 }
62 
63 /*
64  * @tc.name: OnRemoteDied001
65  * @tc.desc: OnRemoteDied
66  * @tc.type: FUNC
67  * @tc.require:
68  */
69 HWTEST_F(SyncSubscriberDeathRecipientTest, OnRemoteDied001, TestSize.Level1)
70 {
71     const wptr<IRemoteObject> remote = nullptr;
72     SyncSubscriberDeathRecipient subDeath_;
73     subDeath_.OnRemoteDied(remote);
74     EXPECT_EQ(remote, nullptr);
75 }
76 
77 /*
78  * @tc.name: OnRemoteDied002
79  * @tc.desc: OnRemoteDied
80  * @tc.type: FUNC
81  * @tc.require:
82  */
83 HWTEST_F(SyncSubscriberDeathRecipientTest, OnRemoteDied002, TestSize.Level1)
84 {
85     const wptr<IRemoteObject> remote;
86     SyncSubscriberDeathRecipient subDeath_;
87     subDeath_.OnRemoteDied(remote);
88     EXPECT_EQ(remote, nullptr);
89 }
90 }
91 }
92