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 "kv_store_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 = "KvStoreDeathRecipientTest"; 38 } 39 class KvStoreDeathRecipientTest : public testing::Test { 40 public: 41 static void SetUpTestCase(); 42 static void TearDownTestCase(); 43 void SetUp(); 44 void TearDown(); 45 }; 46 SetUpTestCase()47void KvStoreDeathRecipientTest::SetUpTestCase() 48 { 49 } 50 TearDownTestCase()51void KvStoreDeathRecipientTest::TearDownTestCase() 52 { 53 } 54 SetUp()55void KvStoreDeathRecipientTest::SetUp() 56 { 57 } 58 TearDown()59void KvStoreDeathRecipientTest::TearDown() 60 { 61 } 62 63 /* 64 * @tc.name: OnRemoteDied001 65 * @tc.desc: OnRemoteDied 66 * @tc.type: FUNC 67 * @tc.require: 68 */ 69 HWTEST_F(KvStoreDeathRecipientTest, OnRemoteDied001, TestSize.Level1) 70 { 71 std::string storeId = "dp_kv_store"; 72 std::shared_ptr<KvDeathRecipient> KvDeathRecipient_ = make_shared<KvDeathRecipient>(storeId); 73 KvDeathRecipient_->OnRemoteDied(); 74 EXPECT_EQ(storeId, KvDeathRecipient_->storeId_); 75 } 76 } 77 } 78