diff --git a/tests/unittests/backup_sa/BUILD.gn b/tests/unittests/backup_sa/BUILD.gn index 5351c84bdbf85a42b387bef2ee72b856a1145dc2..b552944b36440350ab9912752b5be12b0964ecbd 100644 --- a/tests/unittests/backup_sa/BUILD.gn +++ b/tests/unittests/backup_sa/BUILD.gn @@ -19,6 +19,7 @@ group("backup_sa_test") { deps = [ "module_app_gallery:app_gallery_test", + "module_client:service_client_test", "module_external:adapter_test", "module_ipc:backup_sa_ipc_test", "session:session_test", diff --git a/tests/unittests/backup_sa/module_client/BUILD.gn b/tests/unittests/backup_sa/module_client/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..47a26fff8f5029cd1fb742034138dd9d5d05b161 --- /dev/null +++ b/tests/unittests/backup_sa/module_client/BUILD.gn @@ -0,0 +1,86 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/test.gni") +import("//foundation/filemanagement/app_file_service/app_file_service.gni") +import("//foundation/filemanagement/app_file_service/backup.gni") + +ohos_unittest("service_client_test") { + module_out_path = path_module_out_tests + + include_dirs = [ + "${path_backup}/frameworks/native/backup_kit_inner/include", + "${path_backup}/interfaces/inner_api/native/backup_kit_inner/impl", + "${path_backup}/services/backup_sa/include", + "${path_backup}/services/backup_sa/include/module_notify", + "${path_backup}/utils/include", + "${path_backup}/utils/src", + "${path_backup}/tests/mock/utils_mock/include", + ".", + ] + + sources = [ + "${path_backup}/tests/mock/utils_mock/src/utils_mock_global_variable.cpp", + "service_client_test.cpp", + ] + + deps = [ + "${path_backup}/interfaces/inner_api/native/backup_kit_inner:backup_kit_inner", + "${path_backup}/services/backup_sa:backup_sa_ipc_stub", + "${path_backup}/utils:backup_utils", + ] + + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + debug = false + } + + defines = [ + "LOG_TAG=\"app_file_service\"", + "LOG_DOMAIN=0xD200000", + "private = public", + "protected = public", + ] + + external_deps = [ + "ability_base:want", + "ability_runtime:ability_connect_callback_stub", + "ability_runtime:ability_manager", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "googletest:gmock_main", + "googletest:gtest_main", + "hilog:libhilog", + "hitrace:hitrace_meter", + "ipc:ipc_core", + "jsoncpp:jsoncpp", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + "storage_service:storage_manager_sa_proxy", + ] + + use_exceptions = true +} + +group("backup_sa_service_client_test") { + testonly = true + deps = [ ":service_client_test" ] +} diff --git a/tests/unittests/backup_sa/module_client/service_client_test.cpp b/tests/unittests/backup_sa/module_client/service_client_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0cecf86a55f6258b897c044e026a0c7537a7d943 --- /dev/null +++ b/tests/unittests/backup_sa/module_client/service_client_test.cpp @@ -0,0 +1,411 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include +#include + +#include "b_error/b_error.h" +#include "service_client.h" +#include "service_reverse.h" +#include "b_session_restore.h" + +namespace OHOS::FileManagement::Backup { +using namespace std; +using namespace testing; + +class ServiceClientTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(); + void SetUp() override {}; + void TearDown() override {}; + +public: + static inline sptr proxy = nullptr; +}; + +void ServiceClientTest::SetUpTestCase() +{ + GTEST_LOG_(INFO) << "begin SetUpTestCase"; + proxy = ServiceClient::GetInstance(); + if (proxy == nullptr) { + GTEST_LOG_(INFO) << "Failed to get ServiceClient instance"; + } +} + +void ServiceClientTest::TearDownTestCase() +{ + if (proxy != nullptr) { + ServiceClient::InvaildInstance(); + proxy = nullptr; + } + ServiceClient::InvaildInstance(); +} + +/** + * @tc.number: SUB_service_client_test_0100 + * @tc.name: SUB_service_client_test_0100 + * @tc.desc: 测试 InitIncrementalBackupSession 接口 + * @tc.size: MEDIUM + * @tc.type: FUNC + * @tc.level Level 1 + * @tc.require: issuesI9KPRL + */ +HWTEST_F(ServiceClientTest, SUB_service_client_test_0100, testing::ext::TestSize.Level1) +{ + GTEST_LOG_(INFO) << "ServiceClientTest-begin SUB_service_client_test_0100"; + EXPECT_NE(proxy, nullptr); + ServiceClient::InvaildInstance(); + proxy=ServiceClient::serviceProxy_; + EXPECT_EQ(proxy, nullptr); + GTEST_LOG_(INFO) << "ServiceClientTest-end SUB_service_client_test_0100"; +} + +HWTEST_F(ServiceClientTest, SUB_service_client_test_0200, testing::ext::TestSize.Level1) +{ + GTEST_LOG_(INFO) << "ServiceClientTest-begin SUB_service_client_test_0200"; + proxy = ServiceClient::GetInstance(); + EXPECT_NE(proxy, nullptr); + ErrCode ret = proxy->Start(); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_PERM)); + ret = proxy->Finish(); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_PERM)); + ret = proxy->Release(); + EXPECT_NE(ret, BError(BError::BackupErrorCode::E_PERM)); + ret = proxy->GetAppLocalListAndDoIncrementalBackup(); + EXPECT_NE(ret, BError(BError::Codes::OK)); + GTEST_LOG_(INFO) << "ServiceClientTest-end SUB_service_client_test_0200"; +} + +HWTEST_F(ServiceClientTest, SUB_service_client_test_0300, testing::ext::TestSize.Level1) +{ + GTEST_LOG_(INFO) << "ServiceClientTest-begin SUB_service_client_test_0300"; + proxy = ServiceClient::GetInstance(); + EXPECT_NE(proxy, nullptr); + std::string bundleName; + int32_t result = -1; + ErrCode ret = proxy->Cancel(bundleName, result); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_CANCEL_UNSTARTED_TASK)); + bundleName = ""; + ret = proxy->Cancel(bundleName, result); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_CANCEL_UNSTARTED_TASK)); + bundleName = "test"; + ret = proxy->Cancel(bundleName, result); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_CANCEL_UNSTARTED_TASK)); + EXPECT_NE(result, 0); + GTEST_LOG_(INFO) << "ServiceClientTest-end SUB_service_client_test_0300"; +} + +HWTEST_F(ServiceClientTest, SUB_service_client_test_0400, testing::ext::TestSize.Level1) +{ + GTEST_LOG_(INFO) << "ServiceClientTest-begin SUB_service_client_test_0400"; + proxy = ServiceClient::GetInstance(); + EXPECT_NE(proxy, nullptr); + ErrCode err = -1; + ErrCode ret = proxy->AppIncrementalDone(err); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + err = 0; + ret = proxy->AppIncrementalDone(err); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + err = 1; + ret = proxy->AppIncrementalDone(err); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + GTEST_LOG_(INFO) << "ServiceClientTest-end SUB_service_client_test_0400"; +} + +HWTEST_F(ServiceClientTest, SUB_service_client_test_0500, testing::ext::TestSize.Level1) +{ + GTEST_LOG_(INFO) << "ServiceClientTest-begin SUB_service_client_test_0500"; + proxy = ServiceClient::GetInstance(); + EXPECT_NE(proxy, nullptr); + ErrCode err = -1; + ErrCode ret = proxy->AppDone(err); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + err = 0; + ret = proxy->AppDone(err); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + err = 1; + ret = proxy->AppDone(err); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + GTEST_LOG_(INFO) << "ServiceClientTest-end SUB_service_client_test_0500"; +} + +HWTEST_F(ServiceClientTest, SUB_service_client_test_0600, testing::ext::TestSize.Level1) +{ + GTEST_LOG_(INFO) << "ServiceClientTest-begin SUB_service_client_test_0600"; + proxy = ServiceClient::GetInstance(); + EXPECT_NE(proxy, nullptr); + int fd = -1; + ErrCode ret = proxy->GetLocalCapabilities(fd); + EXPECT_EQ(ret, BError(BError::Codes::OK)); + fd = -2; + ret = proxy->GetLocalCapabilitiesForBundleInfos(fd); + EXPECT_EQ(ret, BError(BError::Codes::OK)); + GTEST_LOG_(INFO) << "ServiceClientTest-end SUB_service_client_test_0600"; +} + +HWTEST_F(ServiceClientTest, SUB_service_client_test_0700, testing::ext::TestSize.Level1) +{ + GTEST_LOG_(INFO) << "ServiceClientTest-begin SUB_service_client_test_0700"; + proxy = ServiceClient::GetInstance(); + EXPECT_NE(proxy, nullptr); + std::string bundleName; + std::string fileName; + ErrCode ret = proxy->GetIncrementalFileHandle(bundleName, fileName); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + bundleName = ""; + fileName = ""; + ret = proxy->GetIncrementalFileHandle(bundleName, fileName); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + bundleName = "test"; + fileName = "test"; + ret = proxy->GetIncrementalFileHandle(bundleName, fileName); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + GTEST_LOG_(INFO) << "ServiceClientTest-end SUB_service_client_test_0700"; +} + +HWTEST_F(ServiceClientTest, SUB_service_client_test_0800, testing::ext::TestSize.Level1) +{ + GTEST_LOG_(INFO) << "ServiceClientTest-begin SUB_service_client_test_0800"; + proxy = ServiceClient::GetInstance(); + EXPECT_NE(proxy, nullptr); + std::string bundleName; + std::string fileName; + bool booleanValue = false; + ErrCode ret = proxy->GetBackupInfo(bundleName, fileName); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_BEF)); + EXPECT_EQ(bundleName, ""); + EXPECT_EQ(fileName, ""); + booleanValue = true; + ret = proxy->StartExtTimer(booleanValue); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + booleanValue = false; + ret = proxy->StartExtTimer(booleanValue); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + booleanValue = true; + ret = proxy->StartFwkTimer(booleanValue); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + booleanValue = false; + ret = proxy->StartFwkTimer(booleanValue); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + booleanValue = true; + ret = proxy->StopExtTimer(booleanValue); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + booleanValue = false; + ret = proxy->StopExtTimer(booleanValue); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + bool isExt = true; + bundleName = ""; + ret = proxy->UpdateTimer(bundleName, 0, isExt); + EXPECT_NE(ret, BError(BError::BackupErrorCode::E_INVAL)); + EXPECT_EQ(isExt, false); + bundleName = "test"; + ret = proxy->UpdateTimer(bundleName, 10, isExt); + EXPECT_EQ(ret, BError(BError::Codes::OK)); + EXPECT_EQ(isExt, false); + GTEST_LOG_(INFO) << "ServiceClientTest-end SUB_service_client_test_0800"; +} + +HWTEST_F(ServiceClientTest, SUB_service_client_test_0900, testing::ext::TestSize.Level1) +{ + GTEST_LOG_(INFO) << "ServiceClientTest-begin SUB_service_client_test_0900"; + proxy = ServiceClient::GetInstance(); + EXPECT_NE(proxy, nullptr); + std::string stringVal = ""; + ErrCode ret = proxy->ReportAppProcessInfo(stringVal, BackupRestoreScenario::FULL_BACKUP); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + stringVal = ""; + ret = proxy->ReportAppProcessInfo(stringVal, BackupRestoreScenario::FULL_BACKUP); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + stringVal = "test"; + ret = proxy->ReportAppProcessInfo(stringVal, BackupRestoreScenario::FULL_BACKUP); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + int64_t val = -1; + ret = proxy->RefreshDataSize(val); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + val = 1; + ret = proxy->RefreshDataSize(val); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + stringVal = ""; + ret = proxy->ServiceResultReport(stringVal, BackupRestoreScenario::FULL_BACKUP, 0); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + stringVal = ""; + ret = proxy->ServiceResultReport(stringVal, BackupRestoreScenario::FULL_BACKUP, 0); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + GTEST_LOG_(INFO) << "ServiceClientTest-end SUB_service_client_test_0900"; +} + +HWTEST_F(ServiceClientTest, SUB_service_client_test_1000, testing::ext::TestSize.Level1) +{ + std::string bundleName = ""; + GTEST_LOG_(INFO) << "ServiceClientTest-begin SUB_service_client_test_1000"; + proxy = ServiceClient::GetInstance(); + EXPECT_NE(proxy, nullptr); + BFileInfo *fileInfo = nullptr; + BFileInfo bf {bundleName, "", 0}; + fileInfo = &bf; + ErrCode ret = proxy->PublishFile(*fileInfo); + EXPECT_NE(ret, BError(BError::Codes::OK)); + ret = proxy->PublishIncrementalFile(*fileInfo); + EXPECT_NE(ret, BError(BError::Codes::OK)); + ret = proxy->PublishSAIncrementalFile(*fileInfo, 0); + EXPECT_NE(ret, BError(BError::Codes::OK)); + GTEST_LOG_(INFO) << "ServiceClientTest-end SUB_service_client_test_1000"; +} + +HWTEST_F(ServiceClientTest, SUB_service_client_test_1100, testing::ext::TestSize.Level1) +{ + GTEST_LOG_(INFO) << "ServiceClientTest-begin SUB_service_client_test_1100"; + proxy = ServiceClient::GetInstance(); + EXPECT_NE(proxy, nullptr); + int fd = 0; + int32_t restoreType = -1; + int32_t userid = -1; + std::vector bundleNames; + std::vector detailInfos; + std::vector bundlesToBackup; + ErrCode ret = proxy->AppendBundlesRestoreSessionDataByDetail(fd, bundleNames, detailInfos, restoreType, userid); + EXPECT_NE(ret, BError(BError::Codes::OK)); + ret = proxy->AppendBundlesRestoreSessionData(fd, bundleNames, restoreType, userid); + EXPECT_NE(ret, BError(BError::Codes::OK)); + ret = proxy->AppendBundlesIncrementalBackupSessionWithBundleInfos(bundlesToBackup, detailInfos); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + ret = proxy->AppendBundlesBackupSession(bundleNames); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + ret = proxy->AppendBundlesDetailsBackupSession(bundleNames, detailInfos); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + bundleNames.push_back("test"); + ret = proxy->AppendBundlesRestoreSessionDataByDetail(fd, bundleNames, detailInfos, restoreType, userid); + EXPECT_NE(ret, BError(BError::Codes::OK)); + ret = proxy->AppendBundlesRestoreSessionData(fd, bundleNames, restoreType, userid); + EXPECT_NE(ret, BError(BError::Codes::OK)); + ret = proxy->AppendBundlesIncrementalBackupSessionWithBundleInfos(bundlesToBackup, detailInfos); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + ret = proxy->AppendBundlesBackupSession(bundleNames); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + ret = proxy->AppendBundlesDetailsBackupSession(bundleNames, detailInfos); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + detailInfos.push_back("test"); + ret = proxy->AppendBundlesRestoreSessionDataByDetail(fd, bundleNames, detailInfos, restoreType, userid); + EXPECT_NE(ret, BError(BError::Codes::OK)); + ret = proxy->AppendBundlesRestoreSessionData(fd, bundleNames, restoreType, userid); + EXPECT_NE(ret, BError(BError::Codes::OK)); + ret = proxy->AppendBundlesIncrementalBackupSessionWithBundleInfos(bundlesToBackup, detailInfos); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + ret = proxy->AppendBundlesDetailsBackupSession(bundleNames, detailInfos); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + restoreType = 1; + userid = 1; + ret = proxy->AppendBundlesRestoreSessionDataByDetail(fd, bundleNames, detailInfos, restoreType, userid); + EXPECT_NE(ret, BError(BError::Codes::OK)); + ret = proxy->AppendBundlesRestoreSessionData(fd, bundleNames, restoreType, userid); + EXPECT_NE(ret, BError(BError::Codes::OK)); + ret = proxy->AppendBundlesIncrementalBackupSessionWithBundleInfos(bundlesToBackup, detailInfos); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + GTEST_LOG_(INFO) << "ServiceClientTest-end SUB_service_client_test_1100"; +} + +HWTEST_F(ServiceClientTest, SUB_service_client_test_1200, testing::ext::TestSize.Level1) +{ + GTEST_LOG_(INFO) << "ServiceClientTest-begin SUB_service_client_test_1200"; + proxy = ServiceClient::GetInstance(); + EXPECT_NE(proxy, nullptr); + sptr srptr = nullptr; + ErrCode ret = proxy->InitRestoreSession(srptr); + EXPECT_NE(ret, BError(BError::Codes::OK)); + ret = proxy->InitBackupSession(srptr); + EXPECT_NE(ret, BError(BError::Codes::OK)); + ret = proxy->InitIncrementalBackupSession(srptr); + EXPECT_NE(ret, BError(BError::Codes::OK)); + std::string errMsg = ""; + std::string result = "err"; + ret = proxy->InitRestoreSessionWithErrMsg(srptr, errMsg); + EXPECT_NE(ret, BError(BError::Codes::OK)); + ret = proxy->InitBackupSessionWithErrMsg(srptr, errMsg); + EXPECT_NE(ret, BError(BError::Codes::OK)); + ret = proxy->InitIncrementalBackupSessionWithErrMsg(srptr, errMsg); + EXPECT_NE(ret, BError(BError::Codes::OK)); + BSessionRestore::Callbacks callback; + srptr = sptr(new ServiceReverse(callback)); + ret = proxy->InitRestoreSession(srptr); + EXPECT_EQ(ret, BError(BError::Codes::OK)); + ret = proxy->InitBackupSession(srptr); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_CONFLICT)); + ret = proxy->InitIncrementalBackupSession(srptr); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_CONFLICT)); + + ret = proxy->InitRestoreSessionWithErrMsg(srptr, errMsg); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_CONFLICT)); + EXPECT_EQ(errMsg, ""); + ret = proxy->InitBackupSessionWithErrMsg(srptr, errMsg); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_CONFLICT)); + EXPECT_EQ(errMsg, ""); + ret = proxy->InitIncrementalBackupSessionWithErrMsg(srptr, errMsg); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_CONFLICT)); + EXPECT_EQ(errMsg, ""); + + GTEST_LOG_(INFO) << "ServiceClientTest-end SUB_service_client_test_1200"; +} + +HWTEST_F(ServiceClientTest, SUB_service_client_test_1300, testing::ext::TestSize.Level1) +{ + GTEST_LOG_(INFO) << "ServiceClientTest-begin SUB_service_client_test_1300"; + proxy = ServiceClient::GetInstance(); + EXPECT_NE(proxy, nullptr); + + GTEST_LOG_(INFO) << "ServiceClientTest-end SUB_service_client_test_1300"; +} + +HWTEST_F(ServiceClientTest, SUB_service_client_test_1400, testing::ext::TestSize.Level1) +{ + GTEST_LOG_(INFO) << "ServiceClientTest-begin SUB_service_client_test_1400"; + proxy = ServiceClient::GetInstance(); + EXPECT_NE(proxy, nullptr); + std::string bundleName; + std::string fileName; + bool isExt = true; + bundleName = ""; + ErrCode ret = proxy->UpdateSendRate(bundleName, 0, isExt); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + EXPECT_TRUE(isExt); + bundleName = "test"; + ret = proxy->UpdateSendRate(bundleName, 10, isExt); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + EXPECT_TRUE(isExt); + bundleName = ""; + ret = proxy->AppIncrementalFileReady(bundleName, 0, 0, 0); + EXPECT_NE(ret, BError(BError::Codes::OK)); + bundleName = "test"; + ret = proxy->AppIncrementalFileReady(bundleName, 1, 1, 0); + EXPECT_EQ(ret, BError(BError::BackupErrorCode::E_INVAL)); + fileName = ""; + ret = proxy->AppFileReady(fileName, 0, 0); + EXPECT_NE(ret, BError(BError::Codes::OK)); + fileName = "name"; + ret = proxy->AppFileReady(fileName, -1, 0); + EXPECT_NE(ret, BError(BError::Codes::OK)); + ret = proxy->AppFileReady(fileName, 0, 0); + EXPECT_NE(ret, BError(BError::BackupErrorCode::E_INVAL)); + bundleName = ""; + fileName = ""; + ret = proxy->GetFileHandle(bundleName, fileName); + EXPECT_EQ(ret, BError(BError::Codes::OK)); + EXPECT_EQ(fileName, ""); + bundleName = "test"; + ret = proxy->GetFileHandle(bundleName, fileName); + EXPECT_EQ(ret, BError(BError::Codes::OK)); + EXPECT_EQ(fileName, ""); + GTEST_LOG_(INFO) << "ServiceClientTest-end SUB_service_client_test_1400"; +} +} // namespace OHOS::FileManagement::Backup \ No newline at end of file