Chromium Code Reviews| 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..fe2cf0ca9e2f33abb261f8a117dfde98f20e157f 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,14 @@ |
| #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 "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 |
| @@ -94,6 +103,28 @@ InProcessBrowserTest::InProcessBrowserTest() |
| InProcessBrowserTest::~InProcessBrowserTest() { |
| } |
| +//static |
| +void InProcessBrowserTest::SetUpTestCase() { |
| + 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()); |
| + } |
| +#endif |
| +} |
| + |
| +//static |
| +void InProcessBrowserTest::TearDownTestCase() { |
| +#if defined(OS_WIN) && defined(USE_AURA) |
| + delete com_initializer_; |
|
grt (UTC plus 2)
2013/06/20 23:10:06
com_initializer_ = NULL; after calling delete
gab
2013/06/20 23:47:21
Done.
|
| +#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 +200,15 @@ 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); |
| + // Ash browser tests need the real compositor. |
| + command_line->AppendSwitch(switches::kDisableTestCompositor); |
| + } |
| +#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. |
| @@ -399,3 +439,8 @@ void InProcessBrowserTest::QuitBrowsers() { |
| autorelease_pool_ = NULL; |
| #endif |
| } |
| + |
| +#if defined(OS_WIN) && defined(USE_AURA) |
| +//static |
| +base::win::ScopedCOMInitializer* InProcessBrowserTest::com_initializer_ = NULL; |
|
grt (UTC plus 2)
2013/06/20 23:10:06
i find it natural for static member definitions li
gab
2013/06/20 23:47:21
Done.
|
| +#endif |