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/common/ash_switches.h" | 7 #include "ash/common/ash_switches.h" |
8 #include "ash/test/ash_test_environment.h" | 8 #include "ash/test/ash_test_environment.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "ui/aura/env.h" | 15 #include "ui/aura/env.h" |
16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/base/ui_base_paths.h" | 17 #include "ui/base/ui_base_paths.h" |
18 #include "ui/gfx/gfx_paths.h" | 18 #include "ui/gfx/gfx_paths.h" |
19 #include "ui/gl/test/gl_surface_test_support.h" | 19 #include "ui/gl/test/gl_surface_test_support.h" |
20 | 20 |
21 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
22 #include "base/win/windows_version.h" | 22 #include "base/win/scoped_com_initializer.h" |
23 #include "ui/base/win/atl_module.h" | 23 #include "ui/base/win/atl_module.h" |
24 #endif | 24 #endif |
25 | 25 |
26 namespace ash { | 26 namespace ash { |
27 namespace test { | 27 namespace test { |
28 | 28 |
29 AuraShellTestSuite::AuraShellTestSuite(int argc, char** argv) | 29 AuraShellTestSuite::AuraShellTestSuite(int argc, char** argv) |
30 : TestSuite(argc, argv) {} | 30 : TestSuite(argc, argv) {} |
31 | 31 |
32 AuraShellTestSuite::~AuraShellTestSuite() {} | 32 AuraShellTestSuite::~AuraShellTestSuite() {} |
33 | 33 |
34 void AuraShellTestSuite::Initialize() { | 34 void AuraShellTestSuite::Initialize() { |
35 base::TestSuite::Initialize(); | 35 base::TestSuite::Initialize(); |
36 gl::GLSurfaceTestSupport::InitializeOneOff(); | 36 gl::GLSurfaceTestSupport::InitializeOneOff(); |
37 | 37 |
38 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
39 base::win::Version version = base::win::GetVersion(); | 39 com_initializer_.reset(new base::win::ScopedCOMInitializer()); |
40 // Although Ash officially is only supported for users on Win7+, we still run | 40 ui::win::CreateATLModuleIfNeeded(); |
41 // ash_unittests on Vista builders, so we still need to initialize COM. | |
42 if (version >= base::win::VERSION_VISTA && | |
43 !base::CommandLine::ForCurrentProcess()->HasSwitch( | |
44 ash::switches::kForceAshToDesktop)) { | |
45 com_initializer_.reset(new base::win::ScopedCOMInitializer()); | |
46 ui::win::CreateATLModuleIfNeeded(); | |
47 } | |
48 #endif | 41 #endif |
49 | 42 |
50 gfx::RegisterPathProvider(); | 43 gfx::RegisterPathProvider(); |
51 ui::RegisterPathProvider(); | 44 ui::RegisterPathProvider(); |
52 | 45 |
53 // Force unittests to run using en-US so if we test against string output, | 46 // Force unittests to run using en-US so if we test against string output, |
54 // it'll pass regardless of the system language. | 47 // it'll pass regardless of the system language. |
55 base::i18n::SetICUDefaultLocale("en_US"); | 48 base::i18n::SetICUDefaultLocale("en_US"); |
56 | 49 |
57 // Load ash test resources and en-US strings; not 'common' (Chrome) resources. | 50 // Load ash test resources and en-US strings; not 'common' (Chrome) resources. |
(...skipping 24 matching lines...) Expand all Loading... |
82 env_.reset(); | 75 env_.reset(); |
83 ui::ResourceBundle::CleanupSharedInstance(); | 76 ui::ResourceBundle::CleanupSharedInstance(); |
84 #if defined(OS_WIN) | 77 #if defined(OS_WIN) |
85 com_initializer_.reset(); | 78 com_initializer_.reset(); |
86 #endif | 79 #endif |
87 base::TestSuite::Shutdown(); | 80 base::TestSuite::Shutdown(); |
88 } | 81 } |
89 | 82 |
90 } // namespace test | 83 } // namespace test |
91 } // namespace ash | 84 } // namespace ash |
OLD | NEW |