Chromium Code Reviews| Index: content/public/test/test_launcher.cc |
| diff --git a/content/public/test/test_launcher.cc b/content/public/test/test_launcher.cc |
| index 12244614a26945a2d2f217b8f961939bf498f0de..51b1730f288c153dda5f3cc64d114735ea259c4a 100644 |
| --- a/content/public/test/test_launcher.cc |
| +++ b/content/public/test/test_launcher.cc |
| @@ -22,8 +22,11 @@ |
| #include "base/test/test_timeouts.h" |
| #include "base/time.h" |
| #include "base/utf_string_conversions.h" |
| +#include "content/public/app/content_main.h" |
| +#include "content/public/app/content_main_delegate.h" |
| #include "content/public/app/startup_helper_win.h" |
| #include "content/public/common/sandbox_init.h" |
| +#include "content/public/common/content_switches.h" |
| #include "content/public/test/browser_test.h" |
| #include "net/base/escape.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -643,9 +646,43 @@ const char kHelpFlag[] = "help"; |
| const char kWarmupFlag[] = "warmup"; |
| +extern const char kLaunchAsBrowser[] = "as-browser"; |
|
jam
2012/09/04 15:18:14
nit: no extern
phoglund_chromium
2012/09/05 09:41:05
Done.
|
| + |
| TestLauncherDelegate::~TestLauncherDelegate() { |
| } |
| +bool TestLauncherDelegate::Run(int argc, char** argv, int* return_code) { |
| +#if defined(OS_WIN) || defined(OS_LINUX) |
| + CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| + bool launch_chrome = |
|
jam
2012/09/04 15:18:14
nit: now that this code is in content, launch_chro
phoglund_chromium
2012/09/05 09:41:05
I split this method into two instead, so that vari
|
| + command_line->HasSwitch(switches::kProcessType) || |
| + command_line->HasSwitch(kLaunchAsBrowser); |
| +#endif |
| +#if defined(OS_WIN) |
| + if (launch_chrome) { |
| + sandbox::SandboxInterfaceInfo sandbox_info = {0}; |
| + content::InitializeSandboxInfo(&sandbox_info); |
| + scoped_ptr<content::ContentMainDelegate> chrome_main_delegate( |
| + CreateContentMainDelegate()); |
| + *return_code = content::ContentMain(GetModuleHandle(NULL), |
| + &sandbox_info, |
| + chrome_main_delegate.get()); |
| + return true; |
| + } |
| +#elif defined(OS_LINUX) |
| + if (launch_chrome) { |
| + scoped_ptr<content::ContentMainDelegate> chrome_main_delegate( |
| + CreateContentMainDelegate()); |
| + *return_code = content::ContentMain(argc, |
| + const_cast<const char**>(argv), |
| + chrome_main_delegate.get()); |
| + return true; |
| + } |
| +#endif // defined(OS_WIN) |
| + |
| + return false; |
| +} |
| + |
| int LaunchTests(TestLauncherDelegate* launcher_delegate, |
| int argc, |
| char** argv) { |