OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/automation/proxy_launcher.h" | 5 #include "chrome/test/automation/proxy_launcher.h" |
6 | 6 |
7 #include "app/sql/connection.h" | 7 #include "app/sql/connection.h" |
| 8 #include "base/environment.h" |
8 #include "base/file_util.h" | 9 #include "base/file_util.h" |
9 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
10 #include "base/string_split.h" | 11 #include "base/string_split.h" |
11 #include "base/string_util.h" | 12 #include "base/string_util.h" |
12 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
13 #include "base/test/test_file_util.h" | 14 #include "base/test/test_file_util.h" |
14 #include "base/test/test_timeouts.h" | 15 #include "base/test/test_timeouts.h" |
15 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
16 #include "chrome/app/chrome_command_ids.h" | 17 #include "chrome/app/chrome_command_ids.h" |
17 #include "chrome/common/automation_constants.h" | 18 #include "chrome/common/automation_constants.h" |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 void ProxyLauncher::PrepareTestCommandline(CommandLine* command_line, | 358 void ProxyLauncher::PrepareTestCommandline(CommandLine* command_line, |
358 bool include_testing_id) { | 359 bool include_testing_id) { |
359 // Propagate commandline settings from test_launcher_utils. | 360 // Propagate commandline settings from test_launcher_utils. |
360 test_launcher_utils::PrepareBrowserCommandLineForTests(command_line); | 361 test_launcher_utils::PrepareBrowserCommandLineForTests(command_line); |
361 | 362 |
362 // Add any explicit command line flags passed to the process. | 363 // Add any explicit command line flags passed to the process. |
363 CommandLine::StringType extra_chrome_flags = | 364 CommandLine::StringType extra_chrome_flags = |
364 CommandLine::ForCurrentProcess()->GetSwitchValueNative( | 365 CommandLine::ForCurrentProcess()->GetSwitchValueNative( |
365 switches::kExtraChromeFlags); | 366 switches::kExtraChromeFlags); |
366 if (!extra_chrome_flags.empty()) { | 367 if (!extra_chrome_flags.empty()) { |
367 // Split by spaces and append to command line | 368 // Split by spaces and append to command line. |
368 std::vector<CommandLine::StringType> flags; | 369 std::vector<CommandLine::StringType> flags; |
369 base::SplitString(extra_chrome_flags, ' ', &flags); | 370 base::SplitStringAlongWhitespace(extra_chrome_flags, &flags); |
370 for (size_t i = 0; i < flags.size(); ++i) | 371 for (size_t i = 0; i < flags.size(); ++i) |
371 command_line->AppendArgNative(flags[i]); | 372 command_line->AppendArgNative(flags[i]); |
372 } | 373 } |
373 | 374 |
| 375 // Also look for extra flags in environment. |
| 376 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 377 std::string extra_from_env; |
| 378 if (env->GetVar("EXTRA_CHROME_FLAGS", &extra_from_env)) { |
| 379 std::vector<std::string> flags; |
| 380 base::SplitStringAlongWhitespace(extra_from_env, &flags); |
| 381 for (size_t i = 0; i < flags.size(); ++i) |
| 382 command_line->AppendArg(flags[i]); |
| 383 } |
| 384 |
374 // No default browser check, it would create an info-bar (if we are not the | 385 // No default browser check, it would create an info-bar (if we are not the |
375 // default browser) that could conflicts with some tests expectations. | 386 // default browser) that could conflicts with some tests expectations. |
376 command_line->AppendSwitch(switches::kNoDefaultBrowserCheck); | 387 command_line->AppendSwitch(switches::kNoDefaultBrowserCheck); |
377 | 388 |
378 // This is a UI test. | 389 // This is a UI test. |
379 command_line->AppendSwitchASCII(switches::kTestType, kUITestType); | 390 command_line->AppendSwitchASCII(switches::kTestType, kUITestType); |
380 | 391 |
381 // Tell the browser to use a temporary directory just for this test. | 392 // Tell the browser to use a temporary directory just for this test. |
382 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir()); | 393 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir()); |
383 | 394 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 LaunchBrowserAndServer(state, wait_for_initial_loads); | 598 LaunchBrowserAndServer(state, wait_for_initial_loads); |
588 } | 599 } |
589 | 600 |
590 void AnonymousProxyLauncher::TerminateConnection() { | 601 void AnonymousProxyLauncher::TerminateConnection() { |
591 CloseBrowserAndServer(); | 602 CloseBrowserAndServer(); |
592 } | 603 } |
593 | 604 |
594 std::string AnonymousProxyLauncher::PrefixedChannelID() const { | 605 std::string AnonymousProxyLauncher::PrefixedChannelID() const { |
595 return channel_id_; | 606 return channel_id_; |
596 } | 607 } |
OLD | NEW |