1 /* 2 * Copyright (c) 2022-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 <cstddef> 17 #include <cstdint> 18 #include <fcntl.h> 19 #include <gmock/gmock.h> 20 #include <gtest/gtest.h> 21 #include <message_parcel.h> 22 #include <sys/stat.h> 23 #include <sys/types.h> 24 25 #include "b_error/b_error.h" 26 #include "i_service.h" 27 #include "module_ipc/service_stub.h" 28 #include "service_reverse_mock.h" 29 #include "test_manager.h" 30 #include "unique_fd.h" 31 32 namespace OHOS::FileManagement::Backup { 33 using namespace std; 34 using namespace testing; 35 36 namespace { 37 const string BUNDLE_NAME = "com.example.app2backup"; 38 const string FILE_NAME = "1.tar"; 39 } // namespace 40 41 class MockService final : public ServiceStub { 42 public: 43 MOCK_METHOD1(InitRestoreSession, ErrCode(sptr<IServiceReverse> remote)); 44 MOCK_METHOD1(InitBackupSession, ErrCode(sptr<IServiceReverse> remote)); 45 MOCK_METHOD0(Start, ErrCode()); 46 MOCK_METHOD0(GetLocalCapabilities, UniqueFd()); 47 MOCK_METHOD1(PublishFile, ErrCode(const BFileInfo &fileInfo)); 48 MOCK_METHOD2(AppFileReady, ErrCode(const string &fileName, UniqueFd fd)); 49 MOCK_METHOD1(AppDone, ErrCode(ErrCode errCode)); 50 MOCK_METHOD2(GetFileHandle, ErrCode(const string &bundleName, const string &fileName)); 51 MOCK_METHOD4( 52 AppendBundlesRestoreSession, 53 ErrCode(UniqueFd fd, const std::vector<BundleName> &bundleNames, RestoreTypeEnum restoreType, int32_t userId)); 54 MOCK_METHOD1(AppendBundlesBackupSession, ErrCode(const std::vector<BundleName> &bundleNames)); 55 MOCK_METHOD0(Finish, ErrCode()); InvokeGetLocalCapabilities()56 UniqueFd InvokeGetLocalCapabilities() 57 { 58 if (bCapabilities_) { 59 return UniqueFd(-1); 60 } 61 TestManager tm("MockService_GetFd_0100"); 62 std::string filePath = tm.GetRootDirCurTest().append(FILE_NAME); 63 UniqueFd fd(open(filePath.data(), O_RDONLY | O_CREAT, S_IRUSR | S_IWUSR)); 64 bCapabilities_ = true; 65 return fd; 66 } 67 68 private: 69 bool bCapabilities_ = {false}; 70 }; 71 72 class ServiceStubTest : public testing::Test { 73 public: SetUpTestCase(void)74 static void SetUpTestCase(void) {}; TearDownTestCase()75 static void TearDownTestCase() {}; SetUp()76 void SetUp() override {}; TearDown()77 void TearDown() override {}; 78 }; 79 80 /** 81 * @tc.number: SUB_backup_sa_ServiceStub_InitRestoreSession_0100 82 * @tc.name: SUB_backup_sa_ServiceStub_InitRestoreSession_0100 83 * @tc.desc: Test function of InitRestoreSession interface for SUCCESS. 84 * @tc.size: MEDIUM 85 * @tc.type: FUNC 86 * @tc.level Level 0 87 * @tc.require: I6F3GV 88 */ 89 HWTEST_F(ServiceStubTest, SUB_backup_sa_ServiceStub_InitRestoreSession_0100, testing::ext::TestSize.Level0) 90 { 91 GTEST_LOG_(INFO) << "ServiceStubTest-begin SUB_backup_sa_ServiceStub_InitRestoreSession_0100"; 92 try { 93 MockService service; 94 EXPECT_CALL(service, InitRestoreSession(_)).WillOnce(Return(BError(BError::Codes::OK))); 95 MessageParcel data; 96 MessageParcel reply; 97 MessageOption option; 98 99 EXPECT_TRUE(data.WriteInterfaceToken(IService::GetDescriptor())); 100 sptr<ServiceReverseMock> remote = sptr(new ServiceReverseMock()); 101 EXPECT_TRUE(data.WriteRemoteObject(remote->AsObject().GetRefPtr())); 102 103 EXPECT_EQ( 104 BError(BError::Codes::OK), 105 service.OnRemoteRequest(static_cast<uint32_t>(IServiceInterfaceCode::SERVICE_CMD_INIT_RESTORE_SESSION), 106 data, reply, option)); 107 remote = nullptr; 108 } catch (...) { 109 EXPECT_TRUE(false); 110 GTEST_LOG_(INFO) << "ServiceStubTest-an exception occurred by InitRestoreSession."; 111 } 112 GTEST_LOG_(INFO) << "ServiceStubTest-end SUB_backup_sa_ServiceStub_InitRestoreSession_0100"; 113 } 114 115 /** 116 * @tc.number: SUB_backup_sa_ServiceStub_InitBackupSession_0100 117 * @tc.name: SUB_backup_sa_ServiceStub_InitBackupSession_0100 118 * @tc.desc: Test function of InitBackupSession interface for SUCCESS. 119 * @tc.size: MEDIUM 120 * @tc.type: FUNC 121 * @tc.level Level 0 122 * @tc.require: I6F3GV 123 */ 124 HWTEST_F(ServiceStubTest, SUB_backup_sa_ServiceStub_InitBackupSession_0100, testing::ext::TestSize.Level0) 125 { 126 GTEST_LOG_(INFO) << "ServiceStubTest-begin SUB_backup_sa_ServiceStub_InitBackupSession_0100"; 127 try { 128 MockService service; 129 EXPECT_CALL(service, InitBackupSession(_)).WillOnce(Return(BError(BError::Codes::OK))); 130 MessageParcel data; 131 MessageParcel reply; 132 MessageOption option; 133 sptr<ServiceReverseMock> remote = sptr(new ServiceReverseMock()); 134 135 EXPECT_TRUE(data.WriteInterfaceToken(IService::GetDescriptor())); 136 EXPECT_TRUE(data.WriteRemoteObject(remote->AsObject().GetRefPtr())); 137 138 EXPECT_EQ(BError(BError::Codes::OK), 139 service.OnRemoteRequest(static_cast<uint32_t>(IServiceInterfaceCode::SERVICE_CMD_INIT_BACKUP_SESSION), 140 data, reply, option)); 141 remote = nullptr; 142 } catch (...) { 143 EXPECT_TRUE(false); 144 GTEST_LOG_(INFO) << "ServiceStubTest-an exception occurred by InitBackupSession."; 145 } 146 GTEST_LOG_(INFO) << "ServiceStubTest-end SUB_backup_sa_ServiceStub_InitBackupSession_0100"; 147 } 148 149 /** 150 * @tc.number: SUB_backup_sa_ServiceStub_Start_0100 151 * @tc.name: SUB_backup_sa_ServiceStub_Start_0100 152 * @tc.desc: Test function of Start interface for SUCCESS. 153 * @tc.size: MEDIUM 154 * @tc.type: FUNC 155 * @tc.level Level 0 156 * @tc.require: I6F3GV 157 */ 158 HWTEST_F(ServiceStubTest, SUB_backup_sa_ServiceStub_Start_0100, testing::ext::TestSize.Level0) 159 { 160 GTEST_LOG_(INFO) << "ServiceStubTest-begin SUB_backup_sa_ServiceStub_Start_0100"; 161 try { 162 MockService service; 163 EXPECT_CALL(service, Start()).WillOnce(Return(BError(BError::Codes::OK))); 164 MessageParcel data; 165 MessageParcel reply; 166 MessageOption option; 167 168 EXPECT_TRUE(data.WriteInterfaceToken(IService::GetDescriptor())); 169 EXPECT_EQ(BError(BError::Codes::OK), 170 service.OnRemoteRequest(static_cast<uint32_t>(IServiceInterfaceCode::SERVICE_CMD_START), data, reply, 171 option)); 172 } catch (...) { 173 EXPECT_TRUE(false); 174 GTEST_LOG_(INFO) << "ServiceStubTest-an exception occurred by Start."; 175 } 176 GTEST_LOG_(INFO) << "ServiceStubTest-end SUB_backup_sa_ServiceStub_Start_0100"; 177 } 178 179 /** 180 * @tc.number: SUB_backup_sa_ServiceStub_GetLocalCapabilities_0100 181 * @tc.name: SUB_backup_sa_ServiceStub_GetLocalCapabilities_0100 182 * @tc.desc: Test function of GetLocalCapabilities interface for SUCCESS. 183 * @tc.size: MEDIUM 184 * @tc.type: FUNC 185 * @tc.level Level 0 186 * @tc.require: I6F3GV 187 */ 188 HWTEST_F(ServiceStubTest, SUB_backup_sa_ServiceStub_GetLocalCapabilities_0100, testing::ext::TestSize.Level0) 189 { 190 GTEST_LOG_(INFO) << "ServiceStubTest-begin SUB_backup_sa_ServiceStub_GetLocalCapabilities_0100"; 191 try { 192 sptr<MockService> serviceSptr = sptr(new MockService()); 193 EXPECT_CALL(*serviceSptr, GetLocalCapabilities()) 194 .Times(2) 195 .WillOnce(Invoke(serviceSptr.GetRefPtr(), &MockService::InvokeGetLocalCapabilities)) 196 .WillOnce(Invoke(serviceSptr.GetRefPtr(), &MockService::InvokeGetLocalCapabilities)); 197 MessageParcel data; 198 MessageParcel reply; 199 MessageOption option; 200 201 EXPECT_TRUE(data.WriteInterfaceToken(IService::GetDescriptor())); 202 203 EXPECT_EQ( 204 BError(BError::Codes::OK), 205 serviceSptr->OnRemoteRequest( 206 static_cast<uint32_t>(IServiceInterfaceCode::SERVICE_CMD_GET_LOCAL_CAPABILITIES), data, reply, option)); 207 UniqueFd fd(reply.ReadFileDescriptor()); 208 EXPECT_GT(fd, BError(BError::Codes::OK)); 209 GTEST_LOG_(INFO) << "ServiceStubTest-CmdGetLocalCapabilities Brances"; 210 MessageParcel brances; 211 EXPECT_TRUE(brances.WriteInterfaceToken(IService::GetDescriptor())); 212 EXPECT_NE(BError(BError::Codes::OK), 213 serviceSptr->OnRemoteRequest( 214 static_cast<uint32_t>(IServiceInterfaceCode::SERVICE_CMD_GET_LOCAL_CAPABILITIES), brances, reply, 215 option)); 216 serviceSptr = nullptr; 217 } catch (...) { 218 EXPECT_TRUE(false); 219 GTEST_LOG_(INFO) << "ServiceStubTest-an exception occurred by GetLocalCapabilities."; 220 } 221 GTEST_LOG_(INFO) << "ServiceStubTest-end SUB_backup_sa_ServiceStub_GetLocalCapabilities_0100"; 222 } 223 224 /** 225 * @tc.number: SUB_backup_sa_ServiceStub_PublishFile_0100 226 * @tc.name: SUB_backup_sa_ServiceStub_PublishFile_0100 227 * @tc.desc: Test function of PublishFile interface for SUCCESS. 228 * @tc.size: MEDIUM 229 * @tc.type: FUNC 230 * @tc.level Level 0 231 * @tc.require: I6F3GV 232 */ 233 HWTEST_F(ServiceStubTest, SUB_backup_sa_ServiceStub_PublishFile_0100, testing::ext::TestSize.Level0) 234 { 235 GTEST_LOG_(INFO) << "ServiceStubTest-begin SUB_backup_sa_ServiceStub_PublishFile_0100"; 236 try { 237 MockService service; 238 EXPECT_CALL(service, PublishFile(_)).WillOnce(Return(BError(BError::Codes::OK))); 239 MessageParcel data; 240 MessageParcel reply; 241 MessageOption option; 242 243 BFileInfo fileInfo {BUNDLE_NAME, FILE_NAME, -1}; 244 EXPECT_TRUE(data.WriteInterfaceToken(IService::GetDescriptor())); 245 EXPECT_TRUE(data.WriteParcelable(&fileInfo)); 246 EXPECT_EQ(BError(BError::Codes::OK), 247 service.OnRemoteRequest(static_cast<uint32_t>(IServiceInterfaceCode::SERVICE_CMD_PUBLISH_FILE), data, 248 reply, option)); 249 } catch (...) { 250 EXPECT_TRUE(false); 251 GTEST_LOG_(INFO) << "ServiceStubTest-an exception occurred by PublishFile."; 252 } 253 GTEST_LOG_(INFO) << "ServiceStubTest-end SUB_backup_sa_ServiceStub_PublishFile_0100"; 254 } 255 256 /** 257 * @tc.number: SUB_backup_sa_ServiceStub_AppFileReady_0100 258 * @tc.name: SUB_backup_sa_ServiceStub_AppFileReady_0100 259 * @tc.desc: Test function of AppFileReady interface for SUCCESS. 260 * @tc.size: MEDIUM 261 * @tc.type: FUNC 262 * @tc.level Level 0 263 * @tc.require: I6F3GV 264 */ 265 HWTEST_F(ServiceStubTest, SUB_backup_sa_ServiceStub_AppFileReady_0100, testing::ext::TestSize.Level0) 266 { 267 GTEST_LOG_(INFO) << "ServiceStubTest-begin SUB_backup_sa_ServiceStub_AppFileReady_0100"; 268 try { 269 MockService service; 270 EXPECT_CALL(service, AppFileReady(_, _)).WillOnce(Return(BError(BError::Codes::OK))); 271 MessageParcel data; 272 MessageParcel reply; 273 MessageOption option; 274 275 TestManager tm("ServiceStub_GetFd_0200"); 276 std::string filePath = tm.GetRootDirCurTest().append(FILE_NAME); 277 UniqueFd fd(open(filePath.data(), O_RDONLY | O_CREAT, S_IRUSR | S_IWUSR)); 278 279 EXPECT_TRUE(data.WriteInterfaceToken(IService::GetDescriptor())); 280 EXPECT_TRUE(data.WriteString(FILE_NAME)); 281 EXPECT_TRUE(data.WriteFileDescriptor(fd)); 282 EXPECT_EQ(BError(BError::Codes::OK), 283 service.OnRemoteRequest(static_cast<uint32_t>(IServiceInterfaceCode::SERVICE_CMD_APP_FILE_READY), 284 data, reply, option)); 285 GTEST_LOG_(INFO) << "ServiceStubTest-begin-CmdAppFileReady Brances"; 286 MessageParcel brances; 287 EXPECT_TRUE(brances.WriteInterfaceToken(IService::GetDescriptor())); 288 EXPECT_TRUE(brances.WriteString(FILE_NAME)); 289 EXPECT_NE(BError(BError::Codes::OK), 290 service.OnRemoteRequest(static_cast<uint32_t>(IServiceInterfaceCode::SERVICE_CMD_APP_FILE_READY), 291 brances, reply, option)); 292 } catch (...) { 293 EXPECT_TRUE(false); 294 GTEST_LOG_(INFO) << "ServiceStubTest-an exception occurred by AppFileReady."; 295 } 296 GTEST_LOG_(INFO) << "ServiceStubTest-end SUB_backup_sa_ServiceStub_AppFileReady_0100"; 297 } 298 299 /** 300 * @tc.number: SUB_backup_sa_ServiceStub_AppDone_0100 301 * @tc.name: SUB_backup_sa_ServiceStub_AppDone_0100 302 * @tc.desc: Test function of AppDone interface for SUCCESS. 303 * @tc.size: MEDIUM 304 * @tc.type: FUNC 305 * @tc.level Level 0 306 * @tc.require: I6F3GV 307 */ 308 HWTEST_F(ServiceStubTest, SUB_backup_sa_ServiceStub_AppDone_0100, testing::ext::TestSize.Level0) 309 { 310 GTEST_LOG_(INFO) << "ServiceStubTest-begin SUB_backup_sa_ServiceStub_AppDone_0100"; 311 try { 312 MockService service; 313 EXPECT_CALL(service, AppDone(_)).WillOnce(Return(BError(BError::Codes::OK))); 314 MessageParcel data; 315 MessageParcel reply; 316 MessageOption option; 317 318 EXPECT_TRUE(data.WriteInterfaceToken(IService::GetDescriptor())); 319 EXPECT_TRUE(data.WriteInt32(BError(BError::Codes::OK))); 320 EXPECT_EQ(BError(BError::Codes::OK), 321 service.OnRemoteRequest(static_cast<uint32_t>(IServiceInterfaceCode::SERVICE_CMD_APP_DONE), data, 322 reply, option)); 323 } catch (...) { 324 EXPECT_TRUE(false); 325 GTEST_LOG_(INFO) << "ServiceStubTest-an exception occurred by AppDone."; 326 } 327 GTEST_LOG_(INFO) << "ServiceStubTest-end SUB_backup_sa_ServiceStub_AppDone_0100"; 328 } 329 330 /** 331 * @tc.number: SUB_backup_sa_ServiceStub_GetFileHandle_0100 332 * @tc.name: SUB_backup_sa_ServiceStub_GetFileHandle_0100 333 * @tc.desc: Test function of GetFileHandle interface for SUCCESS. 334 * @tc.size: MEDIUM 335 * @tc.type: FUNC 336 * @tc.level Level 0 337 * @tc.require: I6F3GV 338 */ 339 HWTEST_F(ServiceStubTest, SUB_backup_sa_ServiceStub_GetFileHandle_0100, testing::ext::TestSize.Level0) 340 { 341 GTEST_LOG_(INFO) << "ServiceStubTest-begin SUB_backup_sa_ServiceStub_GetFileHandle_0100"; 342 try { 343 MockService service; 344 EXPECT_CALL(service, GetFileHandle(_, _)).WillOnce(Return(BError(BError::Codes::OK))); 345 MessageParcel data; 346 MessageParcel reply; 347 MessageOption option; 348 option.SetFlags(MessageOption::TF_ASYNC); 349 350 EXPECT_TRUE(data.WriteInterfaceToken(IService::GetDescriptor())); 351 EXPECT_TRUE(data.WriteString(BUNDLE_NAME)); 352 EXPECT_TRUE(data.WriteString(FILE_NAME)); 353 EXPECT_EQ(BError(BError::Codes::OK), 354 service.OnRemoteRequest(static_cast<uint32_t>(IServiceInterfaceCode::SERVICE_CMD_GET_FILE_NAME), data, 355 reply, option)); 356 EXPECT_NE(BError(BError::Codes::OK), service.OnRemoteRequest(3333, data, reply, option)); 357 } catch (...) { 358 EXPECT_TRUE(false); 359 GTEST_LOG_(INFO) << "ServiceStubTest-an exception occurred by GetFileHandle."; 360 } 361 GTEST_LOG_(INFO) << "ServiceStubTest-end SUB_backup_sa_ServiceStub_GetFileHandle_0100"; 362 } 363 364 /** 365 * @tc.number: SUB_backup_sa_ServiceStub_AppendBundlesRestoreSession_0100 366 * @tc.name: SUB_backup_sa_ServiceStub_AppendBundlesRestoreSession_0100 367 * @tc.desc: Test function of AppendBundlesRestoreSession interface for SUCCESS. 368 * @tc.size: MEDIUM 369 * @tc.type: FUNC 370 * @tc.level Level 0 371 * @tc.require: I6URNZ 372 */ 373 HWTEST_F(ServiceStubTest, SUB_backup_sa_ServiceStub_AppendBundlesRestoreSession_0100, testing::ext::TestSize.Level0) 374 { 375 GTEST_LOG_(INFO) << "ServiceStubTest-begin SUB_backup_sa_ServiceStub_AppendBundlesRestoreSession_0100"; 376 try { 377 MockService service; 378 EXPECT_CALL(service, AppendBundlesRestoreSession(_, _, _, _)).WillOnce(Return(BError(BError::Codes::OK))); 379 MessageParcel data; 380 MessageParcel reply; 381 MessageOption option; 382 383 vector<BundleName> bundleNames; 384 bundleNames.push_back(BUNDLE_NAME); 385 TestManager tm("ServiceStub_GetFd_0300"); 386 std::string filePath = tm.GetRootDirCurTest().append(FILE_NAME); 387 UniqueFd fd(open(filePath.data(), O_RDONLY | O_CREAT, S_IRUSR | S_IWUSR)); 388 389 EXPECT_TRUE(data.WriteInterfaceToken(IService::GetDescriptor())); 390 EXPECT_TRUE(data.WriteFileDescriptor(fd)); 391 EXPECT_TRUE(data.WriteStringVector(bundleNames)); 392 EXPECT_TRUE(data.WriteInt32(0)); 393 EXPECT_TRUE(data.WriteInt32(-1)); 394 EXPECT_EQ(BError(BError::Codes::OK), 395 service.OnRemoteRequest( 396 static_cast<uint32_t>(IServiceInterfaceCode::SERVICE_CMD_APPEND_BUNDLES_RESTORE_SESSION), data, 397 reply, option)); 398 } catch (...) { 399 EXPECT_TRUE(false); 400 GTEST_LOG_(INFO) << "ServiceStubTest-an exception occurred by AppendBundlesRestoreSession."; 401 } 402 GTEST_LOG_(INFO) << "ServiceStubTest-end SUB_backup_sa_ServiceStub_AppendBundlesRestoreSession_0100"; 403 } 404 405 /** 406 * @tc.number: SUB_backup_sa_ServiceStub_AppendBundlesBackupSession_0100 407 * @tc.name: SUB_backup_sa_ServiceStub_AppendBundlesBackupSession_0100 408 * @tc.desc: Test function of AppendBundlesBackupSession interface for SUCCESS. 409 * @tc.size: MEDIUM 410 * @tc.type: FUNC 411 * @tc.level Level 0 412 * @tc.require: I6URNZ 413 */ 414 HWTEST_F(ServiceStubTest, SUB_backup_sa_ServiceStub_AppendBundlesBackupSession_0100, testing::ext::TestSize.Level0) 415 { 416 GTEST_LOG_(INFO) << "ServiceStubTest-begin SUB_backup_sa_ServiceStub_AppendBundlesBackupSession_0100"; 417 try { 418 MockService service; 419 EXPECT_CALL(service, AppendBundlesBackupSession(_)).WillOnce(Return(BError(BError::Codes::OK))); 420 MessageParcel data; 421 MessageParcel reply; 422 MessageOption option; 423 424 vector<BundleName> bundleNames; 425 bundleNames.push_back(BUNDLE_NAME); 426 427 EXPECT_TRUE(data.WriteInterfaceToken(IService::GetDescriptor())); 428 EXPECT_TRUE(data.WriteStringVector(bundleNames)); 429 EXPECT_EQ(BError(BError::Codes::OK), 430 service.OnRemoteRequest( 431 static_cast<uint32_t>(IServiceInterfaceCode::SERVICE_CMD_APPEND_BUNDLES_BACKUP_SESSION), data, 432 reply, option)); 433 } catch (...) { 434 EXPECT_TRUE(false); 435 GTEST_LOG_(INFO) << "ServiceStubTest-an exception occurred by AppendBundlesBackupSession."; 436 } 437 GTEST_LOG_(INFO) << "ServiceStubTest-end SUB_backup_sa_ServiceStub_AppendBundlesBackupSession_0100"; 438 } 439 440 /** 441 * @tc.number: SUB_backup_sa_ServiceStub_Finish_0100 442 * @tc.name: SUB_backup_sa_ServiceStub_Finish_0100 443 * @tc.desc: Test function of AppendBundlesBackupSession interface for SUCCESS. 444 * @tc.size: MEDIUM 445 * @tc.type: FUNC 446 * @tc.level Level 0 447 * @tc.require: I6URNZ 448 */ 449 HWTEST_F(ServiceStubTest, SUB_backup_sa_ServiceStub_Finish_0100, testing::ext::TestSize.Level0) 450 { 451 GTEST_LOG_(INFO) << "ServiceStubTest-begin SUB_backup_sa_ServiceStub_Finish_0100"; 452 try { 453 MockService service; 454 EXPECT_CALL(service, Finish()).WillOnce(Return(BError(BError::Codes::OK))); 455 MessageParcel data; 456 MessageParcel reply; 457 MessageOption option; 458 459 EXPECT_TRUE(data.WriteInterfaceToken(IService::GetDescriptor())); 460 EXPECT_EQ(BError(BError::Codes::OK), 461 service.OnRemoteRequest(static_cast<uint32_t>(IServiceInterfaceCode::SERVICE_CMD_FINISH), data, reply, 462 option)); 463 } catch (...) { 464 EXPECT_TRUE(false); 465 GTEST_LOG_(INFO) << "ServiceStubTest-an exception occurred by Finish."; 466 } 467 GTEST_LOG_(INFO) << "ServiceStubTest-end SUB_backup_sa_ServiceStub_Finish_0100"; 468 } 469 } // namespace OHOS::FileManagement::Backup