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

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

Issue 22750002: Move AlterEnvironment to base/environment.h, implement on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments. Created 7 years, 4 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 | Annotate | Revision Log
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"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 Status status = PrepareCommandLine(port, capabilities, 154 Status status = PrepareCommandLine(port, capabilities,
155 &command, &user_data_dir, &extension_dir); 155 &command, &user_data_dir, &extension_dir);
156 if (status.IsError()) 156 if (status.IsError())
157 return status; 157 return status;
158 158
159 for (size_t i = 0; i < arraysize(kCommonSwitches); i++) 159 for (size_t i = 0; i < arraysize(kCommonSwitches); i++)
160 command.AppendSwitch(kCommonSwitches[i]); 160 command.AppendSwitch(kCommonSwitches[i]);
161 base::LaunchOptions options; 161 base::LaunchOptions options;
162 162
163 #if !defined(OS_WIN) 163 #if !defined(OS_WIN)
164 base::EnvironmentVector environ; 164 if (!capabilities.log_path.empty())
165 if (!capabilities.log_path.empty()) { 165 options.environ["CHROME_LOG_FILE"] = capabilities.log_path;
166 environ.push_back(
167 base::EnvironmentVector::value_type("CHROME_LOG_FILE",
168 capabilities.log_path));
169 options.environ = &environ;
170 }
171 if (capabilities.detach) 166 if (capabilities.detach)
172 options.new_process_group = true; 167 options.new_process_group = true;
173 #endif 168 #endif
174 169
175 #if defined(OS_WIN) 170 #if defined(OS_WIN)
176 std::string command_string = base::WideToUTF8(command.GetCommandLineString()); 171 std::string command_string = base::WideToUTF8(command.GetCommandLineString());
177 #else 172 #else
178 std::string command_string = command.GetCommandLineString(); 173 std::string command_string = command.GetCommandLineString();
179 #endif 174 #endif
180 log->AddEntry(Log::kLog, "Launching chrome: " + command_string); 175 log->AddEntry(Log::kLog, "Launching chrome: " + command_string);
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 // Write empty "First Run" file, otherwise Chrome will wipe the default 411 // Write empty "First Run" file, otherwise Chrome will wipe the default
417 // profile that was written. 412 // profile that was written.
418 if (file_util::WriteFile( 413 if (file_util::WriteFile(
419 user_data_dir.AppendASCII("First Run"), "", 0) != 0) { 414 user_data_dir.AppendASCII("First Run"), "", 0) != 0) {
420 return Status(kUnknownError, "failed to write first run file"); 415 return Status(kUnknownError, "failed to write first run file");
421 } 416 }
422 return Status(kOk); 417 return Status(kOk);
423 } 418 }
424 419
425 } // namespace internal 420 } // namespace internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698