mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-30 02:41:51 +00:00
commit
1dba75251a
@ -17,6 +17,7 @@
|
||||
|
||||
#include "ability_manager_errors.h"
|
||||
#include "ability_manager_radar.h"
|
||||
#include "fd_guard.h"
|
||||
#include "hilog_tag_wrapper.h"
|
||||
#include "hitrace_meter.h"
|
||||
#include "status_bar_delegate_interface.h"
|
||||
@ -980,7 +981,7 @@ int32_t AbilityManagerStub::TerminateUIServiceExtensionAbilityInner(MessageParce
|
||||
if (data.ReadBool()) {
|
||||
token = data.ReadRemoteObject();
|
||||
}
|
||||
|
||||
|
||||
int32_t result = TerminateUIServiceExtensionAbility(token);
|
||||
reply.WriteInt32(result);
|
||||
return NO_ERROR;
|
||||
@ -3699,8 +3700,8 @@ int32_t AbilityManagerStub::OpenFileInner(MessageParcel &data, MessageParcel &re
|
||||
return ERR_DEAD_OBJECT;
|
||||
}
|
||||
auto flag = data.ReadInt32();
|
||||
int fd = OpenFile(*uri, flag);
|
||||
reply.WriteFileDescriptor(fd);
|
||||
FdGuard fdGuard(OpenFile(*uri, flag));
|
||||
reply.WriteFileDescriptor(fdGuard.Get());
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "cpp/mutex.h"
|
||||
#include "event_report.h"
|
||||
#include "fault_data.h"
|
||||
#include "fd_guard.h"
|
||||
#include "hisysevent.h"
|
||||
#include "iapp_state_callback.h"
|
||||
#include "iapplication_state_observer.h"
|
||||
@ -81,6 +82,7 @@ class FocusChangeInfo;
|
||||
}
|
||||
namespace AppExecFwk {
|
||||
using OHOS::AAFwk::Want;
|
||||
using AAFwk::FdGuard;
|
||||
class WindowFocusChangedListener;
|
||||
class WindowVisibilityChangedListener;
|
||||
class WindowPidVisibilityChangedListener;
|
||||
@ -830,8 +832,8 @@ public:
|
||||
|
||||
virtual int32_t StartRenderProcess(const pid_t hostPid,
|
||||
const std::string &renderParam,
|
||||
int32_t ipcFd, int32_t sharedFd,
|
||||
int32_t crashFd, pid_t &renderPid, bool isGPU = false);
|
||||
FdGuard &&ipcFd, FdGuard &&sharedFd,
|
||||
FdGuard &&crashFd, pid_t &renderPid, bool isGPU = false);
|
||||
|
||||
virtual void AttachRenderProcess(const pid_t pid, const sptr<IRenderScheduler> &scheduler);
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "app_record_id.h"
|
||||
#include "child_process_record.h"
|
||||
#include "fault_data.h"
|
||||
#include "fd_guard.h"
|
||||
#include "profile.h"
|
||||
#include "priority_object.h"
|
||||
#include "app_lifecycle_deal.h"
|
||||
@ -50,6 +51,7 @@ namespace Rosen {
|
||||
class WindowVisibilityInfo;
|
||||
}
|
||||
namespace AppExecFwk {
|
||||
using AAFwk::FdGuard;
|
||||
class AbilityRunningRecord;
|
||||
class AppMgrServiceInner;
|
||||
class AppRunningRecord;
|
||||
@ -71,15 +73,15 @@ private:
|
||||
*/
|
||||
class RenderRecord {
|
||||
public:
|
||||
RenderRecord(pid_t hostPid, const std::string &renderParam, int32_t ipcFd,
|
||||
int32_t sharedFd, int32_t crashFd,
|
||||
RenderRecord(pid_t hostPid, const std::string &renderParam,
|
||||
FdGuard &&ipcFd, FdGuard &&sharedFd, FdGuard &&crashFd,
|
||||
const std::shared_ptr<AppRunningRecord> &host);
|
||||
|
||||
virtual ~RenderRecord();
|
||||
|
||||
static std::shared_ptr<RenderRecord>
|
||||
CreateRenderRecord(pid_t hostPid, const std::string &renderParam,
|
||||
int32_t ipcFd, int32_t sharedFd, int32_t crashFd,
|
||||
FdGuard &&ipcFd, FdGuard &&sharedFd, FdGuard &&crashFd,
|
||||
const std::shared_ptr<AppRunningRecord> &host);
|
||||
|
||||
void SetPid(pid_t pid);
|
||||
@ -116,9 +118,9 @@ private:
|
||||
std::string hostBundleName_;
|
||||
std::string renderParam_;
|
||||
std::string processName_;
|
||||
int32_t ipcFd_ = 0;
|
||||
int32_t sharedFd_ = 0;
|
||||
int32_t crashFd_ = 0;
|
||||
FdGuard ipcFd_;
|
||||
FdGuard sharedFd_;
|
||||
FdGuard crashFd_;
|
||||
int32_t state_ = 0;
|
||||
ProcessType processType_ = ProcessType::RENDER;
|
||||
std::weak_ptr<AppRunningRecord> host_; // nweb host
|
||||
|
@ -78,7 +78,6 @@ private:
|
||||
std::string processName_;
|
||||
std::string srcEntry_;
|
||||
std::string entryFunc_;
|
||||
std::map<std::string, int32_t> fds_;
|
||||
std::weak_ptr<AppRunningRecord> hostRecord_;
|
||||
sptr<IChildScheduler> scheduler_ = nullptr;
|
||||
sptr<AppDeathRecipient> deathRecipient_ = nullptr;
|
||||
|
@ -983,14 +983,8 @@ int32_t AppMgrService::StartRenderProcess(const std::string &renderParam, int32_
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
auto result = appMgrServiceInner_->StartRenderProcess(IPCSkeleton::GetCallingPid(),
|
||||
renderParam, ipcFd, sharedFd, crashFd, renderPid, isGPU);
|
||||
if (result == ERR_OK) {
|
||||
ipcFdGuard.Release();
|
||||
sharedFdGuard.Release();
|
||||
crashFdGuard.Release();
|
||||
}
|
||||
return result;
|
||||
return appMgrServiceInner_->StartRenderProcess(IPCSkeleton::GetCallingPid(), renderParam,
|
||||
std::move(ipcFdGuard), std::move(sharedFdGuard), std::move(crashFdGuard), renderPid, isGPU);
|
||||
}
|
||||
|
||||
void AppMgrService::AttachRenderProcess(const sptr<IRemoteObject> &scheduler)
|
||||
@ -1396,13 +1390,7 @@ int32_t AppMgrService::StartChildProcess(pid_t &childPid, const ChildProcessRequ
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
auto result = appMgrServiceInner_->StartChildProcess(IPCSkeleton::GetCallingPid(), childPid, request);
|
||||
if (result == ERR_OK) {
|
||||
for (auto &fd : fds) {
|
||||
fd.Release();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return appMgrServiceInner_->StartChildProcess(IPCSkeleton::GetCallingPid(), childPid, request);
|
||||
}
|
||||
|
||||
int32_t AppMgrService::GetChildProcessInfoForSelf(ChildProcessInfo &info)
|
||||
|
@ -5189,13 +5189,13 @@ int AppMgrServiceInner::PreStartNWebSpawnProcess(const pid_t hostPid)
|
||||
}
|
||||
|
||||
int AppMgrServiceInner::StartRenderProcess(const pid_t hostPid, const std::string &renderParam,
|
||||
int32_t ipcFd, int32_t sharedFd, int32_t crashFd, pid_t &renderPid, bool isGPU)
|
||||
FdGuard &&ipcFd, FdGuard &&sharedFd, FdGuard &&crashFd, pid_t &renderPid, bool isGPU)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::APPMGR, "hostPid:%{public}d", hostPid);
|
||||
if (hostPid <= 0 || renderParam.empty() || ipcFd <= 0 || sharedFd <= 0 || crashFd <= 0) {
|
||||
if (hostPid <= 0 || renderParam.empty() || ipcFd.Get() <= 0 || sharedFd.Get() <= 0 || crashFd.Get() <= 0) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "invalid param: hostPid:%{public}d renderParam:%{private}s "
|
||||
"ipcFd:%{public}d crashFd:%{public}d sharedFd:%{public}d",
|
||||
hostPid, renderParam.c_str(), ipcFd, crashFd, sharedFd);
|
||||
hostPid, renderParam.c_str(), ipcFd.Get(), crashFd.Get(), sharedFd.Get());
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
CHECK_POINTER_AND_RETURN_VALUE(appRunningManager_, ERR_INVALID_VALUE);
|
||||
@ -5232,7 +5232,8 @@ int AppMgrServiceInner::StartRenderProcess(const pid_t hostPid, const std::strin
|
||||
return ERR_REACHING_MAXIMUM_RENDER_PROCESS_LIMITATION;
|
||||
}
|
||||
|
||||
auto renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam, ipcFd, sharedFd, crashFd, appRecord);
|
||||
auto renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam,
|
||||
std::move(ipcFd), std::move(sharedFd), std::move(crashFd), appRecord);
|
||||
if (!renderRecord) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "create renderRecord fail, hostPid:%{public}d", hostPid);
|
||||
return ERR_INVALID_VALUE;
|
||||
|
@ -48,30 +48,26 @@ constexpr const char *EVENT_KEY_SUPPORT_STATE = "SUPPORT_STATE";
|
||||
int64_t AppRunningRecord::appEventId_ = 0;
|
||||
|
||||
RenderRecord::RenderRecord(pid_t hostPid, const std::string &renderParam,
|
||||
int32_t ipcFd, int32_t sharedFd, int32_t crashFd,
|
||||
FdGuard &&ipcFd, FdGuard &&sharedFd, FdGuard &&crashFd,
|
||||
const std::shared_ptr<AppRunningRecord> &host)
|
||||
: hostPid_(hostPid), renderParam_(renderParam), ipcFd_(ipcFd),
|
||||
sharedFd_(sharedFd), crashFd_(crashFd), host_(host) {}
|
||||
: hostPid_(hostPid), renderParam_(renderParam), ipcFd_(std::move(ipcFd)),
|
||||
sharedFd_(std::move(sharedFd)), crashFd_(std::move(crashFd)), host_(host) {}
|
||||
|
||||
RenderRecord::~RenderRecord()
|
||||
{
|
||||
close(sharedFd_);
|
||||
close(ipcFd_);
|
||||
close(crashFd_);
|
||||
}
|
||||
{}
|
||||
|
||||
std::shared_ptr<RenderRecord> RenderRecord::CreateRenderRecord(
|
||||
pid_t hostPid, const std::string &renderParam, int32_t ipcFd,
|
||||
int32_t sharedFd, int32_t crashFd,
|
||||
pid_t hostPid, const std::string &renderParam,
|
||||
FdGuard &&ipcFd, FdGuard &&sharedFd, FdGuard &&crashFd,
|
||||
const std::shared_ptr<AppRunningRecord> &host)
|
||||
{
|
||||
if (hostPid <= 0 || renderParam.empty() || ipcFd <= 0 || sharedFd <= 0 ||
|
||||
crashFd <= 0 || !host) {
|
||||
if (hostPid <= 0 || renderParam.empty() || ipcFd.Get() <= 0 || sharedFd.Get() <= 0 ||
|
||||
crashFd.Get() <= 0 || !host) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto renderRecord = std::make_shared<RenderRecord>(
|
||||
hostPid, renderParam, ipcFd, sharedFd, crashFd, host);
|
||||
hostPid, renderParam, std::move(ipcFd), std::move(sharedFd), std::move(crashFd), host);
|
||||
renderRecord->SetHostUid(host->GetUid());
|
||||
renderRecord->SetHostBundleName(host->GetBundleName());
|
||||
renderRecord->SetProcessName(host->GetProcessName());
|
||||
@ -140,17 +136,17 @@ std::string RenderRecord::GetRenderParam() const
|
||||
|
||||
int32_t RenderRecord::GetIpcFd() const
|
||||
{
|
||||
return ipcFd_;
|
||||
return ipcFd_.Get();
|
||||
}
|
||||
|
||||
int32_t RenderRecord::GetSharedFd() const
|
||||
{
|
||||
return sharedFd_;
|
||||
return sharedFd_.Get();
|
||||
}
|
||||
|
||||
int32_t RenderRecord::GetCrashFd() const
|
||||
{
|
||||
return crashFd_;
|
||||
return crashFd_.Get();
|
||||
}
|
||||
|
||||
ProcessType RenderRecord::GetProcessType() const
|
||||
|
@ -27,7 +27,6 @@ ChildProcessRecord::ChildProcessRecord(pid_t hostPid, const ChildProcessRequest
|
||||
hostRecord_(hostRecord), isStartWithDebug_(request.isStartWithDebug)
|
||||
{
|
||||
srcEntry_ = request.srcEntry;
|
||||
fds_ = request.args.fds;
|
||||
if (childProcessType_ == CHILD_PROCESS_TYPE_NATIVE_ARGS) {
|
||||
auto pos = request.srcEntry.rfind(":");
|
||||
if (pos != std::string::npos) {
|
||||
@ -50,9 +49,6 @@ ChildProcessRecord::ChildProcessRecord(pid_t hostPid, const std::string &libName
|
||||
ChildProcessRecord::~ChildProcessRecord()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "called");
|
||||
for (const auto &item : fds_) {
|
||||
close(item.second);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<ChildProcessRecord> ChildProcessRecord::CreateChildProcessRecord(pid_t hostPid,
|
||||
@ -194,7 +190,7 @@ void ChildProcessRecord::MakeProcessName(const std::shared_ptr<AppRunningRecord>
|
||||
if (childProcessType_ == CHILD_PROCESS_TYPE_NATIVE || childProcessType_ == CHILD_PROCESS_TYPE_NATIVE_ARGS) {
|
||||
processName_.append("Native_");
|
||||
}
|
||||
|
||||
|
||||
processName_.append(filename);
|
||||
}
|
||||
processName_.append(std::to_string(childProcessCount_));
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
int32_t GetFd() const
|
||||
int32_t Get() const
|
||||
{
|
||||
return fd_;
|
||||
}
|
||||
|
@ -449,8 +449,8 @@ HWTEST_F(AmsAppRunningRecordTest, GetRenderRecordByPid_002, TestSize.Level1)
|
||||
int32_t sharedFd = 1;
|
||||
int32_t crashFd = 1;
|
||||
std::shared_ptr<AppRunningRecord> host;
|
||||
std::shared_ptr<RenderRecord> renderRecord =
|
||||
RenderRecord::CreateRenderRecord(hostPid, renderParam, ipcFd, sharedFd, crashFd, host);
|
||||
std::shared_ptr<RenderRecord> renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam,
|
||||
FdGuard(ipcFd), FdGuard(sharedFd), FdGuard(crashFd), host);
|
||||
EXPECT_NE(appRunningRecord, nullptr);
|
||||
}
|
||||
|
||||
@ -1927,7 +1927,7 @@ HWTEST_F(AmsAppRunningRecordTest, NewRenderRecord_001, TestSize.Level1)
|
||||
int32_t crashFd = 0;
|
||||
std::shared_ptr<AppRunningRecord> host;
|
||||
RenderRecord *renderRecord =
|
||||
new RenderRecord(hostPid, renderParam, ipcFd, sharedFd, crashFd, host);
|
||||
new RenderRecord(hostPid, renderParam, FdGuard(ipcFd), FdGuard(sharedFd), FdGuard(crashFd), host);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
delete renderRecord;
|
||||
}
|
||||
@ -1960,17 +1960,21 @@ HWTEST_F(AmsAppRunningRecordTest, CreateRenderRecord_001, TestSize.Level1)
|
||||
std::string processName = "processName";
|
||||
std::shared_ptr<AppRunningRecord> host1 = GetTestAppRunningRecord();
|
||||
|
||||
std::shared_ptr<RenderRecord> renderRecord =
|
||||
RenderRecord::CreateRenderRecord(hostPid, renderParam, ipcFd, sharedFd, crashFd, host);
|
||||
std::shared_ptr<RenderRecord> renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam,
|
||||
FdGuard(ipcFd), FdGuard(sharedFd), FdGuard(crashFd), host);
|
||||
EXPECT_EQ(renderRecord, nullptr);
|
||||
|
||||
renderRecord = RenderRecord::CreateRenderRecord(hostPid1, renderParam, ipcFd, sharedFd, crashFd, host);
|
||||
renderRecord = RenderRecord::CreateRenderRecord(hostPid1, renderParam,
|
||||
FdGuard(ipcFd), FdGuard(sharedFd), FdGuard(crashFd), host);
|
||||
EXPECT_EQ(renderRecord, nullptr);
|
||||
renderRecord = RenderRecord::CreateRenderRecord(hostPid1, renderParam1, ipcFd, sharedFd, crashFd, host);
|
||||
renderRecord = RenderRecord::CreateRenderRecord(hostPid1, renderParam1,
|
||||
FdGuard(ipcFd), FdGuard(sharedFd), FdGuard(crashFd), host);
|
||||
EXPECT_EQ(renderRecord, nullptr);
|
||||
renderRecord = RenderRecord::CreateRenderRecord(hostPid1, renderParam1, ipcFd1, sharedFd, crashFd, host);
|
||||
renderRecord = RenderRecord::CreateRenderRecord(hostPid1, renderParam1,
|
||||
FdGuard(ipcFd1), FdGuard(sharedFd), FdGuard(crashFd), host);
|
||||
EXPECT_EQ(renderRecord, nullptr);
|
||||
renderRecord = RenderRecord::CreateRenderRecord(hostPid1, renderParam1, ipcFd1, sharedFd1, crashFd, host);
|
||||
renderRecord = RenderRecord::CreateRenderRecord(hostPid1, renderParam1,
|
||||
FdGuard(ipcFd1), FdGuard(sharedFd1), FdGuard(crashFd), host);
|
||||
EXPECT_EQ(renderRecord, nullptr);
|
||||
}
|
||||
|
||||
@ -1988,7 +1992,7 @@ HWTEST_F(AmsAppRunningRecordTest, SetPid_001, TestSize.Level1)
|
||||
std::string renderParam = "test_render_param";
|
||||
std::shared_ptr<AppRunningRecord> host;
|
||||
RenderRecord* renderRecord =
|
||||
new RenderRecord(hostPid, renderParam, 0, 0, 0, host);
|
||||
new RenderRecord(hostPid, renderParam, FdGuard(0), FdGuard(0), FdGuard(0), host);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
pid_t pid = 0;
|
||||
renderRecord->SetPid(pid);
|
||||
@ -2009,7 +2013,7 @@ HWTEST_F(AmsAppRunningRecordTest, GetHostPid_001, TestSize.Level1)
|
||||
std::string renderParam = "test_render_param";
|
||||
std::shared_ptr<AppRunningRecord> host;
|
||||
RenderRecord* renderRecord =
|
||||
new RenderRecord(hostPid, renderParam, 1, 0, 0, host);
|
||||
new RenderRecord(hostPid, renderParam, FdGuard(1), FdGuard(0), FdGuard(0), host);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
EXPECT_EQ(renderRecord->GetHostPid(), hostPid);
|
||||
}
|
||||
@ -2028,7 +2032,7 @@ HWTEST_F(AmsAppRunningRecordTest, SetUid_001, TestSize.Level1)
|
||||
std::string renderParam = "test_render_param";
|
||||
std::shared_ptr<AppRunningRecord> host;
|
||||
RenderRecord* renderRecord =
|
||||
new RenderRecord(hostPid, renderParam, 0, 0, 0, host);
|
||||
new RenderRecord(hostPid, renderParam, FdGuard(0), FdGuard(0), FdGuard(0), host);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
int32_t uid = 1;
|
||||
renderRecord->SetUid(uid);
|
||||
@ -2049,7 +2053,7 @@ HWTEST_F(AmsAppRunningRecordTest, SetHostUid_001, TestSize.Level1)
|
||||
std::string renderParam = "test_render_param";
|
||||
std::shared_ptr<AppRunningRecord> host;
|
||||
RenderRecord* renderRecord =
|
||||
new RenderRecord(hostPid, renderParam, 0, 0, 0, host);
|
||||
new RenderRecord(hostPid, renderParam, FdGuard(0), FdGuard(0), FdGuard(0), host);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
int32_t uid = 1;
|
||||
renderRecord->SetHostUid(uid);
|
||||
@ -2070,7 +2074,7 @@ HWTEST_F(AmsAppRunningRecordTest, SetHostBundleName_001, TestSize.Level1)
|
||||
std::string renderParam = "test_render_param";
|
||||
std::shared_ptr<AppRunningRecord> host;
|
||||
RenderRecord* renderRecord =
|
||||
new RenderRecord(hostPid, renderParam, 0, 0, 0, host);
|
||||
new RenderRecord(hostPid, renderParam, FdGuard(0), FdGuard(0), FdGuard(0), host);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
std::string hostBundleName = "testhostBundleName";
|
||||
renderRecord->SetHostBundleName(hostBundleName);
|
||||
@ -2091,7 +2095,7 @@ HWTEST_F(AmsAppRunningRecordTest, SetProcessName_001, TestSize.Level1)
|
||||
std::string renderParam = "test_render_param";
|
||||
std::shared_ptr<AppRunningRecord> host;
|
||||
RenderRecord* renderRecord =
|
||||
new RenderRecord(hostPid, renderParam, 0, 0, 0, host);
|
||||
new RenderRecord(hostPid, renderParam, FdGuard(0), FdGuard(0), FdGuard(0), host);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
std::string hostProcessName = "testhostProcessName";
|
||||
renderRecord->SetProcessName(hostProcessName);
|
||||
@ -2112,7 +2116,7 @@ HWTEST_F(AmsAppRunningRecordTest, GetRenderParam_001, TestSize.Level1)
|
||||
std::string renderParam = "test_render_param";
|
||||
std::shared_ptr<AppRunningRecord> host;
|
||||
RenderRecord* renderRecord =
|
||||
new RenderRecord(hostPid, renderParam, 0, 0, 0, host);
|
||||
new RenderRecord(hostPid, renderParam, FdGuard(0), FdGuard(0), FdGuard(0), host);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
EXPECT_EQ(renderRecord->GetRenderParam(), renderParam);
|
||||
}
|
||||
@ -2131,7 +2135,7 @@ HWTEST_F(AmsAppRunningRecordTest, GetIpcFd_001, TestSize.Level1)
|
||||
std::string renderParam = "test_render_param";
|
||||
std::shared_ptr<AppRunningRecord> host;
|
||||
RenderRecord* renderRecord =
|
||||
new RenderRecord(hostPid, renderParam, 1, 0, 0, host);
|
||||
new RenderRecord(hostPid, renderParam, FdGuard(1), FdGuard(0), FdGuard(0), host);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
EXPECT_EQ(renderRecord->GetIpcFd(), 1);
|
||||
}
|
||||
@ -2150,7 +2154,7 @@ HWTEST_F(AmsAppRunningRecordTest, GetSharedFd_001, TestSize.Level1)
|
||||
std::string renderParam = "test_render_param";
|
||||
std::shared_ptr<AppRunningRecord> host;
|
||||
RenderRecord* renderRecord =
|
||||
new RenderRecord(hostPid, renderParam, 0, 1, 0, host);
|
||||
new RenderRecord(hostPid, renderParam, FdGuard(0), FdGuard(1), FdGuard(0), host);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
EXPECT_EQ(renderRecord->GetSharedFd(), 1);
|
||||
}
|
||||
@ -2169,7 +2173,7 @@ HWTEST_F(AmsAppRunningRecordTest, GetHostRecord_001, TestSize.Level1)
|
||||
std::string renderParam = "test_render_param";
|
||||
std::shared_ptr<AppRunningRecord> host;
|
||||
RenderRecord* renderRecord =
|
||||
new RenderRecord(hostPid, renderParam, 0, 1, 0, host);
|
||||
new RenderRecord(hostPid, renderParam, FdGuard(0), FdGuard(1), FdGuard(0), host);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
EXPECT_EQ(renderRecord->GetHostRecord(), host);
|
||||
}
|
||||
@ -2188,7 +2192,7 @@ HWTEST_F(AmsAppRunningRecordTest, SetScheduler_001, TestSize.Level1)
|
||||
std::string renderParam = "test_render_param";
|
||||
std::shared_ptr<AppRunningRecord> host;
|
||||
RenderRecord* renderRecord =
|
||||
new RenderRecord(hostPid, renderParam, 0, 0, 0, host);
|
||||
new RenderRecord(hostPid, renderParam, FdGuard(0), FdGuard(0), FdGuard(0), host);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
sptr<IRenderScheduler> scheduler;
|
||||
renderRecord->SetScheduler(scheduler);
|
||||
@ -2209,7 +2213,7 @@ HWTEST_F(AmsAppRunningRecordTest, SetDeathRecipient_001, TestSize.Level1)
|
||||
std::string renderParam = "test_render_param";
|
||||
std::shared_ptr<AppRunningRecord> host;
|
||||
RenderRecord* renderRecord =
|
||||
new RenderRecord(hostPid, renderParam, 0, 0, 0, host);
|
||||
new RenderRecord(hostPid, renderParam, FdGuard(0), FdGuard(0), FdGuard(0), host);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
sptr<AppDeathRecipient> recipient;
|
||||
renderRecord->SetDeathRecipient(recipient);
|
||||
@ -2230,7 +2234,7 @@ HWTEST_F(AmsAppRunningRecordTest, RegisterDeathRecipient_001, TestSize.Level1)
|
||||
std::string renderParam = "test_render_param";
|
||||
std::shared_ptr<AppRunningRecord> host;
|
||||
RenderRecord* renderRecord =
|
||||
new RenderRecord(hostPid, renderParam, 0, 0, 0, host);
|
||||
new RenderRecord(hostPid, renderParam, FdGuard(0), FdGuard(0), FdGuard(0), host);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
renderRecord->RegisterDeathRecipient();
|
||||
|
||||
|
@ -104,7 +104,7 @@ HWTEST_F(AppMgrEventTest, SendCreateAtomicServiceProcessEvent_0300, TestSize.Lev
|
||||
auto appRecord = std::make_shared<AppRunningRecord>(appInfo, recordId, processName);
|
||||
EXPECT_NE(appRecord, nullptr);
|
||||
appRecord->SetCallerUid(-1);
|
||||
|
||||
|
||||
auto callerAppInfo = std::make_shared<ApplicationInfo>();
|
||||
EXPECT_NE(callerAppInfo, nullptr);
|
||||
callerAppInfo->bundleName = "testCallerBundleName";
|
||||
@ -179,7 +179,7 @@ HWTEST_F(AppMgrEventTest, SendProcessStartEvent_0300, TestSize.Level1)
|
||||
auto appRecord = std::make_shared<AppRunningRecord>(appInfo, recordId, processName);
|
||||
EXPECT_NE(appRecord, nullptr);
|
||||
appRecord->SetCallerUid(-1);
|
||||
|
||||
|
||||
auto callerAppInfo = std::make_shared<ApplicationInfo>();
|
||||
EXPECT_NE(callerAppInfo, nullptr);
|
||||
callerAppInfo->bundleName = "testCallerBundleName";
|
||||
@ -188,7 +188,7 @@ HWTEST_F(AppMgrEventTest, SendProcessStartEvent_0300, TestSize.Level1)
|
||||
int32_t callerRecordId = 2;
|
||||
auto callerAppRecord = std::make_shared<AppRunningRecord>(callerAppInfo, callerRecordId, callerProcessName);
|
||||
EXPECT_NE(callerAppRecord, nullptr);
|
||||
|
||||
|
||||
AAFwk::EventInfo eventInfo;
|
||||
bool ret = AppMgrEventUtil::SendProcessStartEvent(callerAppRecord, appRecord, eventInfo);
|
||||
EXPECT_EQ(ret, true);
|
||||
@ -252,7 +252,7 @@ HWTEST_F(AppMgrEventTest, SendProcessStartFailedEvent_0300, TestSize.Level1)
|
||||
auto appRecord = std::make_shared<AppRunningRecord>(appInfo, recordId, processName);
|
||||
EXPECT_NE(appRecord, nullptr);
|
||||
appRecord->SetCallerUid(-1);
|
||||
|
||||
|
||||
auto callerAppInfo = std::make_shared<ApplicationInfo>();
|
||||
EXPECT_NE(callerAppInfo, nullptr);
|
||||
callerAppInfo->bundleName = "testCallerBundleName";
|
||||
@ -261,7 +261,7 @@ HWTEST_F(AppMgrEventTest, SendProcessStartFailedEvent_0300, TestSize.Level1)
|
||||
int32_t callerRecordId = 2;
|
||||
auto callerAppRecord = std::make_shared<AppRunningRecord>(callerAppInfo, callerRecordId, callerProcessName);
|
||||
EXPECT_NE(callerAppRecord, nullptr);
|
||||
|
||||
|
||||
AAFwk::EventInfo eventInfo;
|
||||
bool ret = AppMgrEventUtil::SendProcessStartFailedEvent(callerAppRecord, appRecord, eventInfo);
|
||||
EXPECT_EQ(ret, true);
|
||||
@ -291,8 +291,8 @@ HWTEST_F(AppMgrEventTest, SendRenderProcessStartFailedEvent_0100, TestSize.Level
|
||||
int32_t ipcFd = 1;
|
||||
int32_t sharedFd = 1;
|
||||
int32_t crashFd = 1;
|
||||
std::shared_ptr<RenderRecord> renderRecord =
|
||||
RenderRecord::CreateRenderRecord(hostPid, renderParam, ipcFd, sharedFd, crashFd, hostRecord);
|
||||
std::shared_ptr<RenderRecord> renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam,
|
||||
FdGuard(ipcFd), FdGuard(sharedFd), FdGuard(crashFd), hostRecord);
|
||||
|
||||
bool ret = AppMgrEventUtil::SendRenderProcessStartFailedEvent(renderRecord,
|
||||
ProcessStartFailedReason::APPSPAWN_FAILED, 123);
|
||||
|
@ -678,7 +678,7 @@ HWTEST_F(AppMgrServiceInnerSecondTest, AppMgrServiceInnerSecondTest_UpdateRender
|
||||
ret = appMgrServiceInner->UpdateRenderState(INT_MAX, 0);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
|
||||
auto renderRecord = std::make_shared<RenderRecord>(1, "", -1, -1, -1, appRecord);
|
||||
auto renderRecord = std::make_shared<RenderRecord>(1, "", FdGuard(-1), FdGuard(-1), FdGuard(-1), appRecord);
|
||||
renderRecord->SetPid(100); // 100 means pid
|
||||
appRecord->AddRenderRecord(renderRecord);
|
||||
ret = appMgrServiceInner->UpdateRenderState(100, 1); // 100 means pid
|
||||
@ -1668,7 +1668,7 @@ HWTEST_F(AppMgrServiceInnerSecondTest, GetRunningMultiInstanceKeys_001, TestSize
|
||||
instanceKeys.push_back(appRecord->GetInstanceKey());
|
||||
appMgrServiceInner.GetRunningMultiInstanceKeys(appRecord, instanceKeys);
|
||||
EXPECT_FALSE(instanceKeys.size() == 1);
|
||||
|
||||
|
||||
appRecord->priorityObject_ = nullptr;
|
||||
appMgrServiceInner.GetRunningMultiInstanceKeys(appRecord, instanceKeys);
|
||||
EXPECT_FALSE(instanceKeys.size() == 1 && instanceKeys[0] == appRecord->GetInstanceKey());
|
||||
@ -1719,7 +1719,7 @@ HWTEST_F(AppMgrServiceInnerSecondTest, UpdateAbilityState_001, TestSize.Level1)
|
||||
EXPECT_EQ(abilityRecord1->GetAbilityInfo(), nullptr);
|
||||
|
||||
appMgrServiceInner->UpdateAbilityState(token1, AbilityState::ABILITY_STATE_CREATE);
|
||||
|
||||
|
||||
abilityRecord1 =
|
||||
appMgrServiceInner->GetAppRunningRecordByAbilityToken(token1)->GetAbilityRunningRecordByToken(token1);
|
||||
abilityRecord1->SetState(AbilityState::ABILITY_STATE_TERMINATED);
|
||||
@ -1756,7 +1756,7 @@ HWTEST_F(AppMgrServiceInnerSecondTest, KillProcessByAbilityToken_001, TestSize.L
|
||||
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want);
|
||||
EXPECT_NE(appRecord, nullptr);
|
||||
appMgrServiceInner->KillProcessByAbilityToken(token);
|
||||
|
||||
|
||||
appRecord->GetPriorityObject()->SetPid(1);
|
||||
appRecord->SetKeepAliveEnableState(true);
|
||||
appRecord->SetEmptyKeepAliveAppState(true);
|
||||
@ -1792,7 +1792,7 @@ HWTEST_F(AppMgrServiceInnerSecondTest, SetOverlayInfo_001, TestSize.Level1)
|
||||
appMgrServiceInner->SetOverlayInfo("testBundleName", 1, startMsg);
|
||||
EXPECT_EQ(startMsg.flags, 0);
|
||||
EXPECT_EQ(startMsg.overlayInfo, "");
|
||||
|
||||
|
||||
TAG_LOGI(AAFwkTag::TEST, "SetOverlayInfo_001 end");
|
||||
}
|
||||
|
||||
@ -1873,15 +1873,15 @@ HWTEST_F(AppMgrServiceInnerSecondTest, ProcessAppDebug_0010, TestSize.Level1)
|
||||
std::shared_ptr<AppRunningRecord> appRecord;
|
||||
auto appMgrServiceInner = std::make_shared<AppMgrServiceInner>();
|
||||
EXPECT_NE(appMgrServiceInner, nullptr);
|
||||
|
||||
|
||||
appMgrServiceInner->appDebugManager_ = nullptr;
|
||||
appMgrServiceInner->ProcessAppDebug(nullptr, true);
|
||||
EXPECT_EQ(appMgrServiceInner->appDebugManager_, nullptr);
|
||||
|
||||
|
||||
appMgrServiceInner->appDebugManager_ = std::make_shared<AppDebugManager>();
|
||||
appMgrServiceInner->ProcessAppDebug(nullptr, true);
|
||||
EXPECT_NE(appMgrServiceInner->appDebugManager_, nullptr);
|
||||
|
||||
|
||||
appMgrServiceInner->appDebugManager_ = nullptr;
|
||||
BundleInfo bundleInfo;
|
||||
HapModuleInfo hapModuleInfo;
|
||||
@ -1916,7 +1916,7 @@ HWTEST_F(AppMgrServiceInnerSecondTest, ProcessAppDebug_0010, TestSize.Level1)
|
||||
appRecord->SetDebugApp(true);
|
||||
appMgrServiceInner->ProcessAppDebug(appRecord, false);
|
||||
EXPECT_EQ(appRecord->IsDebugApp(), true);
|
||||
|
||||
|
||||
TAG_LOGI(AAFwkTag::TEST, "ProcessAppDebug_0010 end");
|
||||
}
|
||||
|
||||
@ -1931,7 +1931,7 @@ HWTEST_F(AppMgrServiceInnerSecondTest, FinishUserTest_0010, TestSize.Level1)
|
||||
TAG_LOGI(AAFwkTag::TEST, "FinishUserTest_0010 start");
|
||||
auto appMgrServiceInner = std::make_shared<AppMgrServiceInner>();
|
||||
EXPECT_NE(appMgrServiceInner, nullptr);
|
||||
|
||||
|
||||
pid_t pid = 0;
|
||||
appMgrServiceInner->FinishUserTest("", 0, "", pid);
|
||||
|
||||
@ -1961,7 +1961,7 @@ HWTEST_F(AppMgrServiceInnerSecondTest, FinishUserTest_0010, TestSize.Level1)
|
||||
|
||||
appMgrServiceInner->remoteClientManager_ = nullptr;
|
||||
appMgrServiceInner->FinishUserTest(msg, 0, bundleName, pid);
|
||||
|
||||
|
||||
TAG_LOGI(AAFwkTag::TEST, "FinishUserTest_0010 end");
|
||||
}
|
||||
|
||||
@ -2153,7 +2153,7 @@ HWTEST_F(AppMgrServiceInnerSecondTest, AppMgrServiceInnerSecondTest_KillChildPro
|
||||
appRecord->AddChildProcessRecord(childPid, childProcessRecord);
|
||||
appMgrServiceInner->KillChildProcess(appRecord);
|
||||
EXPECT_EQ(appMgrServiceInner->killedProcessMap_.size(), 1);
|
||||
|
||||
|
||||
TAG_LOGI(AAFwkTag::TEST, "AppMgrServiceInnerSecondTest_KillChildProcess_0100 end");
|
||||
}
|
||||
|
||||
@ -2282,8 +2282,8 @@ HWTEST_F(AppMgrServiceInnerSecondTest, AppMgrServiceInnerSecondTest_KillRenderPr
|
||||
auto appRunningRecord = std::make_shared<AppRunningRecord>(appInfo, recordId, TEST_PROCESS_NAME);
|
||||
EXPECT_NE(appRunningRecord, nullptr);
|
||||
|
||||
std::shared_ptr<RenderRecord> renderRecord =
|
||||
RenderRecord::CreateRenderRecord(hostPid, renderParam, ipcFd, sharedFd, crashFd, hostRecord);
|
||||
std::shared_ptr<RenderRecord> renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam,
|
||||
FdGuard(ipcFd), FdGuard(sharedFd), FdGuard(crashFd), hostRecord);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
|
||||
renderRecord->SetPid(10);
|
||||
|
@ -910,8 +910,8 @@ HWTEST_F(AppMgrServiceInnerTest, StartRenderProcessImpl_001, TestSize.Level0)
|
||||
int32_t ipcFd = 1;
|
||||
int32_t sharedFd = 1;
|
||||
int32_t crashFd = 1;
|
||||
std::shared_ptr<RenderRecord> renderRecord =
|
||||
RenderRecord::CreateRenderRecord(hostPid, renderParam, ipcFd, sharedFd, crashFd, appRecord);
|
||||
std::shared_ptr<RenderRecord> renderRecord = RenderRecord::CreateRenderRecord(hostPid, renderParam,
|
||||
FdGuard(ipcFd), FdGuard(sharedFd), FdGuard(crashFd), appRecord);
|
||||
EXPECT_NE(renderRecord, nullptr);
|
||||
pid_t renderPid = 1;
|
||||
appMgrServiceInner->StartRenderProcessImpl(nullptr, nullptr, renderPid);
|
||||
|
@ -2930,37 +2930,37 @@ HWTEST_F(AppMgrServiceInnerTest, StartRenderProcess_001, TestSize.Level0)
|
||||
pid_t hostPid = 0;
|
||||
std::string renderParam = "test_renderParam";
|
||||
pid_t renderPid = 0;
|
||||
int ret = appMgrServiceInner->StartRenderProcess(hostPid, "", 0, 0, 0, renderPid);
|
||||
int ret = appMgrServiceInner->StartRenderProcess(hostPid, "", FdGuard(0), FdGuard(0), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, "", 0, 0, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, "", FdGuard(0), FdGuard(0), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, "", 0, 1, 0, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, "", FdGuard(0), FdGuard(1), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, "", 0, 1, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, "", FdGuard(0), FdGuard(1), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, "", 1, 0, 0, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, "", FdGuard(1), FdGuard(0), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, "", 1, 0, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, "", FdGuard(1), FdGuard(0), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, "", 1, 1, 0, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, "", FdGuard(1), FdGuard(1), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, "", 1, 1, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, "", FdGuard(1), FdGuard(1), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, 0, 0, 0, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, FdGuard(0), FdGuard(0), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, 0, 0, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, FdGuard(0), FdGuard(0), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, 0, 1, 0, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, FdGuard(0), FdGuard(1), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, 0, 1, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, FdGuard(0), FdGuard(1), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, 1, 0, 0, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, FdGuard(1), FdGuard(0), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, 1, 0, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, FdGuard(1), FdGuard(0), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, 1, 1, 0, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, FdGuard(1), FdGuard(1), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, 1, 1, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid, renderParam, FdGuard(1), FdGuard(1), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
|
||||
TAG_LOGI(AAFwkTag::TEST, "StartRenderProcess_001 end");
|
||||
@ -2981,40 +2981,40 @@ HWTEST_F(AppMgrServiceInnerTest, StartRenderProcess_002, TestSize.Level0)
|
||||
pid_t hostPid1 = 1;
|
||||
std::string renderParam = "test_renderParam";
|
||||
pid_t renderPid = 0;
|
||||
int ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", 0, 0, 0, renderPid);
|
||||
int ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", FdGuard(0), FdGuard(0), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", 0, 0, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", FdGuard(0), FdGuard(0), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", 0, 1, 0, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", FdGuard(0), FdGuard(1), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", 0, 1, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", FdGuard(0), FdGuard(1), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", 1, 0, 0, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", FdGuard(1), FdGuard(0), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", 1, 0, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", FdGuard(1), FdGuard(0), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", 1, 1, 0, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", FdGuard(1), FdGuard(1), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", 1, 1, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, "", FdGuard(1), FdGuard(1), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, 0, 0, 0, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, FdGuard(0), FdGuard(0), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, 0, 0, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, FdGuard(0), FdGuard(0), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, 0, 1, 0, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, FdGuard(0), FdGuard(1), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, 0, 1, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, FdGuard(0), FdGuard(1), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, 1, 0, 0, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, FdGuard(1), FdGuard(0), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, 1, 0, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, FdGuard(1), FdGuard(0), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, 1, 1, 0, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, FdGuard(1), FdGuard(1), FdGuard(0), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, 1, 1, 1, renderPid);
|
||||
ret = appMgrServiceInner->StartRenderProcess(hostPid1, renderParam, FdGuard(1), FdGuard(1), FdGuard(1), renderPid);
|
||||
EXPECT_EQ(ret, ERR_INVALID_VALUE);
|
||||
TAG_LOGI(AAFwkTag::TEST, "StartRenderProcess_002 end");
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ HWTEST_F(AppRunningManagerSecondTest, AppRunningManager_GetAppRunningRecordByRen
|
||||
appInfo_->bundleName = BUNDLE_NAME;
|
||||
auto record1 = appRunningManager->CreateAppRunningRecord(appInfo_, PROCESS_NAME, bundleInfo, "");
|
||||
auto record2 = appRunningManager->CreateAppRunningRecord(appInfo_, PROCESS_NAME, bundleInfo, "");
|
||||
auto renderRecord = std::make_shared<RenderRecord>(0, "", -1, -1, -1, record2);
|
||||
auto renderRecord = std::make_shared<RenderRecord>(0, "", FdGuard(-1), FdGuard(-1), FdGuard(-1), record2);
|
||||
record2->AddRenderRecord(renderRecord);
|
||||
auto ret = appRunningManager->GetAppRunningRecordByRenderPid(1);
|
||||
|
||||
|
@ -923,7 +923,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnRenderProcessCreated_001, TestSize.Level0)
|
||||
manager->HandleOnRenderProcessCreated(nullptr);
|
||||
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
|
||||
std::shared_ptr<RenderRecord> renderRecord =
|
||||
std::make_shared<RenderRecord>(1, "param", 1, 1, 1, appRecord);
|
||||
std::make_shared<RenderRecord>(1, "param", FdGuard(1), FdGuard(1), FdGuard(1), appRecord);
|
||||
renderRecord->SetPid(1);
|
||||
manager->HandleOnRenderProcessCreated(renderRecord);
|
||||
}
|
||||
@ -1142,7 +1142,7 @@ HWTEST_F(AppSpawnSocketTest, HandleOnRenderProcessDied_001, TestSize.Level0)
|
||||
ASSERT_NE(manager, nullptr);
|
||||
std::shared_ptr<AppRunningRecord> appRecord = MockAppRecord();
|
||||
std::shared_ptr<RenderRecord> renderRecord =
|
||||
std::make_shared<RenderRecord>(1, "param", 1, 1, 1, appRecord);
|
||||
std::make_shared<RenderRecord>(1, "param", FdGuard(1), FdGuard(1), FdGuard(1), appRecord);
|
||||
renderRecord->SetPid(1);
|
||||
manager->HandleOnRenderProcessDied(nullptr);
|
||||
manager->HandleOnRenderProcessDied(renderRecord);
|
||||
|
Loading…
Reference in New Issue
Block a user