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 "content/test/test_launcher.h" | 5 #include "content/test/test_launcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
10 #include "base/test/test_file_util.h" | 10 #include "base/test/test_file_util.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 virtual ~ChromeTestLauncherDelegate() { | 31 virtual ~ChromeTestLauncherDelegate() { |
32 } | 32 } |
33 | 33 |
34 virtual void EarlyInitialize() OVERRIDE { | 34 virtual void EarlyInitialize() OVERRIDE { |
35 #if defined(OS_MACOSX) | 35 #if defined(OS_MACOSX) |
36 chrome_browser_application_mac::RegisterBrowserCrApp(); | 36 chrome_browser_application_mac::RegisterBrowserCrApp(); |
37 #endif | 37 #endif |
38 } | 38 } |
39 | 39 |
40 virtual bool Run(int argc, char** argv, int* return_code) OVERRIDE { | 40 virtual bool Run(int argc, char** argv, int* return_code) OVERRIDE { |
| 41 #if defined(OS_WIN) || defined(OS_LINUX) |
| 42 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 43 bool launch_chrome = |
| 44 command_line->HasSwitch(switches::kProcessType) || |
| 45 command_line->HasSwitch(ChromeTestSuite::kLaunchAsBrowser); |
| 46 #endif |
41 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
42 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 48 if (launch_chrome) { |
43 if (command_line->HasSwitch(switches::kProcessType)) { | |
44 sandbox::SandboxInterfaceInfo sandbox_info = {0}; | 49 sandbox::SandboxInterfaceInfo sandbox_info = {0}; |
45 content::InitializeSandboxInfo(&sandbox_info); | 50 content::InitializeSandboxInfo(&sandbox_info); |
46 ChromeMainDelegate chrome_main_delegate; | 51 ChromeMainDelegate chrome_main_delegate; |
47 *return_code = content::ContentMain(GetModuleHandle(NULL), | 52 *return_code = content::ContentMain(GetModuleHandle(NULL), |
48 &sandbox_info, | 53 &sandbox_info, |
49 &chrome_main_delegate); | 54 &chrome_main_delegate); |
50 return true; | 55 return true; |
51 } | 56 } |
52 #elif defined(OS_LINUX) | 57 #elif defined(OS_LINUX) |
53 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 58 if (launch_chrome) { |
54 if (command_line->HasSwitch(switches::kProcessType)) { | |
55 ChromeMainDelegate chrome_main_delegate; | 59 ChromeMainDelegate chrome_main_delegate; |
56 *return_code = content::ContentMain(argc, | 60 *return_code = content::ContentMain(argc, |
57 const_cast<const char**>(argv), | 61 const_cast<const char**>(argv), |
58 &chrome_main_delegate); | 62 &chrome_main_delegate); |
59 return true; | 63 return true; |
60 } | 64 } |
61 #endif // defined(OS_WIN) | 65 #endif // defined(OS_WIN) |
62 | 66 |
63 return false; | 67 return false; |
64 } | 68 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 private: | 109 private: |
106 ScopedTempDir temp_dir_; | 110 ScopedTempDir temp_dir_; |
107 | 111 |
108 DISALLOW_COPY_AND_ASSIGN(ChromeTestLauncherDelegate); | 112 DISALLOW_COPY_AND_ASSIGN(ChromeTestLauncherDelegate); |
109 }; | 113 }; |
110 | 114 |
111 int main(int argc, char** argv) { | 115 int main(int argc, char** argv) { |
112 ChromeTestLauncherDelegate launcher_delegate; | 116 ChromeTestLauncherDelegate launcher_delegate; |
113 return test_launcher::LaunchTests(&launcher_delegate, argc, argv); | 117 return test_launcher::LaunchTests(&launcher_delegate, argc, argv); |
114 } | 118 } |
OLD | NEW |