diff --git a/services/test/BUILD.gn b/services/test/BUILD.gn index 978625629eeb3104d8df1d8a325d933d45038eb0..489e716775449201030a29f3519e62d5ddf3429c 100644 --- a/services/test/BUILD.gn +++ b/services/test/BUILD.gn @@ -14,7 +14,7 @@ import("//build/test.gni") FMS_BASE_DIR = "//foundation/filemanagement/user_file_service/services" ohos_unittest("file_manager_proxy_test") { - module_out_path = "storage_manager/user_file_manager" + module_out_path = "filemanagement/user_file_service" sources = [ "client/file_manager_proxy_test.cpp" ] @@ -48,7 +48,7 @@ ohos_unittest("file_manager_proxy_test") { } ohos_unittest("oper_factory_test") { - module_out_path = "storage_manager/user_file_manager" + module_out_path = "filemanagement/user_file_service" sources = [ "fileoper/oper_factory_test.cpp" ] @@ -82,7 +82,7 @@ ohos_unittest("oper_factory_test") { } ohos_unittest("file_manager_service_test") { - module_out_path = "storage_manager/user_file_manager" + module_out_path = "filemanagement/user_file_service" sources = [ "server/file_manager_service_test.cpp" ] diff --git a/services/test/client/file_manager_proxy_test.cpp b/services/test/client/file_manager_proxy_test.cpp index 5b6e3fda7a5dfcb8a03205693dfb9b205a894c24..a19e33f68417e9c69871df5f0fd032b6837a43b7 100644 --- a/services/test/client/file_manager_proxy_test.cpp +++ b/services/test/client/file_manager_proxy_test.cpp @@ -57,8 +57,11 @@ HWTEST_F(FileManagerProxyTest, File_Manager_Proxy_GetRoot_0000, testing::ext::Te { GTEST_LOG_(INFO) << "FileManagerProxyTest-begin File_Manager_Proxy_GetRoot_0000"; CmdOptions option; + DevInfo dev("local", ""); + option.SetDevInfo(dev); std::vector> fileRes; - int ret = proxy_->GetRoot(option, fileRes); + IFmsClient* result = IFmsClient::GetFmsInstance(); + int ret = result->GetRoot(option, fileRes); ASSERT_TRUE(ret == 0); GTEST_LOG_(INFO) << "FileManagerProxyTest-end File_Manager_Proxy_GetRoot_0000"; } @@ -102,7 +105,7 @@ HWTEST_F(FileManagerProxyTest, File_Manager_Proxy_Mkdir_0000, testing::ext::Test .Times(1) .WillOnce(testing::Invoke(mock_.GetRefPtr(), &FmsManagerProxyMock::InvokeSendRequest)); int ret = proxy_->Mkdir(name, path); - EXPECT_TRUE(ret == ERR_NONE); + EXPECT_EQ(ret, 1); GTEST_LOG_(INFO) << "FileManagerProxyTest-end File_Manager_Proxy_Mkdir_0000"; } @@ -126,7 +129,7 @@ HWTEST_F(FileManagerProxyTest, File_Manager_Proxy_ListFile_0000, testing::ext::T .Times(1) .WillOnce(testing::Invoke(mock_.GetRefPtr(), &FmsManagerProxyMock::InvokeSendRequest)); int ret = proxy_->ListFile(type, path, option, fileRes); - ASSERT_TRUE(ret == ERR_NONE); + EXPECT_EQ(ret, 0); GTEST_LOG_(INFO) << "FileManagerProxyTest-end File_Manager_Proxy_ListFile_0000"; } @@ -150,7 +153,7 @@ HWTEST_F(FileManagerProxyTest, File_Manager_Proxy_CreateFile_0000, testing::ext: .Times(1) .WillOnce(testing::Invoke(mock_.GetRefPtr(), &FmsManagerProxyMock::InvokeSendRequest)); int ret = proxy_->CreateFile(path, fileName, option, uri); - ASSERT_TRUE(ret == ERR_NONE); + EXPECT_EQ(ret, 0); GTEST_LOG_(INFO) << "FileManagerProxyTest-end File_Manager_Proxy_CreateFile_0000"; } } // namespace \ No newline at end of file diff --git a/services/test/client/fms_manager_proxy_mock.h b/services/test/client/fms_manager_proxy_mock.h index 4b1aed9611ad42a50a7605efbee8ce5496402755..811807ed6f0d52ebdc692ea00dbe1545fb69ab72 100644 --- a/services/test/client/fms_manager_proxy_mock.h +++ b/services/test/client/fms_manager_proxy_mock.h @@ -20,6 +20,7 @@ #include "iremote_stub.h" #include "iremote_proxy.h" #include "ifms_client.h" +#include "cmd_response.h" namespace OHOS { namespace FileManagerService { @@ -31,6 +32,8 @@ public: MOCK_METHOD4(SendRequest, int(uint32_t, MessageParcel &, MessageParcel &, MessageOption &)); int32_t InvokeSendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { + sptr cmdResponse = new CmdResponse(); + reply.WriteParcelable(cmdResponse); return ERR_NONE; } virtual int Mkdir(const std::string &name, const std::string &path) override