 Chromium Code Reviews
 Chromium Code Reviews 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/
    
  
    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/| Index: content/public/test/browser_test_base.cc | 
| =================================================================== | 
| --- content/public/test/browser_test_base.cc (revision 257128) | 
| +++ content/public/test/browser_test_base.cc (working copy) | 
| @@ -7,12 +7,15 @@ | 
| #include "base/bind.h" | 
| #include "base/command_line.h" | 
| #include "base/debug/stack_trace.h" | 
| +#include "base/i18n/icu_util.h" | 
| #include "base/message_loop/message_loop.h" | 
| #include "base/sys_info.h" | 
| +#include "content/public/app/content_main.h" | 
| #include "content/browser/renderer_host/render_process_host_impl.h" | 
| #include "content/public/browser/browser_thread.h" | 
| #include "content/public/common/content_switches.h" | 
| #include "content/public/common/main_function_params.h" | 
| +#include "content/public/test/test_launcher.h" | 
| #include "content/public/test/test_utils.h" | 
| #include "net/base/net_errors.h" | 
| #include "net/dns/mock_host_resolver.h" | 
| @@ -27,7 +30,6 @@ | 
| #if defined(OS_MACOSX) | 
| #include "base/mac/mac_util.h" | 
| -#include "base/power_monitor/power_monitor_device_source.h" | 
| #endif | 
| #if defined(OS_ANDROID) | 
| @@ -121,13 +123,17 @@ | 
| : enable_pixel_output_(false), use_software_compositing_(false) { | 
| #if defined(OS_MACOSX) | 
| base::mac::SetOverrideAmIBundled(true); | 
| - base::PowerMonitorDeviceSource::AllocateSystemIOPorts(); | 
| #endif | 
| #if defined(OS_POSIX) | 
| handle_sigterm_ = true; | 
| #endif | 
| + // This is called through base::TestSuite initially. It'll also be called | 
| + // inside BrowserMain, so tell the code to ignore the check that it's being | 
| + // called more than once | 
| + base::i18n::AllowMultipleInitializeCallsForTesting(); | 
| + | 
| embedded_test_server_.reset(new net::test_server::EmbeddedTestServer); | 
| } | 
| @@ -224,9 +230,13 @@ | 
| rule_based_resolver_.get()); | 
| SetUpInProcessBrowserTestFixture(); | 
| MainFunctionParams params(*command_line); | 
| + | 
| + | 
| + ///* | 
| 
sky
2014/03/14 21:35:56
I assume this and 251 is temporary.
 
jam
2014/03/14 22:35:40
Done.
 | 
| params.ui_task = | 
| new base::Closure( | 
| base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this)); | 
| + //*/ | 
| #if defined(OS_ANDROID) | 
| BrowserMainRunner::Create()->Initialize(params); | 
| @@ -238,7 +248,12 @@ | 
| base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), | 
| true)); | 
| #else | 
| - BrowserMain(params); | 
| + ///* | 
| +///////////////////////////// BrowserMain(params); | 
| + //*/ | 
| + ////BrowserTestBase::ProxyRunTestOnMainThreadLoop(); | 
| + GetContentMainParams()->ui_task = params.ui_task; | 
| + ContentMain(*GetContentMainParams()); | 
| #endif | 
| TearDownInProcessBrowserTestFixture(); | 
| } | 
| @@ -253,6 +268,7 @@ | 
| signal(SIGTERM, DumpStackTraceSignalHandler); | 
| } | 
| #endif // defined(OS_POSIX) | 
| + | 
| RunTestOnMainThreadLoop(); | 
| } |