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

Unified Diff: content/public/test/test_launcher.cc

Issue 190663012: Run ContentMain in a browser_test's browser process. This removes duplication of code in the browse… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: try to fix android by restoring old path just for it Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/test/test_launcher.h ('k') | content/renderer/browser_plugin/browser_plugin_browsertest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/test_launcher.cc
===================================================================
--- content/public/test/test_launcher.cc (revision 257432)
+++ content/public/test/test_launcher.cc (working copy)
@@ -60,6 +60,7 @@
const char kManualTestPrefix[] = "MANUAL_";
TestLauncherDelegate* g_launcher_delegate;
+ContentMainParams* g_params;
std::string RemoveAnyPrePrefixes(const std::string& test_name) {
std::string result(test_name);
@@ -427,35 +428,6 @@
TestLauncherDelegate::~TestLauncherDelegate() {
}
-#if defined(OS_WIN) || defined(OS_LINUX)
-bool ShouldRunContentMain() {
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- return command_line->HasSwitch(switches::kProcessType) ||
- command_line->HasSwitch(kLaunchAsBrowser);
- return false;
-}
-
-int RunContentMain(int argc, char** argv,
- TestLauncherDelegate* launcher_delegate) {
- scoped_ptr<ContentMainDelegate> chrome_main_delegate(
- launcher_delegate->CreateContentMainDelegate());
- ContentMainParams params(chrome_main_delegate.get());
-
-#if defined(OS_WIN)
- sandbox::SandboxInterfaceInfo sandbox_info = {0};
- InitializeSandboxInfo(&sandbox_info);
-
- params.instance = GetModuleHandle(NULL);
- params.sandbox_info = &sandbox_info;
-#elif defined(OS_LINUX)
- params.argc = argc;
- params.argv = const_cast<const char**>(argv);
-#endif // defined(OS_WIN)
-
- return ContentMain(params);
-}
-#endif
-
int LaunchTests(TestLauncherDelegate* launcher_delegate,
int default_jobs,
int argc,
@@ -471,24 +443,35 @@
return 0;
}
+ scoped_ptr<ContentMainDelegate> chrome_main_delegate(
+ launcher_delegate->CreateContentMainDelegate());
+ ContentMainParams params(chrome_main_delegate.get());
+
+#if defined(OS_WIN)
+ sandbox::SandboxInterfaceInfo sandbox_info = {0};
+ InitializeSandboxInfo(&sandbox_info);
+
+ params.instance = GetModuleHandle(NULL);
+ params.sandbox_info = &sandbox_info;
+#elif !defined(OS_ANDROID)
+ params.argc = argc;
+ params.argv = const_cast<const char**>(argv);
+#endif // defined(OS_WIN)
+
if (command_line->HasSwitch(kSingleProcessTestsFlag) ||
(command_line->HasSwitch(switches::kSingleProcess) &&
command_line->HasSwitch(base::kGTestFilterFlag)) ||
command_line->HasSwitch(base::kGTestListTestsFlag) ||
command_line->HasSwitch(base::kGTestHelpFlag)) {
-#if defined(OS_WIN)
- if (command_line->HasSwitch(kSingleProcessTestsFlag)) {
- sandbox::SandboxInterfaceInfo sandbox_info;
- InitializeSandboxInfo(&sandbox_info);
- InitializeSandbox(&sandbox_info);
- }
-#endif
+ g_params = &params;
return launcher_delegate->RunTestSuite(argc, argv);
}
-#if defined(OS_WIN) || defined(OS_LINUX)
- if (ShouldRunContentMain())
- return RunContentMain(argc, argv, launcher_delegate);
+#if !defined(OS_ANDROID)
+ if (command_line->HasSwitch(switches::kProcessType) ||
+ command_line->HasSwitch(kLaunchAsBrowser)) {
+ return ContentMain(params);
+ }
#endif
base::AtExitManager at_exit;
@@ -518,4 +501,8 @@
return g_launcher_delegate;
}
+ContentMainParams* GetContentMainParams() {
+ return g_params;
+}
+
} // namespace content
« no previous file with comments | « content/public/test/test_launcher.h ('k') | content/renderer/browser_plugin/browser_plugin_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698