test部分修改

Signed-off-by: lixiyuan <lixiyuan7@huawei.com>
This commit is contained in:
lixiyuan 2024-08-06 23:25:34 +08:00
parent 741af669c7
commit 3fe88b3527
9 changed files with 12 additions and 11 deletions

View File

@ -41,7 +41,7 @@ public:
virtual int32_t StopUser(int32_t userId) = 0;
virtual int32_t GetFreeSizeOfVolume(std::string volumeUuid, int64_t &freeSize) = 0;
virtual int32_t GetTotalSizeOfVolume(std::string volumeUuid, int64_t &totalSize) = 0;
virtual int32_t GetBundleStats(std::string pkgName, BundleStats &bundleStats, int32_t appIndex) = 0;
virtual int32_t GetBundleStats(std::string pkgName, BundleStats &bundleStats, int32_t appIndex = 0) = 0;
virtual int32_t GetSystemSize(int64_t &systemSize) = 0;
virtual int32_t GetTotalSize(int64_t &totalSize) = 0;
virtual int32_t GetFreeSize(int64_t &freeSize) = 0;

View File

@ -478,7 +478,7 @@ HWTEST_F(StorageManagerProxyTest, Storage_manager_proxy_GetBundleStats_0000, tes
.Times(1)
.WillOnce(testing::Invoke(mock_.GetRefPtr(), &StorageManagerServiceMock::InvokeSendRequest));
ASSERT_TRUE(proxy_ != nullptr) << "StorageManagerProxy failed";
int32_t result = proxy_->GetBundleStats(pkgName, bundleStats);
int32_t result = proxy_->GetBundleStats(pkgName, bundleStats, 0);
EXPECT_EQ(result, E_OK);
GTEST_LOG_(INFO) << "StorageManagerProxyTest-end Storage_manager_proxy_GetBundleStats_0000";
}

View File

@ -65,7 +65,7 @@ public:
return E_OK;
}
virtual int32_t GetBundleStats(std::string pkgName, BundleStats &bundleStats) override
virtual int32_t GetBundleStats(std::string pkgName, BundleStats &bundleStats, int32_t appIndex) override
{
return E_OK;
}

View File

@ -30,7 +30,7 @@ public:
MOCK_METHOD2(GetFreeSizeOfVolume, int32_t(std::string, int64_t &));
MOCK_METHOD2(GetTotalSizeOfVolume, int32_t(std::string, int64_t &));
MOCK_METHOD2(GetBundleStats, int32_t(std::string, BundleStats &));
MOCK_METHOD2(GetBundleStats, int32_t(std::string, BundleStats &, int32_t));
MOCK_METHOD1(GetSystemSize, int32_t(int64_t &));
MOCK_METHOD1(GetTotalSize, int32_t(int64_t &));
MOCK_METHOD1(GetFreeSize, int32_t(int64_t &));

View File

@ -105,7 +105,8 @@ std::string StorageStatusService::GetCallingPkgName()
return tokenInfo.bundleName;
}
int32_t StorageStatusService::GetBundleStats(const std::string &pkgName, BundleStats &bundleStats, int32_t appIndex)
int32_t StorageStatusService::GetBundleStats(const std::string &pkgName,
BundleStats &bundleStats, int32_t appIndex)
{
int userId = GetCurrentUserId();
LOGD("StorageStatusService::userId is:%d, appIndex is: %d", userId, appIndex);

View File

@ -144,7 +144,7 @@ HWTEST_F(StorageTotalStatusServiceTest, Storage_status_GetBundleStats_0000, test
std::shared_ptr<StorageStatusService> service = DelayedSingleton<StorageStatusService>::GetInstance();
string pkgName = "com.test";
BundleStats bundleStats;
int32_t result = service->GetBundleStats(pkgName, bundleStats);
int32_t result = service->GetBundleStats(pkgName, bundleStats, 0);
EXPECT_EQ(result, E_BUNDLEMGR_ERROR);
GTEST_LOG_(INFO) << "StorageTotalStatusServiceTest-end Storage_status_service_GetBundleStats_0000";
}
@ -165,7 +165,7 @@ HWTEST_F(StorageTotalStatusServiceTest, Storage_status_GetBundleStats_0001, test
int userId = 100;
string pkgName = "com.test";
BundleStats bundleStats;
int32_t result = service->GetBundleStats(pkgName, userId, bundleStats);
int32_t result = service->GetBundleStats(pkgName, userId, bundleStats, 0);
EXPECT_EQ(result, E_BUNDLEMGR_ERROR);
GTEST_LOG_(INFO) << "StorageTotalStatusServiceTest-end Storage_status_service_GetBundleStats_0001";
}

View File

@ -102,7 +102,7 @@ bool StorageManagerProxyGetFuzzTest(const uint8_t *data, size_t size)
proxy->GetTotalSize(metaData4);
proxy->GetFreeSize(metaData4);
proxy->GetUserStorageStats(storageStats);
proxy->GetBundleStats(metaData, bundleStats);
proxy->GetBundleStats(metaData, bundleStats, 0);
proxy->GetCurrentBundleStats(bundleStats);
proxy->GetUserStorageStats(userId, storageStats);
proxy->GetUserStorageStatsByType(userId, storageStats, metaData);

View File

@ -62,7 +62,7 @@ public:
return E_OK;
}
int32_t GetBundleStats(std::string pkgName, BundleStats &bundleStats) override
int32_t GetBundleStats(std::string pkgName, BundleStats &bundleStats, int32_t appIndex) override
{
return E_OK;
}

View File

@ -44,12 +44,12 @@ bool StorageStatusServiceFuzzTest(const uint8_t *data, size_t size)
incrementalBackTimes.push_back(metaData2);
pkgFileSizes.push_back(metaData2);
incPkgFileSizes.push_back(metaData2);
service->GetBundleStats(pkgName, bundleStats);
service->GetBundleStats(pkgName, bundleStats, 0);
service->GetUserStorageStats(storageStats);
service->GetUserStorageStats(userId, storageStats);
service->GetUserStorageStatsByType(userId, storageStats, type);
service->GetCurrentBundleStats(bundleStats);
service->GetBundleStats(pkgName, userId, bundleStats);
service->GetBundleStats(pkgName, userId, bundleStats, 0);
service->GetBundleStatsForIncrease(userId, bundleName, incrementalBackTimes, pkgFileSizes, incPkgFileSizes);
DelayedSingleton<BundleMgrConnector>::GetInstance()->ResetBundleMgrProxy();
return true;