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