summaryrefslogtreecommitdiffstats
path: root/ash/test
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-18 04:25:35 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-18 04:25:35 +0000
commita88f63686baa4751ab6638413ca7b62f8a3c2738 (patch)
tree0b8a7e13326055789131f47ef4dd60ba707d33f7 /ash/test
parentd75d14350f6875855cc465ba06a2e3807b879269 (diff)
downloadchromium_src-a88f63686baa4751ab6638413ca7b62f8a3c2738.zip
chromium_src-a88f63686baa4751ab6638413ca7b62f8a3c2738.tar.gz
chromium_src-a88f63686baa4751ab6638413ca7b62f8a3c2738.tar.bz2
Run ContentMain in a browser_test's browser process. This removes duplication of code in the browser test harness for setting up the browser process, and also ensures that initialization code in ContentMainRunner runs.
Most of the changes are to unit tests which run in browser test executables. These were getting all the setup that these binaries did for browser tests even though they were unit tests. Now they have to explicitly setup objects that they need. This would be done automatically if they were in a unit test binary and therefore using the unit test harness. The goal should be to move these tests to unit test binaries, and make them support launching some tests in separate processes building on the work that Pawel did. BUG=350550 R=sky@chromium.org Review URL: https://codereview.chromium.org/190663012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257597 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/test')
-rw-r--r--ash/test/ash_test_base.cc12
-rw-r--r--ash/test/ash_test_base.h2
2 files changed, 13 insertions, 1 deletions
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc
index 9c9cbe3..1f2156b 100644
--- a/ash/test/ash_test_base.cc
+++ b/ash/test/ash_test_base.cc
@@ -48,6 +48,10 @@
#include "win8/test/test_registrar_constants.h"
#endif
+#if defined(USE_X11)
+#include <X11/Xlib.h>
+#endif
+
namespace ash {
namespace test {
namespace {
@@ -90,6 +94,14 @@ AshTestBase::AshTestBase()
: setup_called_(false),
teardown_called_(false),
start_session_(true) {
+#if defined(USE_X11)
+ // This is needed for tests which use this base class but are run in browser
+ // test binaries so don't get the default initialization in the unit test
+ // suite.
+ XInitThreads();
+#endif
+
+ thread_bundle_.reset(new content::TestBrowserThreadBundle);
// Must initialize |ash_test_helper_| here because some tests rely on
// AshTestBase methods before they call AshTestBase::SetUp().
ash_test_helper_.reset(new AshTestHelper(base::MessageLoopForUI::current()));
diff --git a/ash/test/ash_test_base.h b/ash/test/ash_test_base.h
index 5de30db..c7bdbbb 100644
--- a/ash/test/ash_test_base.h
+++ b/ash/test/ash_test_base.h
@@ -139,7 +139,7 @@ class AshTestBase : public testing::Test {
bool teardown_called_;
// |SetUp()| doesn't activate session if this is set to false.
bool start_session_;
- content::TestBrowserThreadBundle thread_bundle_;
+ scoped_ptr<content::TestBrowserThreadBundle> thread_bundle_;
scoped_ptr<AshTestHelper> ash_test_helper_;
scoped_ptr<aura::test::EventGenerator> event_generator_;
#if defined(OS_WIN)