Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/test/test_suite.h" | 5 #include "ash/test/test_suite.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
| 14 #include "ui/base/ui_base_paths.h" | 14 #include "ui/base/ui_base_paths.h" |
| 15 #include "ui/compositor/compositor_setup.h" | 15 #include "ui/compositor/compositor_setup.h" |
| 16 #include "ui/compositor/test/compositor_test_support.h" | 16 #include "ui/compositor/test/compositor_test_support.h" |
| 17 #include "ui/gfx/gfx_paths.h" | 17 #include "ui/gfx/gfx_paths.h" |
| 18 | 18 |
| 19 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
| 20 #include "ash/test/test_suite_init.h" | 20 #include "ash/test/test_suite_init.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
| 24 #include "base/win/windows_version.h" | 24 #include "base/win/windows_version.h" |
| 25 #include "ui/base/win/atl_module.h" | 25 #include "ui/base/win/atl_module.h" |
| 26 #include "win8/test/metro_registration_helper.h" | 26 #include "win8/test/metro_registration_helper.h" |
| 27 #include "win8/test/open_with_dialog_controller.h" | |
| 28 #include "win8/test/test_registrar_constants.h" | 27 #include "win8/test/test_registrar_constants.h" |
| 29 #endif | 28 #endif |
| 30 | 29 |
| 31 namespace ash { | 30 namespace ash { |
| 32 namespace test { | 31 namespace test { |
| 33 | 32 |
| 34 AuraShellTestSuite::AuraShellTestSuite(int argc, char** argv) | 33 AuraShellTestSuite::AuraShellTestSuite(int argc, char** argv) |
| 35 : TestSuite(argc, argv) {} | 34 : TestSuite(argc, argv) {} |
| 36 | 35 |
| 37 void AuraShellTestSuite::Initialize() { | 36 void AuraShellTestSuite::Initialize() { |
| 38 base::TestSuite::Initialize(); | 37 base::TestSuite::Initialize(); |
| 39 | 38 |
| 40 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
| 41 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && | 40 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && |
| 42 !CommandLine::ForCurrentProcess()->HasSwitch( | 41 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 43 ash::switches::kForceAshToDesktop)) { | 42 ash::switches::kForceAshToDesktop)) { |
| 44 ASSERT_TRUE(win8::RegisterTestDefaultBrowser( | 43 com_initializer_.reset(new base::win::ScopedCOMInitializer()); |
| 45 win8::test::kDefaultTestAppUserModelId, | |
| 46 win8::test::kDefaultTestExeName)); | |
| 47 | |
| 48 ui::win::CreateATLModuleIfNeeded(); | 44 ui::win::CreateATLModuleIfNeeded(); |
| 49 | 45 ASSERT_TRUE(win8::MakeTestDefaultBrowserSynchronously()); |
| 50 std::vector<base::string16> choices; | |
| 51 win8::OpenWithDialogController controller; | |
| 52 controller.RunSynchronously(NULL, L"http", win8::test::kDefaultTestExeName, | |
| 53 &choices); | |
| 54 } | 46 } |
| 55 #endif | 47 #endif |
| 56 | 48 |
| 57 gfx::RegisterPathProvider(); | 49 gfx::RegisterPathProvider(); |
| 58 ui::RegisterPathProvider(); | 50 ui::RegisterPathProvider(); |
| 59 | 51 |
| 60 #if defined(OS_MACOSX) | 52 #if defined(OS_MACOSX) |
| 61 ash::test::OverrideFrameworkBundle(); | 53 ash::test::OverrideFrameworkBundle(); |
| 62 #endif | 54 #endif |
| 63 | 55 |
| 64 // Force unittests to run using en-US so if we test against string | 56 // Force unittests to run using en-US so if we test against string |
| 65 // output, it'll pass regardless of the system language. | 57 // output, it'll pass regardless of the system language. |
| 66 ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); | 58 ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); |
| 67 ui::CompositorTestSupport::Initialize(); | 59 ui::CompositorTestSupport::Initialize(); |
| 68 ui::SetupTestCompositor(); | 60 ui::SetupTestCompositor(); |
| 69 } | 61 } |
| 70 | 62 |
| 71 void AuraShellTestSuite::Shutdown() { | 63 void AuraShellTestSuite::Shutdown() { |
| 64 #if defined(OS_WIN) | |
|
grt (UTC plus 2)
2013/05/28 01:17:48
move this down after the two ui:: cleanups so that
gab
2013/05/28 13:49:43
Done.
| |
| 65 com_initializer_.reset(); | |
| 66 #endif | |
| 72 ui::CompositorTestSupport::Terminate(); | 67 ui::CompositorTestSupport::Terminate(); |
| 73 ui::ResourceBundle::CleanupSharedInstance(); | 68 ui::ResourceBundle::CleanupSharedInstance(); |
| 74 base::TestSuite::Shutdown(); | 69 base::TestSuite::Shutdown(); |
| 75 } | 70 } |
| 76 | 71 |
| 77 } // namespace test | 72 } // namespace test |
| 78 } // namespace ash | 73 } // namespace ash |
| OLD | NEW |