| 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 "ash/public/cpp/config.h" |
| 8 #include "ash/test/ash_test_helper.h" |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 9 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 10 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 11 #include "cc/output/context_provider.h" | 13 #include "cc/output/context_provider.h" |
| 12 #include "cc/surfaces/frame_sink_id_allocator.h" | 14 #include "cc/surfaces/frame_sink_id_allocator.h" |
| 13 #include "cc/surfaces/surface_manager.h" | 15 #include "cc/surfaces/surface_manager.h" |
| 14 #include "ui/aura/env.h" | 16 #include "ui/aura/env.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/base/ui_base_paths.h" | 18 #include "ui/base/ui_base_paths.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 34 | 36 |
| 35 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 37 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 36 switches::kOverrideUseSoftwareGLForTests); | 38 switches::kOverrideUseSoftwareGLForTests); |
| 37 | 39 |
| 38 // Load ash mus strings and resources; not 'common' (Chrome) resources. | 40 // Load ash mus strings and resources; not 'common' (Chrome) resources. |
| 39 base::FilePath resources; | 41 base::FilePath resources; |
| 40 PathService::Get(base::DIR_MODULE, &resources); | 42 PathService::Get(base::DIR_MODULE, &resources); |
| 41 resources = resources.Append(FILE_PATH_LITERAL("ash_mus_resources.pak")); | 43 resources = resources.Append(FILE_PATH_LITERAL("ash_mus_resources.pak")); |
| 42 ui::ResourceBundle::InitSharedInstanceWithPakPath(resources); | 44 ui::ResourceBundle::InitSharedInstanceWithPakPath(resources); |
| 43 | 45 |
| 46 ash::test::AshTestHelper::config_ = ash::Config::MASH; |
| 47 |
| 44 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); | 48 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); |
| 45 env_ = aura::Env::CreateInstance(aura::Env::Mode::MUS); | 49 env_ = aura::Env::CreateInstance(aura::Env::Mode::MUS); |
| 46 | 50 |
| 47 context_factory_ = base::MakeUnique<ui::FakeContextFactory>(); | 51 context_factory_ = base::MakeUnique<ui::FakeContextFactory>(); |
| 48 env_->set_context_factory(context_factory_.get()); | 52 env_->set_context_factory(context_factory_.get()); |
| 49 env_->set_context_factory_private(nullptr); | 53 env_->set_context_factory_private(nullptr); |
| 50 } | 54 } |
| 51 | 55 |
| 52 void MashTestSuite::Shutdown() { | 56 void MashTestSuite::Shutdown() { |
| 53 env_.reset(); | 57 env_.reset(); |
| 54 ui::ResourceBundle::CleanupSharedInstance(); | 58 ui::ResourceBundle::CleanupSharedInstance(); |
| 55 base::TestSuite::Shutdown(); | 59 base::TestSuite::Shutdown(); |
| 56 } | 60 } |
| 57 | 61 |
| 58 } // namespace test | 62 } // namespace test |
| 59 } // namespace mash | 63 } // namespace mash |
| OLD | NEW |