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

Side by Side Diff: chrome/test/chromedriver/chrome_launcher.cc

Issue 999033003: Remove uses of KillProcess() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/test/chromedriver/chrome_launcher.h" 5 #include "chrome/test/chromedriver/chrome_launcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
16 #include "base/files/scoped_file.h" 16 #include "base/files/scoped_file.h"
17 #include "base/format_macros.h" 17 #include "base/format_macros.h"
18 #include "base/json/json_reader.h" 18 #include "base/json/json_reader.h"
19 #include "base/json/json_writer.h" 19 #include "base/json/json_writer.h"
20 #include "base/logging.h" 20 #include "base/logging.h"
21 #include "base/process/kill.h" 21 #include "base/process/kill.h"
22 #include "base/process/launch.h" 22 #include "base/process/launch.h"
23 #include "base/process/process.h"
23 #include "base/strings/string_number_conversions.h" 24 #include "base/strings/string_number_conversions.h"
24 #include "base/strings/string_util.h" 25 #include "base/strings/string_util.h"
25 #include "base/strings/stringprintf.h" 26 #include "base/strings/stringprintf.h"
26 #include "base/strings/utf_string_conversions.h" 27 #include "base/strings/utf_string_conversions.h"
27 #include "base/threading/platform_thread.h" 28 #include "base/threading/platform_thread.h"
28 #include "base/time/time.h" 29 #include "base/time/time.h"
29 #include "base/values.h" 30 #include "base/values.h"
30 #include "chrome/common/chrome_constants.h" 31 #include "chrome/common/chrome_constants.h"
31 #include "chrome/test/chromedriver/chrome/chrome_android_impl.h" 32 #include "chrome/test/chromedriver/chrome/chrome_android_impl.h"
32 #include "chrome/test/chromedriver/chrome/chrome_desktop_impl.h" 33 #include "chrome/test/chromedriver/chrome/chrome_desktop_impl.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 case base::TERMINATION_STATUS_PROCESS_CRASHED: 381 case base::TERMINATION_STATUS_PROCESS_CRASHED:
381 termination_reason = "crashed"; 382 termination_reason = "crashed";
382 break; 383 break;
383 default: 384 default:
384 termination_reason = "unknown"; 385 termination_reason = "unknown";
385 break; 386 break;
386 } 387 }
387 return Status(kUnknownError, 388 return Status(kUnknownError,
388 "Chrome failed to start: " + termination_reason); 389 "Chrome failed to start: " + termination_reason);
389 } 390 }
390 if (!base::KillProcess(process.Handle(), 0, true)) { 391 if (!process.Terminate(0, true)) {
391 int exit_code; 392 int exit_code;
392 if (base::GetTerminationStatus(process.Handle(), &exit_code) == 393 if (base::GetTerminationStatus(process.Handle(), &exit_code) ==
393 base::TERMINATION_STATUS_STILL_RUNNING) 394 base::TERMINATION_STATUS_STILL_RUNNING)
394 return Status(kUnknownError, "cannot kill Chrome", status); 395 return Status(kUnknownError, "cannot kill Chrome", status);
395 } 396 }
396 return status; 397 return status;
397 } 398 }
398 399
399 scoped_ptr<DevToolsClient> devtools_websocket_client; 400 scoped_ptr<DevToolsClient> devtools_websocket_client;
400 status = CreateBrowserwideDevToolsClientAndConnect( 401 status = CreateBrowserwideDevToolsClientAndConnect(
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 // Write empty "First Run" file, otherwise Chrome will wipe the default 836 // Write empty "First Run" file, otherwise Chrome will wipe the default
836 // profile that was written. 837 // profile that was written.
837 if (base::WriteFile( 838 if (base::WriteFile(
838 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { 839 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) {
839 return Status(kUnknownError, "failed to write first run file"); 840 return Status(kUnknownError, "failed to write first run file");
840 } 841 }
841 return Status(kOk); 842 return Status(kOk);
842 } 843 }
843 844
844 } // namespace internal 845 } // namespace internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698