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

Unified Diff: win8/viewer/metro_viewer_process_host.cc

Issue 584213002: Only do aggressive metro viewer termination in tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 6 years, 3 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
« ash/test/ash_test_base.cc ('K') | « win8/viewer/metro_viewer_process_host.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: win8/viewer/metro_viewer_process_host.cc
diff --git a/win8/viewer/metro_viewer_process_host.cc b/win8/viewer/metro_viewer_process_host.cc
index 276aa2c0b2f9265c6f6fea07f6f5a34d36ca9267..7201c984e73c73e115f6888b96fbc8567eaeae83 100644
--- a/win8/viewer/metro_viewer_process_host.cc
+++ b/win8/viewer/metro_viewer_process_host.cc
@@ -47,7 +47,8 @@ void MetroViewerProcessHost::InternalMessageFilter::OnChannelConnected(
}
MetroViewerProcessHost::MetroViewerProcessHost(
- base::SingleThreadTaskRunner* ipc_task_runner) {
+ base::SingleThreadTaskRunner* ipc_task_runner)
+ : launched_for_test_(false) {
DCHECK(!instance_);
instance_ = this;
@@ -74,7 +75,15 @@ MetroViewerProcessHost::~MetroViewerProcessHost() {
PROCESS_QUERY_INFORMATION | SYNCHRONIZE,
&viewer_process);
if (viewer_process) {
- ::WaitForSingleObject(viewer_process, INFINITE);
+ if (launched_for_test_) {
+ // In tests, we don't want to wait around for the viewer to
+ // terminate, so kill it after a short delay. See
+ // http://crbug.com/411147 for more details.
+ ::WaitForSingleObject(viewer_process, 100);
ananta 2014/09/19 19:36:57 Just TerminateProcess here?. The viewer has no sta
scottmg 2014/09/19 19:41:19 Sure, Done.
+ ::TerminateProcess(viewer_process, 0);
+ } else {
+ ::WaitForSingleObject(viewer_process, INFINITE);
+ }
::CloseHandle(viewer_process);
}
}
@@ -89,6 +98,12 @@ base::ProcessId MetroViewerProcessHost::GetViewerProcessId() {
return base::kNullProcessId;
}
+bool MetroViewerProcessHost::LaunchViewerAndWaitForConnectionForTests(
+ const base::string16& app_user_model_id) {
+ launched_for_test_ = true;
+ return LaunchViewerAndWaitForConnection(app_user_model_id);
+}
+
bool MetroViewerProcessHost::LaunchViewerAndWaitForConnection(
const base::string16& app_user_model_id) {
DCHECK_EQ(base::kNullProcessId, channel_->GetPeerPID());
« ash/test/ash_test_base.cc ('K') | « win8/viewer/metro_viewer_process_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698