OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_impl.h" | 5 #include "chrome/test/chromedriver/chrome_launcher_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 scoped_ptr<Chrome>* chrome) { | 24 scoped_ptr<Chrome>* chrome) { |
25 FilePath program = chrome_exe; | 25 FilePath program = chrome_exe; |
26 if (program.empty()) { | 26 if (program.empty()) { |
27 if (!FindChrome(&program)) | 27 if (!FindChrome(&program)) |
28 return Status(kUnknownError, "cannot find Chrome binary"); | 28 return Status(kUnknownError, "cannot find Chrome binary"); |
29 } | 29 } |
30 | 30 |
31 CommandLine command(program); | 31 CommandLine command(program); |
32 command.AppendSwitch("enable-logging"); | 32 command.AppendSwitch("enable-logging"); |
33 command.AppendSwitchASCII("logging-level", "1"); | 33 command.AppendSwitchASCII("logging-level", "1"); |
34 ScopedTempDir user_data_dir; | 34 base::ScopedTempDir user_data_dir; |
35 if (!user_data_dir.CreateUniqueTempDir()) | 35 if (!user_data_dir.CreateUniqueTempDir()) |
36 return Status(kUnknownError, "cannot create temp dir for user data dir"); | 36 return Status(kUnknownError, "cannot create temp dir for user data dir"); |
37 command.AppendSwitchPath("user-data-dir", user_data_dir.path()); | 37 command.AppendSwitchPath("user-data-dir", user_data_dir.path()); |
38 command.AppendArg("about:blank"); | 38 command.AppendArg("about:blank"); |
39 | 39 |
40 base::LaunchOptions options; | 40 base::LaunchOptions options; |
41 base::ProcessHandle process; | 41 base::ProcessHandle process; |
42 if (!base::LaunchProcess(command, options, &process)) | 42 if (!base::LaunchProcess(command, options, &process)) |
43 return Status(kUnknownError, "chrome failed to start"); | 43 return Status(kUnknownError, "chrome failed to start"); |
44 chrome->reset(new ChromeImpl(process, &user_data_dir)); | 44 chrome->reset(new ChromeImpl(process, &user_data_dir)); |
45 | 45 |
46 return Status(kOk); | 46 return Status(kOk); |
47 } | 47 } |
OLD | NEW |