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

Unified Diff: chrome/test/base/in_process_browser_test.cc

Issue 16022003: Base for Ash browser_tests on Win8. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Call ui::DisableTestCompositor() in InProcessBrowserTest::SetUpTestCase Created 7 years, 6 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 | « chrome/test/base/in_process_browser_test.h ('k') | chrome/test/base/test_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/in_process_browser_test.cc
diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc
index 5cdbf8f4bc990029fbbc0421f4b26be7fefa57ef..a8342f867d345ace3e919f27ce603f92e147481d 100644
--- a/chrome/test/base/in_process_browser_test.cc
+++ b/chrome/test/base/in_process_browser_test.cc
@@ -36,6 +36,7 @@
#include "chrome/renderer/chrome_content_renderer_client.h"
#include "chrome/test/base/chrome_test_suite.h"
#include "chrome/test/base/test_launcher_utils.h"
+#include "chrome/test/base/test_switches.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_service.h"
@@ -54,6 +55,15 @@
#include "base/mac/scoped_nsautorelease_pool.h"
#endif
+#if defined(OS_WIN) && defined(USE_AURA)
+#include "base/win/scoped_com_initializer.h"
+#include "base/win/windows_version.h"
+#include "ui/base/win/atl_module.h"
+#include "ui/compositor/compositor_setup.h"
+#include "win8/test/metro_registration_helper.h"
+#include "win8/test/test_registrar_constants.h"
+#endif
+
#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
#include "chrome/browser/captive_portal/captive_portal_service.h"
#endif
@@ -69,6 +79,11 @@ base::LazyInstance<chrome::ChromeContentRendererClient>::Leaky
} // namespace
+#if defined(OS_WIN) && defined(USE_AURA)
+//static
+base::win::ScopedCOMInitializer* InProcessBrowserTest::com_initializer_ = NULL;
+#endif
+
InProcessBrowserTest::InProcessBrowserTest()
: browser_(NULL),
exit_when_last_browser_closes_(true)
@@ -94,6 +109,32 @@ InProcessBrowserTest::InProcessBrowserTest()
InProcessBrowserTest::~InProcessBrowserTest() {
}
+//static
+void InProcessBrowserTest::SetUpTestCase() {
jam 2013/06/21 16:32:05 I'm not sure I understand the usage of this static
gab 2013/06/21 16:47:00 Ah ok, sounds good, I had noticed this was the cas
+ BrowserTestBase::SetUpTestCase();
+
+#if defined(OS_WIN) && defined(USE_AURA)
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) {
+ com_initializer_ = new base::win::ScopedCOMInitializer();
+ ui::win::CreateATLModuleIfNeeded();
+ ASSERT_TRUE(win8::MakeTestDefaultBrowserSynchronously());
+
+ // Ash browser tests need the real compositor.
+ ui::DisableTestCompositor();
+ }
+#endif
+}
+
+//static
+void InProcessBrowserTest::TearDownTestCase() {
+#if defined(OS_WIN) && defined(USE_AURA)
+ delete com_initializer_;
+ com_initializer_ = NULL;
+#endif
+ BrowserTestBase::TearDownTestCase();
+}
+
void InProcessBrowserTest::SetUp() {
// Undo TestingBrowserProcess creation in ChromeTestSuite.
// TODO(phajdan.jr): Extract a smaller test suite so we don't need this.
@@ -169,6 +210,13 @@ void InProcessBrowserTest::PrepareTestCommandLine(CommandLine* command_line) {
// This is a Browser test.
command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType);
+#if defined(OS_WIN) && defined(USE_AURA)
+ if (command_line->HasSwitch(switches::kAshBrowserTests)) {
+ command_line->AppendSwitchNative(switches::kViewerLaunchViaAppId,
+ win8::test::kDefaultTestAppUserModelId);
+ }
+#endif
+
#if defined(OS_MACOSX)
// Explicitly set the path of the binary used for child processes, otherwise
// they'll try to use browser_tests which doesn't contain ChromeMain.
« no previous file with comments | « chrome/test/base/in_process_browser_test.h ('k') | chrome/test/base/test_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698