OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mash/test/mash_test_suite.h" | 5 #include "mash/test/mash_test_suite.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
11 #include "ui/base/ui_base_paths.h" | 11 #include "ui/base/ui_base_paths.h" |
12 #include "ui/compositor/test/context_factories_for_test.h" | 12 #include "ui/compositor/test/context_factories_for_test.h" |
13 #include "ui/gl/test/gl_surface_test_support.h" | 13 #include "ui/gl/test/gl_surface_test_support.h" |
14 | 14 |
15 namespace mash { | 15 namespace mash { |
16 namespace test { | 16 namespace test { |
17 | 17 |
18 MashTestSuite::MashTestSuite(int argc, char** argv) : TestSuite(argc, argv) {} | 18 MashTestSuite::MashTestSuite(int argc, char** argv) : TestSuite(argc, argv) {} |
19 | 19 |
20 MashTestSuite::~MashTestSuite() {} | 20 MashTestSuite::~MashTestSuite() {} |
21 | 21 |
22 void MashTestSuite::Initialize() { | 22 void MashTestSuite::Initialize() { |
23 base::TestSuite::Initialize(); | 23 base::TestSuite::Initialize(); |
24 gfx::GLSurfaceTestSupport::InitializeOneOff(); | 24 gl::GLSurfaceTestSupport::InitializeOneOff(); |
25 | 25 |
26 // Load ash resources and en-US strings; not 'common' (Chrome) resources. | 26 // Load ash resources and en-US strings; not 'common' (Chrome) resources. |
27 // TODO(msw): Check ResourceBundle::IsScaleFactorSupported; load 300% etc. | 27 // TODO(msw): Check ResourceBundle::IsScaleFactorSupported; load 300% etc. |
28 base::FilePath path; | 28 base::FilePath path; |
29 PathService::Get(base::DIR_MODULE, &path); | 29 PathService::Get(base::DIR_MODULE, &path); |
30 base::FilePath mash_test_strings = | 30 base::FilePath mash_test_strings = |
31 path.Append(FILE_PATH_LITERAL("mash_wm_resources.pak")); | 31 path.Append(FILE_PATH_LITERAL("mash_wm_resources.pak")); |
32 | 32 |
33 ui::ResourceBundle::InitSharedInstanceWithPakPath(mash_test_strings); | 33 ui::ResourceBundle::InitSharedInstanceWithPakPath(mash_test_strings); |
34 | 34 |
35 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); | 35 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); |
36 env_ = aura::Env::CreateInstance(); | 36 env_ = aura::Env::CreateInstance(); |
37 | 37 |
38 const bool enable_pixel_output = false; | 38 const bool enable_pixel_output = false; |
39 env_->set_context_factory( | 39 env_->set_context_factory( |
40 ui::InitializeContextFactoryForTests(enable_pixel_output)); | 40 ui::InitializeContextFactoryForTests(enable_pixel_output)); |
41 } | 41 } |
42 | 42 |
43 void MashTestSuite::Shutdown() { | 43 void MashTestSuite::Shutdown() { |
44 env_.reset(); | 44 env_.reset(); |
45 ui::ResourceBundle::CleanupSharedInstance(); | 45 ui::ResourceBundle::CleanupSharedInstance(); |
46 ui::TerminateContextFactoryForTests(); | 46 ui::TerminateContextFactoryForTests(); |
47 base::TestSuite::Shutdown(); | 47 base::TestSuite::Shutdown(); |
48 } | 48 } |
49 | 49 |
50 } // namespace test | 50 } // namespace test |
51 } // namespace mash | 51 } // namespace mash |
OLD | NEW |