| 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/ash_test_suite.h" | 5 #include "ash/test/ash_test_suite.h" |
| 6 | 6 |
| 7 #include "ash/public/cpp/config.h" |
| 7 #include "ash/test/ash_test_environment.h" | 8 #include "ash/test/ash_test_environment.h" |
| 9 #include "ash/test/ash_test_helper.h" |
| 8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 10 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 11 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 12 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
| 15 #include "ui/base/ui_base_paths.h" | 17 #include "ui/base/ui_base_paths.h" |
| 18 #include "ui/compositor/test/fake_context_factory.h" |
| 16 #include "ui/gfx/gfx_paths.h" | 19 #include "ui/gfx/gfx_paths.h" |
| 17 #include "ui/gl/test/gl_surface_test_support.h" | 20 #include "ui/gl/test/gl_surface_test_support.h" |
| 18 | 21 |
| 19 namespace ash { | 22 namespace ash { |
| 20 namespace test { | 23 namespace test { |
| 21 | 24 |
| 22 AshTestSuite::AshTestSuite(int argc, char** argv) : TestSuite(argc, argv) {} | 25 AshTestSuite::AshTestSuite(int argc, char** argv) : TestSuite(argc, argv) {} |
| 23 | 26 |
| 24 AshTestSuite::~AshTestSuite() {} | 27 AshTestSuite::~AshTestSuite() {} |
| 25 | 28 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 47 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 50 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
| 48 ash_test_resources_100, ui::SCALE_FACTOR_100P); | 51 ash_test_resources_100, ui::SCALE_FACTOR_100P); |
| 49 } | 52 } |
| 50 if (ui::ResourceBundle::IsScaleFactorSupported(ui::SCALE_FACTOR_200P)) { | 53 if (ui::ResourceBundle::IsScaleFactorSupported(ui::SCALE_FACTOR_200P)) { |
| 51 base::FilePath ash_test_resources_200 = | 54 base::FilePath ash_test_resources_200 = |
| 52 path.Append(FILE_PATH_LITERAL("ash_test_resources_200_percent.pak")); | 55 path.Append(FILE_PATH_LITERAL("ash_test_resources_200_percent.pak")); |
| 53 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 56 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
| 54 ash_test_resources_200, ui::SCALE_FACTOR_200P); | 57 ash_test_resources_200, ui::SCALE_FACTOR_200P); |
| 55 } | 58 } |
| 56 | 59 |
| 60 const bool is_mus = base::CommandLine::ForCurrentProcess()->HasSwitch("mus"); |
| 61 ash::test::AshTestHelper::config_ = is_mus ? Config::MUS : Config::CLASSIC; |
| 62 |
| 57 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); | 63 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); |
| 58 env_ = aura::Env::CreateInstance(); | 64 env_ = aura::Env::CreateInstance(is_mus ? aura::Env::Mode::MUS |
| 65 : aura::Env::Mode::LOCAL); |
| 66 |
| 67 if (is_mus) { |
| 68 context_factory_ = base::MakeUnique<ui::FakeContextFactory>(); |
| 69 env_->set_context_factory(context_factory_.get()); |
| 70 env_->set_context_factory_private(nullptr); |
| 71 } |
| 59 } | 72 } |
| 60 | 73 |
| 61 void AshTestSuite::Shutdown() { | 74 void AshTestSuite::Shutdown() { |
| 62 env_.reset(); | 75 env_.reset(); |
| 63 ui::ResourceBundle::CleanupSharedInstance(); | 76 ui::ResourceBundle::CleanupSharedInstance(); |
| 64 base::TestSuite::Shutdown(); | 77 base::TestSuite::Shutdown(); |
| 65 } | 78 } |
| 66 | 79 |
| 67 } // namespace test | 80 } // namespace test |
| 68 } // namespace ash | 81 } // namespace ash |
| OLD | NEW |