From d4adf91f80bcbbdecb9a12fb63c2d2257443e272 Mon Sep 17 00:00:00 2001 From: bluhuang Date: Tue, 23 May 2023 06:51:37 +0000 Subject: [PATCH 1/2] optimize ut Signed-off-by: bluhuang --- .../cloud_syncer_progress_manager_test.cpp | 22 +++++-- .../common/syncer/cloud/cloud_syncer_test.h | 6 ++ .../syncer/cloud/cloud_syncer_upload_test.cpp | 63 +++++++++++++------ .../distributeddb_cloud_db_proxy_test.cpp | 17 ++++- 4 files changed, 81 insertions(+), 27 deletions(-) diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_progress_manager_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_progress_manager_test.cpp index baf4fd3efb2..a67fff41af2 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_progress_manager_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_progress_manager_test.cpp @@ -66,7 +66,8 @@ HWTEST_F(CloudSyncerMgrTest, SyncerMgrCheck001, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - MockICloudDB *idb = new MockICloudDB(); + // MockICloudDB *idb = new MockICloudDB(); + std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); std::vector devices = {"cloud"}; vector tables = {"TestTableA", "TestTableB" }; @@ -131,8 +132,9 @@ HWTEST_F(CloudSyncerMgrTest, SyncerMgrCheck001, TestSize.Level1) std::this_thread::sleep_for(std::chrono::seconds(1)); EXPECT_EQ(res.process, FINISHED); + RuntimeContext::GetInstance()->StopTaskPool(); + storageProxy.reset(); delete iCloud; - storageProxy = nullptr; } /** @@ -149,7 +151,8 @@ HWTEST_F(CloudSyncerMgrTest, SyncerMgrCheck002, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - MockICloudDB *idb = new MockICloudDB(); + // MockICloudDB *idb = new MockICloudDB(); + std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); vector tables = {"TestTableA", "TestTableB" }; SyncProcessCallback onProcess; @@ -171,7 +174,10 @@ HWTEST_F(CloudSyncerMgrTest, SyncerMgrCheck002, TestSize.Level1) errCode = cloudSyncer.CallTryToAddSyncTask(std::move(cloudSyncer.taskInfo_)); EXPECT_EQ(errCode, E_OK); - storageProxy = nullptr; + // delete iCloud; + // storageProxy = nullptr; + RuntimeContext::GetInstance()->StopTaskPool(); + storageProxy.reset(); delete iCloud; } @@ -188,7 +194,8 @@ HWTEST_F(CloudSyncerMgrTest, SyncerMgrCheck003, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - MockICloudDB *idb = new MockICloudDB(); + // MockICloudDB *idb = new MockICloudDB(); + std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); std::vector devices = {"cloud"}; @@ -203,8 +210,11 @@ HWTEST_F(CloudSyncerMgrTest, SyncerMgrCheck003, TestSize.Level1) errCode = cloudSyncer.CallPrepareSync(2u); EXPECT_EQ(errCode, -E_DB_CLOSED); - storageProxy = nullptr; + RuntimeContext::GetInstance()->StopTaskPool(); + storageProxy.reset(); delete iCloud; + // delete iCloud; + // storageProxy = nullptr; } /** diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_test.h b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_test.h index 8a830433f43..3eec493fd11 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_test.h +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_test.h @@ -136,6 +136,12 @@ public: this->cloudDB_.SetCloudDB(std::shared_ptr(icloudDB)); } + void SetMockICloudDB(std::shared_ptr &icloudDB) + { + // this->cloudDB_.SetCloudDB(std::shared_ptr(icloudDB)); + this->cloudDB_.SetCloudDB(icloudDB); + } + void CallDoFinished(TaskId taskId, int errCode, const InnerProcessInfo &processInfo) { DoFinished( taskId, errCode, processInfo); diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_upload_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_upload_test.cpp index a646ca11a62..2d691b2482d 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_upload_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_upload_test.cpp @@ -69,7 +69,8 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck001, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - MockICloudDB *idb = new MockICloudDB(); + // MockICloudDB *idb = new MockICloudDB(); + std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); TaskId taskId = 1; @@ -107,8 +108,9 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck001, TestSize.Level1) errCode = cloudSyncer.CallDoUpload(taskId); EXPECT_EQ(errCode, -E_INVALID_ARGS); - storageProxy = nullptr; + storageProxy.reset(); delete iCloud; + idb = nullptr; } /** @@ -123,7 +125,8 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck002, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - MockICloudDB *idb = new MockICloudDB(); + // MockICloudDB *idb = new MockICloudDB(); + std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); TaskId taskId = 2u; @@ -179,8 +182,9 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck002, TestSize.Level1) errCode = cloudSyncer.CallDoUpload(taskId); EXPECT_EQ(errCode, SQLITE_ERROR); - storageProxy = nullptr; + storageProxy.reset(); delete iCloud; + idb = nullptr; } @@ -196,7 +200,8 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck003, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - MockICloudDB *idb = new MockICloudDB(); + // MockICloudDB *idb = new MockICloudDB(); + std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); TaskId taskId = 3u; cloudSyncer.InitCloudSyncer(taskId, SYNC_MODE_CLOUD_FORCE_PUSH); @@ -265,8 +270,10 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck003, TestSize.Level1) errCode = cloudSyncer.CallDoUpload(taskId); EXPECT_EQ(errCode, E_OK); - storageProxy = nullptr; + RuntimeContext::GetInstance()->StopTaskPool(); + storageProxy.reset(); delete iCloud; + idb = nullptr; } /** @@ -281,7 +288,8 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck004, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - MockICloudDB *idb = new MockICloudDB(); + // MockICloudDB *idb = new MockICloudDB(); + std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); TaskId taskId = 4u; cloudSyncer.InitCloudSyncer(taskId, SYNC_MODE_CLOUD_FORCE_PUSH); @@ -350,8 +358,11 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck004, TestSize.Level1) errCode = cloudSyncer.CallDoUpload(taskId); EXPECT_EQ(errCode, -E_INTERNAL_ERROR); - storageProxy = nullptr; + RuntimeContext::GetInstance()->StopTaskPool(); + + storageProxy.reset(); delete iCloud; + idb = nullptr; } /** @@ -367,7 +378,8 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck005, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - MockICloudDB *idb = new MockICloudDB(); + // MockICloudDB *idb = new MockICloudDB(); + std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); TaskId taskId = 5u; @@ -415,8 +427,11 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck005, TestSize.Level1) errCode = cloudSyncer.CallDoUpload(taskId); EXPECT_EQ(errCode, -E_INTERNAL_ERROR); - storageProxy = nullptr; + RuntimeContext::GetInstance()->StopTaskPool(); + + storageProxy.reset(); delete iCloud; + idb = nullptr; } /** @@ -432,7 +447,8 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck006, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - MockICloudDB *idb = new MockICloudDB(); + // MockICloudDB *idb = new MockICloudDB(); + std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); TaskId taskId = 6u; @@ -498,8 +514,10 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck006, TestSize.Level1) EXPECT_EQ(cloudSyncer.GetUploadSuccessCount(taskId), 2000); EXPECT_EQ(cloudSyncer.GetUploadFailCount(taskId), 0); - storageProxy = nullptr; + RuntimeContext::GetInstance()->StopTaskPool(); + storageProxy.reset(); delete iCloud; + idb = nullptr; // todo:reformat this file, some functions are over 50 lines. } @@ -516,7 +534,8 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck007, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - MockICloudDB *idb = new MockICloudDB(); + // MockICloudDB *idb = new MockICloudDB(); + std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); TaskId taskId = 7u; cloudSyncer.InitCloudSyncer(taskId, SYNC_MODE_CLOUD_FORCE_PUSH); @@ -559,7 +578,8 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck007, TestSize.Level1) RuntimeContext::GetInstance()->StopTaskPool(); count = 3000; TestCloudSyncer cloudSyncer2(storageProxy); - MockICloudDB *idb2 = new MockICloudDB(); + // MockICloudDB *idb2 = new MockICloudDB(); + std::shared_ptr idb2 = std::make_shared(); cloudSyncer2.SetMockICloudDB(idb2); taskId = 8u; cloudSyncer2.InitCloudSyncer(taskId, SYNC_MODE_CLOUD_FORCE_PUSH); @@ -584,7 +604,8 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck007, TestSize.Level1) RuntimeContext::GetInstance()->StopTaskPool(); count = 3000; TestCloudSyncer cloudSyncer3(storageProxy); - MockICloudDB *idb3 = new MockICloudDB(); + // MockICloudDB *idb3 = new MockICloudDB(); + std::shared_ptr idb3 = std::make_shared(); cloudSyncer3.SetMockICloudDB(idb3); taskId = 9u; cloudSyncer3.InitCloudSyncer(taskId, SYNC_MODE_CLOUD_FORCE_PUSH); @@ -606,8 +627,12 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck007, TestSize.Level1) EXPECT_EQ(cloudSyncer3.GetUploadSuccessCount(taskId), 0); EXPECT_EQ(cloudSyncer3.GetUploadFailCount(taskId), 3000); - storageProxy = nullptr; + RuntimeContext::GetInstance()->StopTaskPool(); + storageProxy.reset(); delete iCloud; + idb = nullptr; + idb2 = nullptr; + idb3 = nullptr; } /** @@ -623,7 +648,8 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck008, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - MockICloudDB *idb = new MockICloudDB(); + // MockICloudDB *idb = new MockICloudDB(); + std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); TaskId taskId = 8u; cloudSyncer.InitCloudSyncer(taskId, SYNC_MODE_CLOUD_FORCE_PUSH); @@ -667,8 +693,9 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck008, TestSize.Level1) RuntimeContext::GetInstance()->StopTaskPool(); - storageProxy = nullptr; + storageProxy.reset(); delete iCloud; + idb = nullptr; } /** diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/distributeddb_cloud_db_proxy_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/distributeddb_cloud_db_proxy_test.cpp index 4e46398b8e3..d89b104e670 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/distributeddb_cloud_db_proxy_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/distributeddb_cloud_db_proxy_test.cpp @@ -20,6 +20,7 @@ #include "cloud_db_types.h" #include "cloud_db_proxy.h" #include "distributeddb_tools_unit_test.h" +#include "mock_icloud_sync_storage_interface.h" #include "virtual_cloud_db.h" #include "virtual_cloud_syncer.h" @@ -277,7 +278,10 @@ HWTEST_F(DistributedDBCloudDBProxyTest, CloudDBProxyTest004, TestSize.Level3) * @tc.steps: step1. set cloud db to proxy and sleep 5s when download * @tc.expected: step1. E_OK */ - auto cloudSyncer = new(std::nothrow) VirtualCloudSyncer(nullptr); + auto iCloud = std::make_shared(); + auto cloudSyncer = new(std::nothrow) VirtualCloudSyncer(StorageProxy::GetCloudDb(iCloud.get())); + EXPECT_CALL(*iCloud, StartTransaction).WillRepeatedly(testing::Return(E_OK)); + EXPECT_CALL(*iCloud, Commit).WillRepeatedly(testing::Return(E_OK)); ASSERT_NE(cloudSyncer, nullptr); ASSERT_EQ(cloudSyncer->SetCloudDB(virtualCloudDb_), E_OK); cloudSyncer->SetSyncAction(true, false); @@ -336,7 +340,10 @@ HWTEST_F(DistributedDBCloudDBProxyTest, CloudDBProxyTest005, TestSize.Level0) * @tc.steps: step1. set cloud db to proxy and sleep 5s when download * @tc.expected: step1. E_OK */ - auto cloudSyncer = new(std::nothrow) VirtualCloudSyncer(nullptr); + auto iCloud = std::make_shared(); + auto cloudSyncer = new(std::nothrow) VirtualCloudSyncer(StorageProxy::GetCloudDb(iCloud.get())); + EXPECT_CALL(*iCloud, StartTransaction).WillRepeatedly(testing::Return(E_OK)); + EXPECT_CALL(*iCloud, Commit).WillRepeatedly(testing::Return(E_OK)); ASSERT_NE(cloudSyncer, nullptr); ASSERT_EQ(cloudSyncer->SetCloudDB(virtualCloudDb_), E_OK); cloudSyncer->SetSyncAction(false, false); @@ -370,7 +377,11 @@ HWTEST_F(DistributedDBCloudDBProxyTest, CloudDBProxyTest006, TestSize.Level3) * @tc.steps: step1. set cloud db to proxy and sleep 5s when download * @tc.expected: step1. E_OK */ - auto cloudSyncer = new(std::nothrow) VirtualCloudSyncer(nullptr); + auto iCloud = std::make_shared(); + auto cloudSyncer = new(std::nothrow) VirtualCloudSyncer(StorageProxy::GetCloudDb(iCloud.get())); + EXPECT_CALL(*iCloud, StartTransaction).WillRepeatedly(testing::Return(E_OK)); + EXPECT_CALL(*iCloud, Commit).WillRepeatedly(testing::Return(E_OK)); + EXPECT_CALL(*iCloud, Rollback).WillRepeatedly(testing::Return(E_OK)); ASSERT_NE(cloudSyncer, nullptr); ASSERT_EQ(cloudSyncer->SetCloudDB(virtualCloudDb_), E_OK); cloudSyncer->SetSyncAction(true, false); -- Gitee From 39ad50e2c23171ec1aeabaceaf7991fee4f0c255 Mon Sep 17 00:00:00 2001 From: bluhuang Date: Tue, 23 May 2023 06:57:29 +0000 Subject: [PATCH 2/2] remove adundent code Signed-off-by: bluhuang --- .../cloud/cloud_syncer_progress_manager_test.cpp | 7 ------- .../common/syncer/cloud/cloud_syncer_upload_test.cpp | 10 ---------- 2 files changed, 17 deletions(-) diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_progress_manager_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_progress_manager_test.cpp index a67fff41af2..ca9e8c02a7f 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_progress_manager_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_progress_manager_test.cpp @@ -66,7 +66,6 @@ HWTEST_F(CloudSyncerMgrTest, SyncerMgrCheck001, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - // MockICloudDB *idb = new MockICloudDB(); std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); std::vector devices = {"cloud"}; @@ -151,7 +150,6 @@ HWTEST_F(CloudSyncerMgrTest, SyncerMgrCheck002, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - // MockICloudDB *idb = new MockICloudDB(); std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); vector tables = {"TestTableA", "TestTableB" }; @@ -174,8 +172,6 @@ HWTEST_F(CloudSyncerMgrTest, SyncerMgrCheck002, TestSize.Level1) errCode = cloudSyncer.CallTryToAddSyncTask(std::move(cloudSyncer.taskInfo_)); EXPECT_EQ(errCode, E_OK); - // delete iCloud; - // storageProxy = nullptr; RuntimeContext::GetInstance()->StopTaskPool(); storageProxy.reset(); delete iCloud; @@ -194,7 +190,6 @@ HWTEST_F(CloudSyncerMgrTest, SyncerMgrCheck003, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - // MockICloudDB *idb = new MockICloudDB(); std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); @@ -213,8 +208,6 @@ HWTEST_F(CloudSyncerMgrTest, SyncerMgrCheck003, TestSize.Level1) RuntimeContext::GetInstance()->StopTaskPool(); storageProxy.reset(); delete iCloud; - // delete iCloud; - // storageProxy = nullptr; } /** diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_upload_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_upload_test.cpp index 2d691b2482d..8206b63fa69 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_upload_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/cloud_syncer_upload_test.cpp @@ -69,7 +69,6 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck001, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - // MockICloudDB *idb = new MockICloudDB(); std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); TaskId taskId = 1; @@ -125,7 +124,6 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck002, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - // MockICloudDB *idb = new MockICloudDB(); std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); TaskId taskId = 2u; @@ -200,7 +198,6 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck003, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - // MockICloudDB *idb = new MockICloudDB(); std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); TaskId taskId = 3u; @@ -288,7 +285,6 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck004, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - // MockICloudDB *idb = new MockICloudDB(); std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); TaskId taskId = 4u; @@ -378,7 +374,6 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck005, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - // MockICloudDB *idb = new MockICloudDB(); std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); @@ -447,7 +442,6 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck006, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - // MockICloudDB *idb = new MockICloudDB(); std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); @@ -534,7 +528,6 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck007, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - // MockICloudDB *idb = new MockICloudDB(); std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); TaskId taskId = 7u; @@ -578,7 +571,6 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck007, TestSize.Level1) RuntimeContext::GetInstance()->StopTaskPool(); count = 3000; TestCloudSyncer cloudSyncer2(storageProxy); - // MockICloudDB *idb2 = new MockICloudDB(); std::shared_ptr idb2 = std::make_shared(); cloudSyncer2.SetMockICloudDB(idb2); taskId = 8u; @@ -604,7 +596,6 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck007, TestSize.Level1) RuntimeContext::GetInstance()->StopTaskPool(); count = 3000; TestCloudSyncer cloudSyncer3(storageProxy); - // MockICloudDB *idb3 = new MockICloudDB(); std::shared_ptr idb3 = std::make_shared(); cloudSyncer3.SetMockICloudDB(idb3); taskId = 9u; @@ -648,7 +639,6 @@ HWTEST_F(CloudSyncerMockUploadTest, UploadModeCheck008, TestSize.Level1) MockICloudSyncStorageInterface *iCloud = new MockICloudSyncStorageInterface(); std::shared_ptr storageProxy = std::make_shared(iCloud); TestCloudSyncer cloudSyncer(storageProxy); - // MockICloudDB *idb = new MockICloudDB(); std::shared_ptr idb = std::make_shared(); cloudSyncer.SetMockICloudDB(idb); TaskId taskId = 8u; -- Gitee