summaryrefslogtreecommitdiff
path: root/chromium/base/process/process_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/base/process/process_unittest.cc')
-rw-r--r--chromium/base/process/process_unittest.cc32
1 files changed, 6 insertions, 26 deletions
diff --git a/chromium/base/process/process_unittest.cc b/chromium/base/process/process_unittest.cc
index e094c032f3b..9fdc2f1e028 100644
--- a/chromium/base/process/process_unittest.cc
+++ b/chromium/base/process/process_unittest.cc
@@ -11,10 +11,6 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/multiprocess_func_list.h"
-#if defined(OS_MACOSX)
-#include <mach/mach.h>
-#endif // OS_MACOSX
-
namespace {
#if defined(OS_WIN)
@@ -174,26 +170,16 @@ TEST_F(ProcessTest, WaitForExitWithTimeout) {
TEST_F(ProcessTest, SetProcessBackgrounded) {
Process process(SpawnChild("SimpleChildProcess"));
int old_priority = process.GetPriority();
-#if defined(OS_MACOSX)
- // On the Mac, backgrounding a process requires a port to that process.
- // In the browser it's available through the MachBroker class, which is not
- // part of base. Additionally, there is an indefinite amount of time between
- // spawning a process and receiving its port. Because this test just checks
- // the ability to background/foreground a process, we can use the current
- // process's port instead.
- mach_port_t process_port = mach_task_self();
- EXPECT_TRUE(process.SetProcessBackgrounded(process_port, true));
- EXPECT_TRUE(process.IsProcessBackgrounded(process_port));
- EXPECT_TRUE(process.SetProcessBackgrounded(process_port, false));
- EXPECT_FALSE(process.IsProcessBackgrounded(process_port));
-#elif defined(OS_WIN)
+#if defined(OS_WIN)
EXPECT_TRUE(process.SetProcessBackgrounded(true));
EXPECT_TRUE(process.IsProcessBackgrounded());
EXPECT_TRUE(process.SetProcessBackgrounded(false));
EXPECT_FALSE(process.IsProcessBackgrounded());
#else
- process.SetProcessBackgrounded(true);
- process.SetProcessBackgrounded(false);
+ if (process.CanBackgroundProcesses()) {
+ process.SetProcessBackgrounded(true);
+ process.SetProcessBackgrounded(false);
+ }
#endif
int new_priority = process.GetPriority();
EXPECT_EQ(old_priority, new_priority);
@@ -204,13 +190,7 @@ TEST_F(ProcessTest, SetProcessBackgrounded) {
TEST_F(ProcessTest, SetProcessBackgroundedSelf) {
Process process = Process::Current();
int old_priority = process.GetPriority();
-#if defined(OS_MACOSX)
- mach_port_t process_port = mach_task_self();
- EXPECT_TRUE(process.SetProcessBackgrounded(process_port, true));
- EXPECT_TRUE(process.IsProcessBackgrounded(process_port));
- EXPECT_TRUE(process.SetProcessBackgrounded(process_port, false));
- EXPECT_FALSE(process.IsProcessBackgrounded(process_port));
-#elif defined(OS_WIN)
+#if defined(OS_WIN)
EXPECT_TRUE(process.SetProcessBackgrounded(true));
EXPECT_TRUE(process.IsProcessBackgrounded());
EXPECT_TRUE(process.SetProcessBackgrounded(false));