#include "base/process/process.h"
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include "base/at_exit.h"
#include "base/debug/invalid_access_win.h"
#include "base/process/kill.h"
#include "base/test/multiprocess_test.h"
#include "base/test/test_timeouts.h"
#include "base/threading/platform_thread.h"
#include "base/threading/platform_thread_internal_posix.h"
#include "base/threading/thread_local.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/multiprocess_func_list.h"
#if BUILDFLAG(IS_CHROMEOS)
#include <sys/resource.h>
#include <unistd.h>
#include <vector>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/process/internal_linux.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#endif
#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
#include "base/test/scoped_feature_list.h"
#endif
#if BUILDFLAG(IS_WIN)
#include <windows.h>
#include "base/win/base_win_buildflags.h"
#include "base/win/windows_version.h"
#endif
namespace {
#if BUILDFLAG(IS_WIN)
constexpr int kExpectedStillRunningExitCode = 0x102;
#else
constexpr int kExpectedStillRunningExitCode = …;
#endif
constexpr int kDummyExitCode = …;
#if BUILDFLAG(IS_APPLE)
class FakePortProvider : public base::PortProvider {
mach_port_t TaskForHandle(base::ProcessHandle process_handle) const override {
return mach_task_self();
}
};
#endif
#if BUILDFLAG(IS_CHROMEOS)
const char kForeground[] = "/chrome_renderers/foreground";
const char kCgroupRoot[] = "/sys/fs/cgroup/cpu";
const char kFullRendererCgroupRoot[] = "/sys/fs/cgroup/cpu/chrome_renderers";
const char kProcPath[] = "/proc/%d/cgroup";
std::string GetProcessCpuCgroup(const base::Process& process) {
std::string proc;
if (!base::ReadFileToString(
base::FilePath(base::StringPrintf(kProcPath, process.Pid())),
&proc)) {
return std::string();
}
std::vector<std::string_view> lines = SplitStringPiece(
proc, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
for (const auto& line : lines) {
std::vector<std::string_view> fields = SplitStringPiece(
line, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (fields.size() != 3U) {
continue;
}
if (fields[1] == "cpu") {
return static_cast<std::string>(fields[2]);
}
}
return std::string();
}
bool AddProcessToCpuCgroup(const base::Process& process,
const std::string& cgroup) {
base::FilePath path(cgroup);
path = path.Append("cgroup.procs");
return base::WriteFile(path, base::NumberToString(process.Pid()));
}
#endif
}
namespace base {
class ProcessTest : public MultiProcessTest { … };
TEST_F(ProcessTest, Create) { … }
TEST_F(ProcessTest, CreateCurrent) { … }
TEST_F(ProcessTest, Move) { … }
TEST_F(ProcessTest, Duplicate) { … }
TEST_F(ProcessTest, DuplicateCurrent) { … }
MULTIPROCESS_TEST_MAIN(SleepyChildProcess) { … }
TEST_F(ProcessTest, CreationTimeCurrentProcess) { … }
#if !BUILDFLAG(IS_ANDROID)
TEST_F(ProcessTest, CreationTimeOtherProcess) { … }
#endif
TEST_F(ProcessTest, Terminate) { … }
void AtExitHandler(void*) { … }
class ThreadLocalObject { … };
MULTIPROCESS_TEST_MAIN(TerminateCurrentProcessImmediatelyWithCode0) { … }
TEST_F(ProcessTest, TerminateCurrentProcessImmediatelyWithZeroExitCode) { … }
MULTIPROCESS_TEST_MAIN(TerminateCurrentProcessImmediatelyWithCode250) { … }
TEST_F(ProcessTest, TerminateCurrentProcessImmediatelyWithNonZeroExitCode) { … }
MULTIPROCESS_TEST_MAIN(FastSleepyChildProcess) { … }
TEST_F(ProcessTest, WaitForExit) { … }
TEST_F(ProcessTest, WaitForExitWithTimeout) { … }
#if BUILDFLAG(IS_WIN)
TEST_F(ProcessTest, WaitForExitOrEventWithProcessExit) {
Process process(SpawnChild("FastSleepyChildProcess"));
ASSERT_TRUE(process.IsValid());
base::win::ScopedHandle stop_watching_handle(
CreateEvent(nullptr, TRUE, FALSE, nullptr));
int exit_code = kDummyExitCode;
EXPECT_EQ(process.WaitForExitOrEvent(stop_watching_handle, &exit_code),
base::Process::WaitExitStatus::PROCESS_EXITED);
EXPECT_EQ(0, exit_code);
}
TEST_F(ProcessTest, WaitForExitOrEventWithEventSet) {
Process process(SpawnChild("SleepyChildProcess"));
ASSERT_TRUE(process.IsValid());
base::win::ScopedHandle stop_watching_handle(
CreateEvent(nullptr, TRUE, TRUE, nullptr));
int exit_code = kDummyExitCode;
EXPECT_EQ(process.WaitForExitOrEvent(stop_watching_handle, &exit_code),
base::Process::WaitExitStatus::STOP_EVENT_SIGNALED);
EXPECT_EQ(kDummyExitCode, exit_code);
process.Terminate(kDummyExitCode, false);
}
#endif
TEST_F(ProcessTest, SetProcessPriority) { … }
#if BUILDFLAG(IS_CHROMEOS)
bool IsThreadRT(PlatformThreadId thread_id) {
int sched = sched_getscheduler(
PlatformThread::CurrentId() == thread_id ? 0 : thread_id);
if (sched == -1) {
DPLOG_IF(ERROR, errno != ESRCH)
<< "Failed to call sched_getscheduler on thread_id=" << thread_id;
return false;
}
return sched == SCHED_RR || sched == SCHED_FIFO;
}
void AssertThreadsRT(int process_id, bool is_rt) {
internal::ForEachProcessTask(
process_id, [is_rt](PlatformThreadId tid, const FilePath& ) {
EXPECT_EQ(IsThreadRT(tid), is_rt);
});
}
void AssertThreadsType(int process_id, ThreadType type) {
internal::ForEachProcessTask(process_id, [process_id, type](
PlatformThreadId tid,
const FilePath& path) {
EXPECT_EQ(PlatformThread::GetThreadTypeFromThreadId(process_id, tid), type);
});
}
void AssertThreadsBgState(int process_id, bool is_bg) {
internal::ForEachProcessTask(
process_id, [is_bg](PlatformThreadId tid, const FilePath& path) {
EXPECT_EQ(PlatformThreadLinux::IsThreadBackgroundedForTest(tid), is_bg);
});
}
namespace {
class FunctionTestThread : public PlatformThread::Delegate {
public:
FunctionTestThread() = default;
FunctionTestThread(const FunctionTestThread&) = delete;
FunctionTestThread& operator=(const FunctionTestThread&) = delete;
void ThreadMain() override {
PlatformThread::SetCurrentThreadType(ThreadType::kDisplayCritical);
while (true) {
PlatformThread::Sleep(Milliseconds(100));
}
}
};
class RTAudioFunctionTestThread : public PlatformThread::Delegate {
public:
RTAudioFunctionTestThread() = default;
RTAudioFunctionTestThread(const RTAudioFunctionTestThread&) = delete;
RTAudioFunctionTestThread& operator=(const RTAudioFunctionTestThread&) =
delete;
void ThreadMain() override {
PlatformThread::SetCurrentThreadType(ThreadType::kRealtimeAudio);
while (true) {
PlatformThread::Sleep(Milliseconds(100));
}
}
};
class RTDisplayFunctionTestThread : public PlatformThread::Delegate {
public:
RTDisplayFunctionTestThread() = default;
RTDisplayFunctionTestThread(const RTDisplayFunctionTestThread&) = delete;
RTDisplayFunctionTestThread& operator=(const RTDisplayFunctionTestThread&) =
delete;
void ThreadMain() override {
PlatformThread::SetCurrentThreadType(ThreadType::kDisplayCritical);
while (true) {
PlatformThread::Sleep(Milliseconds(100));
}
}
};
int create_threads_after_bg;
bool bg_threads_created;
bool prebg_threads_created;
bool audio_rt_threads_created;
bool display_rt_threads_created;
void sig_create_threads_after_bg(int signum) {
if (signum == SIGUSR1) {
create_threads_after_bg = true;
}
}
void sig_prebg_threads_created_handler(int signum) {
if (signum == SIGUSR1) {
prebg_threads_created = true;
}
}
void sig_bg_threads_created_handler(int signum) {
if (signum == SIGUSR2) {
bg_threads_created = true;
}
}
void sig_audio_rt_threads_created_handler(int signum) {
if (signum == SIGUSR1) {
audio_rt_threads_created = true;
}
}
void sig_display_rt_threads_created_handler(int signum) {
if (signum == SIGUSR1) {
display_rt_threads_created = true;
}
}
}
MULTIPROCESS_TEST_MAIN(ProcessThreadBackgroundingMain) {
PlatformThreadHandle handle1, handle2, handle3;
FunctionTestThread thread1, thread2, thread3;
base::test::ScopedFeatureList scoped_feature_list(kSetThreadBgForBgProcess);
PlatformThreadChromeOS::InitializeFeatures();
PlatformThread::SetCurrentThreadType(ThreadType::kDisplayCritical);
signal(SIGUSR1, sig_create_threads_after_bg);
if (!PlatformThread::Create(0, &thread1, &handle1)) {
ADD_FAILURE() << "ProcessThreadBackgroundingMain: Failed to create thread1";
return 1;
}
if (!PlatformThread::Create(0, &thread2, &handle2)) {
ADD_FAILURE() << "ProcessThreadBackgroundingMain: Failed to create thread2";
return 1;
}
kill(getppid(), SIGUSR1);
while (create_threads_after_bg == 0) {
PlatformThread::Sleep(Milliseconds(100));
}
if (!PlatformThread::Create(0, &thread3, &handle3)) {
ADD_FAILURE() << "ProcessThreadBackgroundingMain: Failed to create thread3";
return 1;
}
kill(getppid(), SIGUSR2);
while (true) {
PlatformThread::Sleep(Milliseconds(100));
}
}
TEST_F(ProcessTest, ProcessThreadBackgrounding) {
if (!PlatformThread::CanChangeThreadType(ThreadType::kDefault,
ThreadType::kDisplayCritical)) {
return;
}
base::test::ScopedFeatureList scoped_feature_list(kSetThreadBgForBgProcess);
PlatformThreadChromeOS::InitializeFeatures();
signal(SIGUSR1, sig_prebg_threads_created_handler);
signal(SIGUSR2, sig_bg_threads_created_handler);
Process process(SpawnChild("ProcessThreadBackgroundingMain"));
EXPECT_TRUE(process.IsValid());
while (!prebg_threads_created) {
PlatformThread::Sleep(Milliseconds(100));
}
AssertThreadsType(process.Pid(), ThreadType::kDisplayCritical);
AssertThreadsBgState(process.Pid(), false);
EXPECT_TRUE(process.SetPriority(Process::Priority::kBestEffort));
kill(process.Pid(), SIGUSR1);
while (!bg_threads_created) {
PlatformThread::Sleep(Milliseconds(100));
}
AssertThreadsType(process.Pid(), ThreadType::kDisplayCritical);
AssertThreadsBgState(process.Pid(), true);
EXPECT_TRUE(process.SetPriority(Process::Priority::kUserBlocking));
EXPECT_TRUE(process.GetPriority() == base::Process::Priority::kUserBlocking);
AssertThreadsType(process.Pid(), ThreadType::kDisplayCritical);
AssertThreadsBgState(process.Pid(), false);
}
MULTIPROCESS_TEST_MAIN(ProcessRTAudioBgMain) {
PlatformThreadHandle handle1;
RTAudioFunctionTestThread thread1;
base::test::ScopedFeatureList scoped_feature_list(kSetThreadBgForBgProcess);
PlatformThreadChromeOS::InitializeFeatures();
PlatformThread::SetCurrentThreadType(ThreadType::kRealtimeAudio);
if (!PlatformThread::Create(0, &thread1, &handle1)) {
ADD_FAILURE() << "ProcessRTAudioBgMain: Failed to create thread1";
return 1;
}
kill(getppid(), SIGUSR1);
while (true) {
PlatformThread::Sleep(Milliseconds(100));
}
}
TEST_F(ProcessTest, ProcessRTAudioBg) {
if (!PlatformThread::CanChangeThreadType(ThreadType::kDefault,
ThreadType::kDisplayCritical)) {
return;
}
base::test::ScopedFeatureList scoped_feature_list(kSetThreadBgForBgProcess);
PlatformThreadChromeOS::InitializeFeatures();
signal(SIGUSR1, sig_audio_rt_threads_created_handler);
Process process(SpawnChild("ProcessRTAudioBgMain"));
EXPECT_TRUE(process.IsValid());
while (!audio_rt_threads_created) {
PlatformThread::Sleep(Milliseconds(100));
}
AssertThreadsRT(process.Pid(), true);
AssertThreadsType(process.Pid(), ThreadType::kRealtimeAudio);
AssertThreadsBgState(process.Pid(), false);
EXPECT_TRUE(process.SetPriority(Process::Priority::kBestEffort));
EXPECT_TRUE(process.GetPriority() == base::Process::Priority::kBestEffort);
AssertThreadsRT(process.Pid(), true);
AssertThreadsType(process.Pid(), ThreadType::kRealtimeAudio);
AssertThreadsBgState(process.Pid(), false);
EXPECT_TRUE(process.SetPriority(Process::Priority::kUserBlocking));
EXPECT_TRUE(process.GetPriority() == base::Process::Priority::kUserBlocking);
AssertThreadsRT(process.Pid(), true);
AssertThreadsType(process.Pid(), ThreadType::kRealtimeAudio);
AssertThreadsBgState(process.Pid(), false);
}
MULTIPROCESS_TEST_MAIN(ProcessRTDisplayBgMain) {
PlatformThreadHandle handle1;
RTDisplayFunctionTestThread thread1;
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures(
{kSetThreadBgForBgProcess, kSetRtForDisplayThreads}, {});
PlatformThreadChromeOS::InitializeFeatures();
PlatformThread::SetCurrentThreadType(ThreadType::kDisplayCritical);
if (!PlatformThread::Create(0, &thread1, &handle1)) {
ADD_FAILURE() << "ProcessRTDisplayBgMain: Failed to create thread1";
return 1;
}
kill(getppid(), SIGUSR1);
while (true) {
PlatformThread::Sleep(Milliseconds(100));
}
}
TEST_F(ProcessTest, ProcessRTDisplayBg) {
if (!PlatformThread::CanChangeThreadType(ThreadType::kDefault,
ThreadType::kDisplayCritical)) {
return;
}
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures(
{kSetThreadBgForBgProcess, kSetRtForDisplayThreads}, {});
PlatformThreadChromeOS::InitializeFeatures();
signal(SIGUSR1, sig_display_rt_threads_created_handler);
Process process(SpawnChild("ProcessRTDisplayBgMain"));
EXPECT_TRUE(process.IsValid());
while (!display_rt_threads_created) {
PlatformThread::Sleep(Milliseconds(100));
}
AssertThreadsRT(process.Pid(), true);
AssertThreadsType(process.Pid(), ThreadType::kDisplayCritical);
AssertThreadsBgState(process.Pid(), false);
EXPECT_TRUE(process.SetPriority(Process::Priority::kBestEffort));
EXPECT_TRUE(process.GetPriority() == base::Process::Priority::kBestEffort);
AssertThreadsRT(process.Pid(), false);
AssertThreadsType(process.Pid(), ThreadType::kDisplayCritical);
AssertThreadsBgState(process.Pid(), true);
EXPECT_TRUE(process.SetPriority(Process::Priority::kUserBlocking));
EXPECT_TRUE(process.GetPriority() == base::Process::Priority::kUserBlocking);
AssertThreadsRT(process.Pid(), true);
AssertThreadsType(process.Pid(), ThreadType::kDisplayCritical);
AssertThreadsBgState(process.Pid(), false);
}
#endif
TEST_F(ProcessTest, CurrentProcessIsRunning) { … }
#if BUILDFLAG(IS_APPLE)
TEST_F(ProcessTest, PredefinedProcessIsRunning) {
EXPECT_FALSE(Process::Open(1).WaitForExitWithTimeout(
base::TimeDelta(), nullptr));
}
#endif
#if BUILDFLAG(IS_WIN)
#if defined(ARCH_CPU_ARM64)
#define MAYBE_HeapCorruption …
#else
#define MAYBE_HeapCorruption …
#endif
TEST_F(ProcessTest, MAYBE_HeapCorruption) {
EXPECT_EXIT(base::debug::win::TerminateWithHeapCorruption(),
::testing::ExitedWithCode(STATUS_HEAP_CORRUPTION), "");
}
#if BUILDFLAG(WIN_ENABLE_CFG_GUARDS)
#define MAYBE_ControlFlowViolation …
#else
#define MAYBE_ControlFlowViolation …
#endif
TEST_F(ProcessTest, MAYBE_ControlFlowViolation) {
EXPECT_EXIT(base::debug::win::TerminateWithControlFlowViolation(),
::testing::ExitedWithCode(STATUS_STACK_BUFFER_OVERRUN), "");
}
#endif
TEST_F(ProcessTest, ChildProcessIsRunning) { … }
#if BUILDFLAG(IS_CHROMEOS)
TEST_F(ProcessTest, TestGetProcessPriorityCGroup) {
const char kNotBackgroundedCGroup[] = "5:cpuacct,cpu,cpuset:/daemons\n";
const char kBackgroundedCGroup[] =
"2:freezer:/chrome_renderers/to_be_frozen\n"
"1:cpu:/chrome_renderers/background\n";
EXPECT_EQ(GetProcessPriorityCGroup(kNotBackgroundedCGroup),
Process::Priority::kUserBlocking);
EXPECT_EQ(GetProcessPriorityCGroup(kBackgroundedCGroup),
Process::Priority::kBestEffort);
}
TEST_F(ProcessTest, InitializePriorityEmptyProcess) {
if (!Process::OneGroupPerRendererEnabledForTesting())
return;
Process process;
process.InitializePriority();
const std::string unique_token = process.unique_token();
ASSERT_TRUE(unique_token.empty());
}
TEST_F(ProcessTest, SetProcessBackgroundedOneCgroupPerRender) {
if (!Process::OneGroupPerRendererEnabledForTesting())
return;
base::test::TaskEnvironment task_env;
Process process(SpawnChild("SimpleChildProcess"));
process.InitializePriority();
const std::string unique_token = process.unique_token();
ASSERT_FALSE(unique_token.empty());
EXPECT_TRUE(process.SetPriority(Process::Priority::kUserBlocking));
EXPECT_EQ(process.GetPriority(), Process::Priority::kUserBlocking);
std::string cgroup = GetProcessCpuCgroup(process);
EXPECT_FALSE(cgroup.empty());
EXPECT_NE(cgroup.find(unique_token), std::string::npos);
EXPECT_TRUE(process.SetPriority(Process::Priority::kBestEffort));
EXPECT_EQ(process.GetPriority(), Process::Priority::kBestEffort);
EXPECT_TRUE(process.Terminate(0, false));
task_env.RunUntilIdle();
cgroup = std::string(kCgroupRoot) + cgroup;
EXPECT_FALSE(base::DirectoryExists(FilePath(cgroup)));
}
TEST_F(ProcessTest, CleanUpBusyProcess) {
if (!Process::OneGroupPerRendererEnabledForTesting())
return;
base::test::TaskEnvironment task_env;
Process process(SpawnChild("SimpleChildProcess"));
process.InitializePriority();
const std::string unique_token = process.unique_token();
ASSERT_FALSE(unique_token.empty());
EXPECT_TRUE(process.SetPriority(Process::Priority::kUserBlocking));
EXPECT_EQ(process.GetPriority(), Process::Priority::kUserBlocking);
std::string cgroup = GetProcessCpuCgroup(process);
EXPECT_FALSE(cgroup.empty());
EXPECT_NE(cgroup.find(unique_token), std::string::npos);
cgroup = std::string(kCgroupRoot) + cgroup;
Process process2(SpawnChild("SimpleChildProcess"));
EXPECT_TRUE(AddProcessToCpuCgroup(process2, cgroup));
EXPECT_TRUE(process.Terminate(0, false));
task_env.RunUntilIdle();
EXPECT_TRUE(base::DirectoryExists(FilePath(cgroup)));
std::string foreground_path =
std::string(kCgroupRoot) + std::string(kForeground);
EXPECT_TRUE(AddProcessToCpuCgroup(process2, foreground_path));
PlatformThread::Sleep(base::Milliseconds(1100));
task_env.RunUntilIdle();
EXPECT_FALSE(base::DirectoryExists(FilePath(cgroup)));
process2.Terminate(0, false);
}
TEST_F(ProcessTest, SetProcessBackgroundedEmptyToken) {
if (!Process::OneGroupPerRendererEnabledForTesting())
return;
Process process(SpawnChild("SimpleChildProcess"));
const std::string unique_token = process.unique_token();
ASSERT_TRUE(unique_token.empty());
EXPECT_TRUE(process.SetPriority(Process::Priority::kUserBlocking));
EXPECT_EQ(process.GetPriority(), Process::Priority::kUserBlocking);
std::string cgroup = GetProcessCpuCgroup(process);
EXPECT_FALSE(cgroup.empty());
EXPECT_EQ(cgroup, kForeground);
}
TEST_F(ProcessTest, CleansUpStaleGroups) {
if (!Process::OneGroupPerRendererEnabledForTesting())
return;
base::test::TaskEnvironment task_env;
Process process(SpawnChild("SimpleChildProcess"));
process.InitializePriority();
const std::string unique_token = process.unique_token();
ASSERT_FALSE(unique_token.empty());
EXPECT_TRUE(process.SetPriority(Process::Priority::kBestEffort));
EXPECT_EQ(process.GetPriority(), Process::Priority::kBestEffort);
std::string root = kFullRendererCgroupRoot;
std::string cgroup = root + "/" + unique_token;
std::vector<std::string> tokens = base::SplitString(
cgroup, "-", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
tokens[1] = "fake";
std::string fake_cgroup = base::JoinString(tokens, "-");
EXPECT_TRUE(base::CreateDirectory(FilePath(fake_cgroup)));
Process::CleanUpStaleProcessStates();
EXPECT_FALSE(base::DirectoryExists(FilePath(fake_cgroup)));
EXPECT_TRUE(base::DirectoryExists(FilePath(cgroup)));
EXPECT_TRUE(base::DirectoryExists(FilePath(root + "/foreground")));
EXPECT_TRUE(base::DirectoryExists(FilePath(root + "/background")));
EXPECT_TRUE(process.Terminate(0, false));
task_env.RunUntilIdle();
EXPECT_FALSE(base::DirectoryExists(FilePath(cgroup)));
}
TEST_F(ProcessTest, OneCgroupDoesNotCleanUpGroupsWithWrongPrefix) {
if (!Process::OneGroupPerRendererEnabledForTesting())
return;
base::test::TaskEnvironment task_env;
Process process(SpawnChild("SimpleChildProcess"));
process.InitializePriority();
const std::string unique_token = process.unique_token();
ASSERT_FALSE(unique_token.empty());
EXPECT_TRUE(process.SetPriority(Process::Priority::kUserBlocking));
EXPECT_EQ(process.GetPriority(), Process::Priority::kUserBlocking);
std::string cgroup = GetProcessCpuCgroup(process);
EXPECT_FALSE(cgroup.empty());
EXPECT_NE(cgroup.find(unique_token), std::string::npos);
FilePath cgroup_path = FilePath(std::string(kCgroupRoot) + cgroup);
FilePath fake_cgroup = FilePath(kFullRendererCgroupRoot).AppendASCII("fake");
EXPECT_TRUE(base::CreateDirectory(fake_cgroup));
Process::CleanUpStaleProcessStates();
EXPECT_TRUE(base::DirectoryExists(fake_cgroup));
EXPECT_TRUE(base::DirectoryExists(cgroup_path));
EXPECT_TRUE(process.SetPriority(Process::Priority::kBestEffort));
EXPECT_EQ(process.GetPriority(), Process::Priority::kBestEffort);
EXPECT_TRUE(process.Terminate(0, false));
task_env.RunUntilIdle();
EXPECT_FALSE(base::DirectoryExists(cgroup_path));
base::DeleteFile(fake_cgroup);
}
#endif
}