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/test/ash_test_environment.h" | 7 #include "ash/test/ash_test_environment.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/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "ui/aura/env.h" | 14 #include "ui/aura/env.h" |
15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
16 #include "ui/base/ui_base_paths.h" | 16 #include "ui/base/ui_base_paths.h" |
17 #include "ui/gfx/gfx_paths.h" | 17 #include "ui/gfx/gfx_paths.h" |
18 #include "ui/gl/test/gl_surface_test_support.h" | 18 #include "ui/gl/test/gl_surface_test_support.h" |
19 | 19 |
20 #if defined(OS_WIN) | |
21 #include "base/win/scoped_com_initializer.h" | |
22 #include "ui/base/win/atl_module.h" | |
23 #endif | |
24 | |
25 namespace ash { | 20 namespace ash { |
26 namespace test { | 21 namespace test { |
27 | 22 |
28 AuraShellTestSuite::AuraShellTestSuite(int argc, char** argv) | 23 AuraShellTestSuite::AuraShellTestSuite(int argc, char** argv) |
29 : TestSuite(argc, argv) {} | 24 : TestSuite(argc, argv) {} |
30 | 25 |
31 AuraShellTestSuite::~AuraShellTestSuite() {} | 26 AuraShellTestSuite::~AuraShellTestSuite() {} |
32 | 27 |
33 void AuraShellTestSuite::Initialize() { | 28 void AuraShellTestSuite::Initialize() { |
34 base::TestSuite::Initialize(); | 29 base::TestSuite::Initialize(); |
35 gl::GLSurfaceTestSupport::InitializeOneOff(); | 30 gl::GLSurfaceTestSupport::InitializeOneOff(); |
36 | 31 |
37 #if defined(OS_WIN) | |
38 com_initializer_.reset(new base::win::ScopedCOMInitializer()); | |
39 ui::win::CreateATLModuleIfNeeded(); | |
40 #endif | |
41 | |
42 gfx::RegisterPathProvider(); | 32 gfx::RegisterPathProvider(); |
43 ui::RegisterPathProvider(); | 33 ui::RegisterPathProvider(); |
44 | 34 |
45 // Force unittests to run using en-US so if we test against string output, | 35 // Force unittests to run using en-US so if we test against string output, |
46 // it'll pass regardless of the system language. | 36 // it'll pass regardless of the system language. |
47 base::i18n::SetICUDefaultLocale("en_US"); | 37 base::i18n::SetICUDefaultLocale("en_US"); |
48 | 38 |
49 // Load ash test resources and en-US strings; not 'common' (Chrome) resources. | 39 // Load ash test resources and en-US strings; not 'common' (Chrome) resources. |
50 base::FilePath path; | 40 base::FilePath path; |
51 PathService::Get(base::DIR_MODULE, &path); | 41 PathService::Get(base::DIR_MODULE, &path); |
(...skipping 14 matching lines...) Expand all Loading... |
66 ash_test_resources_200, ui::SCALE_FACTOR_200P); | 56 ash_test_resources_200, ui::SCALE_FACTOR_200P); |
67 } | 57 } |
68 | 58 |
69 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); | 59 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); |
70 env_ = aura::Env::CreateInstance(); | 60 env_ = aura::Env::CreateInstance(); |
71 } | 61 } |
72 | 62 |
73 void AuraShellTestSuite::Shutdown() { | 63 void AuraShellTestSuite::Shutdown() { |
74 env_.reset(); | 64 env_.reset(); |
75 ui::ResourceBundle::CleanupSharedInstance(); | 65 ui::ResourceBundle::CleanupSharedInstance(); |
76 #if defined(OS_WIN) | |
77 com_initializer_.reset(); | |
78 #endif | |
79 base::TestSuite::Shutdown(); | 66 base::TestSuite::Shutdown(); |
80 } | 67 } |
81 | 68 |
82 } // namespace test | 69 } // namespace test |
83 } // namespace ash | 70 } // namespace ash |
OLD | NEW |