From e8d6a9ff493e6837ff80feaa00eeb082bfa81685 Mon Sep 17 00:00:00 2001 From: "yang.yang" Date: Tue, 5 Aug 2025 16:05:49 +0800 Subject: [PATCH] add tdd interface cover Signed-off-by: yang.yang Change-Id: Ic05df7553949c7341d29b56cb5caf401592a31d1 --- .../app_mgr_service_inner_seventh_test.cpp | 122 +++++++++--------- .../unittest/runtime_test/js_runtime_test.cpp | 1 + 2 files changed, 62 insertions(+), 61 deletions(-) diff --git a/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp b/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp index fd194f183b..103ea96ebb 100644 --- a/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp +++ b/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp @@ -1012,11 +1012,11 @@ HWTEST_F(AppMgrServiceInnerSeventhTest, GetRenderProcesses_001, TestSize.Level1) std::shared_ptr appRecord = std::make_shared(info1, 0, temp); pid_t hostPid = 1; std::string renderParam = "111"; - FdGuard ipcFd(1); - FdGuard sharedFd(1); - FdGuard crashFd(1); + FdGuard ipcFd(-1); + FdGuard sharedFd(-1); + FdGuard crashFd(-1); - std::shared_ptr renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam, + std::shared_ptr renderRecord = std::make_shared(hostPid, renderParam, std::move(ipcFd), std::move(sharedFd), std::move(crashFd), appRecord); renderRecord->SetPid(1); appRecord->renderRecordMap_.insert(std::pair>(1, renderRecord)); @@ -2214,14 +2214,14 @@ HWTEST_F(AppMgrServiceInnerSeventhTest, StartRenderProcess_001, TestSize.Level1) pid_t hostPid = 1; std::string renderParam = "111"; - FdGuard ipcFd(1); - FdGuard sharedFd(1); - FdGuard crashFd(1); + FdGuard ipcFd(-1); + FdGuard sharedFd(-1); + FdGuard crashFd(-1); pid_t renderPid = 1; bool isGPU = false; auto ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, std::move(ipcFd), std::move(sharedFd), std::move(crashFd), renderPid, isGPU); - EXPECT_EQ(ret, ERR_INVALID_OPERATION); + EXPECT_EQ(ret, ERR_INVALID_VALUE); TAG_LOGI(AAFwkTag::TEST, "StartRenderProcess_001 end"); } @@ -2239,9 +2239,9 @@ HWTEST_F(AppMgrServiceInnerSeventhTest, StartRenderProcess_002, TestSize.Level1) pid_t hostPid = 1; std::string renderParam = "111"; - FdGuard ipcFd(1); - FdGuard sharedFd(1); - FdGuard crashFd(1); + FdGuard ipcFd(-1); + FdGuard sharedFd(-1); + FdGuard crashFd(-1); pid_t renderPid = 1; bool isGPU = true; auto ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, std::move(ipcFd), @@ -2265,9 +2265,9 @@ HWTEST_F(AppMgrServiceInnerSeventhTest, StartRenderProcess_003, TestSize.Level1) pid_t hostPid = 1; std::string renderParam = "111"; - FdGuard ipcFd(1); - FdGuard sharedFd(1); - FdGuard crashFd(1); + FdGuard ipcFd(-1); + FdGuard sharedFd(-1); + FdGuard crashFd(-1); pid_t renderPid = 1; bool isGPU = true; auto ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, std::move(ipcFd), @@ -2294,9 +2294,9 @@ HWTEST_F(AppMgrServiceInnerSeventhTest, StartRenderProcess_004, TestSize.Level1) pid_t hostPid = 1; std::string renderParam = "111"; - FdGuard ipcFd(1); - FdGuard sharedFd(1); - FdGuard crashFd(1); + FdGuard ipcFd(-1); + FdGuard sharedFd(-1); + FdGuard crashFd(-1); pid_t renderPid = 1; bool isGPU = false; auto ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, std::move(ipcFd), @@ -2320,12 +2320,12 @@ HWTEST_F(AppMgrServiceInnerSeventhTest, StartRenderProcess_005, TestSize.Level1) pid_t hostPid = 1; std::string renderParam = "111"; - FdGuard ipcFd(1); - FdGuard sharedFd(1); - FdGuard crashFd(1); + FdGuard ipcFd(-1); + FdGuard sharedFd(-1); + FdGuard crashFd(-1); pid_t renderPid = 1; bool isGPU = false; - std::shared_ptr renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam, + std::shared_ptr renderRecord = std::make_shared(hostPid, renderParam, std::move(ipcFd), std::move(sharedFd), std::move(crashFd), AAFwk::MyStatus::GetInstance().getAppRunningRecordByPid_); AAFwk::MyStatus::GetInstance().getAppRunningRecordByPid_->renderRecordMap_.insert(std::pair renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam, + std::shared_ptr renderRecord = std::make_shared(hostPid, renderParam, std::move(ipcFd), std::move(sharedFd), std::move(crashFd), AAFwk::MyStatus::GetInstance().getAppRunningRecordByPid_); AAFwk::MyStatus::GetInstance().getAppRunningRecordByPid_->renderRecordMap_.insert(std::pair renderScheduler = new MyRenderScheduler(); - std::shared_ptr renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam, + std::shared_ptr renderRecord = std::make_shared(hostPid, renderParam, std::move(ipcFd), std::move(sharedFd), std::move(crashFd), AAFwk::MyStatus::GetInstance().getAppRunningRecordByPid_); renderRecord->renderScheduler_ = renderScheduler; @@ -2497,10 +2497,10 @@ HWTEST_F(AppMgrServiceInnerSeventhTest, AttachRenderProcess_005, TestSize.Level1 std::make_shared(nullptr, 0, ""); pid_t hostPid = 1; std::string renderParam = "111"; - FdGuard ipcFd(1); - FdGuard sharedFd(1); - FdGuard crashFd(1); - std::shared_ptr renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam, + FdGuard ipcFd(-1); + FdGuard sharedFd(-1); + FdGuard crashFd(-1); + std::shared_ptr renderRecord = std::make_shared(hostPid, renderParam, std::move(ipcFd), std::move(sharedFd), std::move(crashFd), AAFwk::MyStatus::GetInstance().getAppRunningRecordByRenderPid_); AAFwk::MyStatus::GetInstance().getAppRunningRecordByRenderPid_->SetBrowserHost(MyRemoteObject::GetInstance()); @@ -2528,10 +2528,10 @@ HWTEST_F(AppMgrServiceInnerSeventhTest, AttachRenderProcess_006, TestSize.Level1 std::make_shared(nullptr, 0, ""); pid_t hostPid = 1; std::string renderParam = "111"; - FdGuard ipcFd(1); - FdGuard sharedFd(1); - FdGuard crashFd(1); - std::shared_ptr renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam, + FdGuard ipcFd(-1); + FdGuard sharedFd(-1); + FdGuard crashFd(-1); + std::shared_ptr renderRecord = std::make_shared(hostPid, renderParam, std::move(ipcFd), std::move(sharedFd), std::move(crashFd), AAFwk::MyStatus::GetInstance().getAppRunningRecordByRenderPid_); AAFwk::MyStatus::GetInstance().getAppRunningRecordByRenderPid_->SetBrowserHost(nullptr); @@ -2653,10 +2653,10 @@ HWTEST_F(AppMgrServiceInnerSeventhTest, StartRenderProcessImpl_001, TestSize.Lev std::shared_ptr appRecord = std::make_shared(nullptr, 0, ""); pid_t hostPid = 1; std::string renderParam = "111"; - FdGuard ipcFd(1); - FdGuard sharedFd(1); - FdGuard crashFd(1); - std::shared_ptr renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam, + FdGuard ipcFd(-1); + FdGuard sharedFd(-1); + FdGuard crashFd(-1); + std::shared_ptr renderRecord = std::make_shared(hostPid, renderParam, std::move(ipcFd), std::move(sharedFd), std::move(crashFd), appRecord); pid_t pid = 1; auto ret = appMgrServiceInner->StartRenderProcessImpl(renderRecord, appRecord, pid, false); @@ -2683,10 +2683,10 @@ HWTEST_F(AppMgrServiceInnerSeventhTest, StartRenderProcessImpl_002, TestSize.Lev std::shared_ptr appRecord = std::make_shared(nullptr, 0, ""); pid_t hostPid = 1; std::string renderParam = "111"; - FdGuard ipcFd(1); - FdGuard sharedFd(1); - FdGuard crashFd(1); - std::shared_ptr renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam, + FdGuard ipcFd(-1); + FdGuard sharedFd(-1); + FdGuard crashFd(-1); + std::shared_ptr renderRecord = std::make_shared(hostPid, renderParam, std::move(ipcFd), std::move(sharedFd), std::move(crashFd), appRecord); pid_t pid = 1; auto ret = appMgrServiceInner->StartRenderProcessImpl(renderRecord, appRecord, pid, false); @@ -2711,10 +2711,10 @@ HWTEST_F(AppMgrServiceInnerSeventhTest, StartRenderProcessImpl_003, TestSize.Lev std::shared_ptr appRecord = std::make_shared(nullptr, 0, ""); pid_t hostPid = 1; std::string renderParam = "111"; - FdGuard ipcFd(1); - FdGuard sharedFd(1); - FdGuard crashFd(1); - std::shared_ptr renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam, + FdGuard ipcFd(-1); + FdGuard sharedFd(-1); + FdGuard crashFd(-1); + std::shared_ptr renderRecord = std::make_shared(hostPid, renderParam, std::move(ipcFd), std::move(sharedFd), std::move(crashFd), appRecord); pid_t pid = 1; auto ret = appMgrServiceInner->StartRenderProcessImpl(renderRecord, appRecord, pid, false); @@ -2739,10 +2739,10 @@ HWTEST_F(AppMgrServiceInnerSeventhTest, StartRenderProcessImpl_004, TestSize.Lev std::shared_ptr appRecord = std::make_shared(nullptr, 0, ""); pid_t hostPid = 1; std::string renderParam = "111"; - FdGuard ipcFd(1); - FdGuard sharedFd(1); - FdGuard crashFd(1); - std::shared_ptr renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam, + FdGuard ipcFd(-1); + FdGuard sharedFd(-1); + FdGuard crashFd(-1); + std::shared_ptr renderRecord = std::make_shared(hostPid, renderParam, std::move(ipcFd), std::move(sharedFd), std::move(crashFd), appRecord); pid_t pid = 1; auto ret = appMgrServiceInner->StartRenderProcessImpl(renderRecord, appRecord, pid, true); @@ -2769,10 +2769,10 @@ HWTEST_F(AppMgrServiceInnerSeventhTest, SetRenderStartMsg_001, TestSize.Level1) std::shared_ptr appRecord = std::make_shared(nullptr, 0, ""); pid_t hostPid = 1; std::string renderParam = "111"; - FdGuard ipcFd(1); - FdGuard sharedFd(1); - FdGuard crashFd(1); - std::shared_ptr renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam, + FdGuard ipcFd(-1); + FdGuard sharedFd(-1); + FdGuard crashFd(-1); + std::shared_ptr renderRecord = std::make_shared(hostPid, renderParam, std::move(ipcFd), std::move(sharedFd), std::move(crashFd), appRecord); int32_t renderUid = 1; bool isGPU = true; @@ -2800,10 +2800,10 @@ HWTEST_F(AppMgrServiceInnerSeventhTest, SetRenderStartMsg_002, TestSize.Level1) std::shared_ptr appRecord = std::make_shared(nullptr, 0, ""); pid_t hostPid = 1; std::string renderParam = "111"; - FdGuard ipcFd(1); - FdGuard sharedFd(1); - FdGuard crashFd(1); - std::shared_ptr renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam, + FdGuard ipcFd(-1); + FdGuard sharedFd(-1); + FdGuard crashFd(-1); + std::shared_ptr renderRecord = std::make_shared(hostPid, renderParam, std::move(ipcFd), std::move(sharedFd), std::move(crashFd), appRecord); int32_t renderUid = 1; bool isGPU = true; diff --git a/test/unittest/runtime_test/js_runtime_test.cpp b/test/unittest/runtime_test/js_runtime_test.cpp index 4c5b12ba94..9a55bd2736 100755 --- a/test/unittest/runtime_test/js_runtime_test.cpp +++ b/test/unittest/runtime_test/js_runtime_test.cpp @@ -1418,6 +1418,7 @@ HWTEST_F(JsRuntimeTest, JsRuntimePreloadModuleandDoCleanWorkAfterStageCleaned_01 bool useCommonTrunk = true; jsRuntime->PreloadModule(moduleName, srcPath, hapPath, isEsMode, useCommonTrunk); EXPECT_EQ(jsRuntime->preloadList_.size(), 1); + jsRuntime->PreloadModule(moduleName, hapPath, isEsMode, useCommonTrunk); jsRuntime.reset(); TAG_LOGI(AAFwkTag::TEST, "PreloadModule_0100 end"); }