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/gfx/gfx_paths.h" | 15 #include "ui/gfx/gfx_paths.h" |
16 | 16 |
17 #if defined(OS_MACOSX) | |
18 #include "ash/test/test_suite_init.h" | |
19 #endif | |
20 | |
21 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
22 #include "base/win/windows_version.h" | 18 #include "base/win/windows_version.h" |
23 #include "ui/base/win/atl_module.h" | 19 #include "ui/base/win/atl_module.h" |
24 #include "win8/test/metro_registration_helper.h" | 20 #include "win8/test/metro_registration_helper.h" |
25 #include "win8/test/test_registrar_constants.h" | 21 #include "win8/test/test_registrar_constants.h" |
26 #endif | 22 #endif |
27 | 23 |
28 namespace ash { | 24 namespace ash { |
29 namespace test { | 25 namespace test { |
30 | 26 |
31 AuraShellTestSuite::AuraShellTestSuite(int argc, char** argv) | 27 AuraShellTestSuite::AuraShellTestSuite(int argc, char** argv) |
32 : TestSuite(argc, argv) {} | 28 : TestSuite(argc, argv) {} |
33 | 29 |
34 void AuraShellTestSuite::Initialize() { | 30 void AuraShellTestSuite::Initialize() { |
35 base::TestSuite::Initialize(); | 31 base::TestSuite::Initialize(); |
36 | 32 |
37 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
38 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && | 34 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && |
39 !CommandLine::ForCurrentProcess()->HasSwitch( | 35 !CommandLine::ForCurrentProcess()->HasSwitch( |
40 ash::switches::kForceAshToDesktop)) { | 36 ash::switches::kForceAshToDesktop)) { |
41 com_initializer_.reset(new base::win::ScopedCOMInitializer()); | 37 com_initializer_.reset(new base::win::ScopedCOMInitializer()); |
42 ui::win::CreateATLModuleIfNeeded(); | 38 ui::win::CreateATLModuleIfNeeded(); |
43 ASSERT_TRUE(win8::MakeTestDefaultBrowserSynchronously()); | 39 ASSERT_TRUE(win8::MakeTestDefaultBrowserSynchronously()); |
44 } | 40 } |
45 #endif | 41 #endif |
46 | 42 |
47 gfx::RegisterPathProvider(); | 43 gfx::RegisterPathProvider(); |
48 ui::RegisterPathProvider(); | 44 ui::RegisterPathProvider(); |
49 | 45 |
50 #if defined(OS_MACOSX) | |
51 ash::test::OverrideFrameworkBundle(); | |
52 #endif | |
53 | |
54 // Force unittests to run using en-US so if we test against string | 46 // Force unittests to run using en-US so if we test against string |
55 // output, it'll pass regardless of the system language. | 47 // output, it'll pass regardless of the system language. |
56 ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); | 48 ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); |
57 } | 49 } |
58 | 50 |
59 void AuraShellTestSuite::Shutdown() { | 51 void AuraShellTestSuite::Shutdown() { |
60 ui::ResourceBundle::CleanupSharedInstance(); | 52 ui::ResourceBundle::CleanupSharedInstance(); |
61 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
62 com_initializer_.reset(); | 54 com_initializer_.reset(); |
63 #endif | 55 #endif |
64 base::TestSuite::Shutdown(); | 56 base::TestSuite::Shutdown(); |
65 } | 57 } |
66 | 58 |
67 } // namespace test | 59 } // namespace test |
68 } // namespace ash | 60 } // namespace ash |
OLD | NEW |