| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "cc/output/context_provider.h" | 11 #include "cc/output/context_provider.h" |
| 12 #include "cc/test/test_gpu_memory_buffer_manager.h" | 12 #include "cc/test/test_gpu_memory_buffer_manager.h" |
| 13 #include "cc/test/test_task_graph_runner.h" | 13 #include "cc/test/test_task_graph_runner.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/compositor/compositor.h" | 17 #include "ui/compositor/compositor.h" |
| 18 #include "ui/gl/gl_bindings.h" | 18 #include "ui/gl/gl_bindings.h" |
| 19 #include "ui/gl/gl_switches.h" | 19 #include "ui/gl/gl_switches.h" |
| 20 #include "ui/gl/test/gl_surface_test_support.h" |
| 20 | 21 |
| 21 namespace mash { | 22 namespace mash { |
| 22 namespace test { | 23 namespace test { |
| 23 | 24 |
| 24 class TestContextFactory : public ui::ContextFactory { | 25 class TestContextFactory : public ui::ContextFactory { |
| 25 public: | 26 public: |
| 26 TestContextFactory() {} | 27 TestContextFactory() {} |
| 27 ~TestContextFactory() override {} | 28 ~TestContextFactory() override {} |
| 28 | 29 |
| 29 private: | 30 private: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 54 | 55 |
| 55 DISALLOW_COPY_AND_ASSIGN(TestContextFactory); | 56 DISALLOW_COPY_AND_ASSIGN(TestContextFactory); |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 MashTestSuite::MashTestSuite(int argc, char** argv) : TestSuite(argc, argv) {} | 59 MashTestSuite::MashTestSuite(int argc, char** argv) : TestSuite(argc, argv) {} |
| 59 | 60 |
| 60 MashTestSuite::~MashTestSuite() {} | 61 MashTestSuite::~MashTestSuite() {} |
| 61 | 62 |
| 62 void MashTestSuite::Initialize() { | 63 void MashTestSuite::Initialize() { |
| 63 base::TestSuite::Initialize(); | 64 base::TestSuite::Initialize(); |
| 65 gl::GLSurfaceTestSupport::InitializeOneOff(); |
| 64 | 66 |
| 65 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 67 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 66 switches::kOverrideUseSoftwareGLForTests); | 68 switches::kOverrideUseSoftwareGLForTests); |
| 67 | 69 |
| 68 // Load ash mus strings and resources; not 'common' (Chrome) resources. | 70 // Load ash mus strings and resources; not 'common' (Chrome) resources. |
| 69 base::FilePath resources; | 71 base::FilePath resources; |
| 70 PathService::Get(base::DIR_MODULE, &resources); | 72 PathService::Get(base::DIR_MODULE, &resources); |
| 71 resources = resources.Append(FILE_PATH_LITERAL("ash_mus_resources.pak")); | 73 resources = resources.Append(FILE_PATH_LITERAL("ash_mus_resources.pak")); |
| 72 ui::ResourceBundle::InitSharedInstanceWithPakPath(resources); | 74 ui::ResourceBundle::InitSharedInstanceWithPakPath(resources); |
| 73 | 75 |
| 74 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); | 76 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); |
| 75 env_ = aura::Env::CreateInstance(aura::Env::Mode::MUS); | 77 env_ = aura::Env::CreateInstance(aura::Env::Mode::MUS); |
| 76 | 78 |
| 77 compositor_context_factory_ = base::MakeUnique<TestContextFactory>(); | 79 compositor_context_factory_ = base::MakeUnique<TestContextFactory>(); |
| 78 env_->set_context_factory(compositor_context_factory_.get()); | 80 env_->set_context_factory(compositor_context_factory_.get()); |
| 79 } | 81 } |
| 80 | 82 |
| 81 void MashTestSuite::Shutdown() { | 83 void MashTestSuite::Shutdown() { |
| 82 env_.reset(); | 84 env_.reset(); |
| 83 ui::ResourceBundle::CleanupSharedInstance(); | 85 ui::ResourceBundle::CleanupSharedInstance(); |
| 84 base::TestSuite::Shutdown(); | 86 base::TestSuite::Shutdown(); |
| 85 } | 87 } |
| 86 | 88 |
| 87 } // namespace test | 89 } // namespace test |
| 88 } // namespace mash | 90 } // namespace mash |
| OLD | NEW |