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

Unified Diff: content/public/test/browser_test_base.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/app/content_main.h ('k') | content/public/test/content_test_suite_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/browser_test_base.cc
===================================================================
--- content/public/test/browser_test_base.cc (revision 257432)
+++ 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);
}
@@ -223,12 +229,14 @@
net::ScopedDefaultHostResolverProc scoped_local_host_resolver_proc(
rule_based_resolver_.get());
SetUpInProcessBrowserTestFixture();
- MainFunctionParams params(*command_line);
- params.ui_task =
+
+ base::Closure* ui_task =
new base::Closure(
base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this));
#if defined(OS_ANDROID)
+ MainFunctionParams params(*command_line);
+ params.ui_task = ui_task;
BrowserMainRunner::Create()->Initialize(params);
// We are done running the test by now. During teardown we
// need to be able to perform IO.
@@ -238,7 +246,8 @@
base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed),
true));
#else
- BrowserMain(params);
+ GetContentMainParams()->ui_task = ui_task;
+ ContentMain(*GetContentMainParams());
#endif
TearDownInProcessBrowserTestFixture();
}
« no previous file with comments | « content/public/app/content_main.h ('k') | content/public/test/content_test_suite_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698