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

Unified Diff: chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc

Issue 843113003: MultiProcessTest: Update SpawnChild* to return a Process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « base/test/multiprocess_test_android.cc ('k') | chrome/common/multi_process_lock_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc
diff --git a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc
index fd4be0b156f527c3f8bbac3f76ccf6a0ee4a45e9..43b855e95160a737bb9e3c7aebd75508b4aae077 100644
--- a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc
+++ b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc
@@ -10,6 +10,7 @@
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/process/kill.h"
+#include "base/process/process.h"
#include "base/rand_util.h"
#include "base/synchronization/waitable_event.h"
#include "base/test/multiprocess_test.h"
@@ -308,10 +309,10 @@ class CloudPrintProxyPolicyStartupTest : public base::MultiProcessTest,
scoped_refptr<base::MessageLoopProxy> IOMessageLoopProxy() {
return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
}
- base::ProcessHandle Launch(const std::string& name);
+ base::Process Launch(const std::string& name);
void WaitForConnect();
bool Send(IPC::Message* message);
- void ShutdownAndWaitForExitWithTimeout(base::ProcessHandle handle);
+ void ShutdownAndWaitForExitWithTimeout(base::Process process);
// IPC::Listener implementation
bool OnMessageReceived(const IPC::Message& message) override { return false; }
@@ -430,7 +431,7 @@ void CloudPrintProxyPolicyStartupTest::TearDown() {
TestingBrowserProcess::DeleteInstance();
}
-base::ProcessHandle CloudPrintProxyPolicyStartupTest::Launch(
+base::Process CloudPrintProxyPolicyStartupTest::Launch(
const std::string& name) {
EXPECT_FALSE(CheckServiceProcessReady());
@@ -450,12 +451,12 @@ base::ProcessHandle CloudPrintProxyPolicyStartupTest::Launch(
kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
base::LaunchOptions options;
options.fds_to_remap = &ipc_file_list;
- base::ProcessHandle handle = SpawnChildWithOptions(name, options);
+ base::Process process = SpawnChildWithOptions(name, options);
#else
- base::ProcessHandle handle = SpawnChild(name);
+ base::Process process = SpawnChild(name);
#endif
- EXPECT_TRUE(handle);
- return handle;
+ EXPECT_TRUE(process.IsValid());
+ return process.Pass();
}
void CloudPrintProxyPolicyStartupTest::WaitForConnect() {
@@ -474,16 +475,14 @@ bool CloudPrintProxyPolicyStartupTest::Send(IPC::Message* message) {
}
void CloudPrintProxyPolicyStartupTest::ShutdownAndWaitForExitWithTimeout(
- base::ProcessHandle handle) {
+ base::Process process) {
ASSERT_TRUE(Send(new ServiceMsg_Shutdown()));
int exit_code = -100;
- bool exited =
- base::WaitForExitCodeWithTimeout(handle, &exit_code,
- TestTimeouts::action_timeout());
+ bool exited = process.WaitForExitWithTimeout(TestTimeouts::action_timeout(),
+ &exit_code);
EXPECT_TRUE(exited);
EXPECT_EQ(exit_code, 0);
- base::CloseProcessHandle(handle);
}
void CloudPrintProxyPolicyStartupTest::OnChannelConnected(int32 peer_pid) {
@@ -511,10 +510,10 @@ TEST_F(CloudPrintProxyPolicyStartupTest, StartAndShutdown) {
// constructed.
chrome::TestingIOThreadState testing_io_thread_state;
- base::ProcessHandle handle =
+ base::Process process =
Launch("CloudPrintMockService_StartEnabledWaitForQuit");
WaitForConnect();
- ShutdownAndWaitForExitWithTimeout(handle);
+ ShutdownAndWaitForExitWithTimeout(process.Pass());
content::RunAllPendingInMessageLoop();
}
@@ -527,7 +526,7 @@ KeyedService* CloudPrintProxyServiceFactoryForPolicyTest(
}
TEST_F(CloudPrintProxyPolicyStartupTest, StartBrowserWithoutPolicy) {
- base::ProcessHandle handle =
+ base::Process process =
Launch("CloudPrintMockService_StartEnabledWaitForQuit");
// Setup the Browser Process with a full IOThread::Globals.
@@ -571,13 +570,13 @@ TEST_F(CloudPrintProxyPolicyStartupTest, StartBrowserWithoutPolicy) {
EXPECT_EQ(MockServiceIPCServer::EnabledUserId(),
prefs->GetString(prefs::kCloudPrintEmail));
- ShutdownAndWaitForExitWithTimeout(handle);
+ ShutdownAndWaitForExitWithTimeout(process.Pass());
content::RunAllPendingInMessageLoop();
profile_manager.DeleteTestingProfile("StartBrowserWithoutPolicy");
}
TEST_F(CloudPrintProxyPolicyStartupTest, StartBrowserWithPolicy) {
- base::ProcessHandle handle =
+ base::Process process =
Launch("CloudPrintMockService_StartEnabledExpectDisabled");
TestingBrowserProcess* browser_process =
@@ -622,7 +621,7 @@ TEST_F(CloudPrintProxyPolicyStartupTest, StartBrowserWithPolicy) {
EXPECT_EQ("", prefs->GetString(prefs::kCloudPrintEmail));
- ShutdownAndWaitForExitWithTimeout(handle);
+ ShutdownAndWaitForExitWithTimeout(process.Pass());
content::RunAllPendingInMessageLoop();
profile_manager.DeleteTestingProfile("StartBrowserWithPolicy");
}
« no previous file with comments | « base/test/multiprocess_test_android.cc ('k') | chrome/common/multi_process_lock_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698