Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3359)

Unified Diff: base/process_util_unittest.cc

Issue 6880265: Add a more comprehensive background mode for a process. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/process_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_unittest.cc
===================================================================
--- base/process_util_unittest.cc (revision 83074)
+++ base/process_util_unittest.cc (working copy)
@@ -260,12 +260,29 @@
base::ProcessHandle handle = this->SpawnChild("SimpleChildProcess", false);
base::Process process(handle);
int old_priority = process.GetPriority();
- process.SetProcessBackgrounded(true);
- process.SetProcessBackgrounded(false);
+ if (process.SetProcessBackgrounded(true)) {
+ EXPECT_TRUE(process.IsProcessBackgrounded());
+ EXPECT_TRUE(process.SetProcessBackgrounded(false));
+ EXPECT_FALSE(process.IsProcessBackgrounded());
+ }
int new_priority = process.GetPriority();
EXPECT_EQ(old_priority, new_priority);
}
+// Same as SetProcessBackgrounded but to this very process. It uses
+// a different code path at least for Windows.
+TEST_F(ProcessUtilTest, SetProcessBackgroundedSelf) {
+ base::Process process(base::Process::Current().handle());
+ int old_priority = process.GetPriority();
+ if (process.SetProcessBackgrounded(true)) {
+ EXPECT_TRUE(process.IsProcessBackgrounded());
+ EXPECT_TRUE(process.SetProcessBackgrounded(false));
+ EXPECT_FALSE(process.IsProcessBackgrounded());
+ }
+ int new_priority = process.GetPriority();
+ EXPECT_EQ(old_priority, new_priority);
+}
+
// TODO(estade): if possible, port these 2 tests.
#if defined(OS_WIN)
TEST_F(ProcessUtilTest, EnableLFH) {
« no previous file with comments | « no previous file | base/process_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698