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..293c4c8bbd9ada11bd10a41f00021704be8b97ba 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 |
@@ -159,6 +169,18 @@ void InProcessBrowserTest::SetUp() { |
google_util::SetMockLinkDoctorBaseURLForTesting(); |
+#if defined(OS_WIN) && defined(USE_AURA) |
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8 && |
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) { |
+ com_initializer_.reset(new base::win::ScopedCOMInitializer()); |
+ ui::win::CreateATLModuleIfNeeded(); |
+ ASSERT_TRUE(win8::MakeTestDefaultBrowserSynchronously()); |
+ |
+ // Ash browser tests need the real compositor. |
+ ui::DisableTestCompositor(); |
+ } |
+#endif |
+ |
BrowserTestBase::SetUp(); |
} |
@@ -169,6 +191,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. |
@@ -212,6 +241,9 @@ bool InProcessBrowserTest::CreateUserDataDirectory() { |
void InProcessBrowserTest::TearDown() { |
DCHECK(!g_browser_process); |
+#if defined(OS_WIN) && defined(USE_AURA) |
+ com_initializer_.reset(); |
+#endif |
BrowserTestBase::TearDown(); |
} |