Chromium Code Reviews| Index: mash/test/mash_test_suite.cc |
| diff --git a/mash/test/mash_test_suite.cc b/mash/test/mash_test_suite.cc |
| index df5f214e0a840d747535867842c8eaf0e556ae08..6acc2411c5f8748009c0ce88a0559c31b18f2e68 100644 |
| --- a/mash/test/mash_test_suite.cc |
| +++ b/mash/test/mash_test_suite.cc |
| @@ -11,9 +11,8 @@ |
| #include "cc/output/context_provider.h" |
| #include "cc/surfaces/frame_sink_id_allocator.h" |
| #include "cc/surfaces/surface_manager.h" |
| -#include "cc/test/test_gpu_memory_buffer_manager.h" |
| -#include "cc/test/test_task_graph_runner.h" |
| #include "ui/aura/env.h" |
| +#include "ui/aura/test/mus/test_context_factory.h" |
| #include "ui/base/resource/resource_bundle.h" |
| #include "ui/base/ui_base_paths.h" |
| #include "ui/compositor/compositor.h" |
| @@ -25,35 +24,12 @@ |
| namespace mash { |
| namespace test { |
| -class TestContextFactory : public ui::ContextFactory, |
| - public ui::ContextFactoryPrivate { |
| +class TestContextFactoryPrivate : public ui::ContextFactoryPrivate { |
|
sky
2017/03/17 15:48:16
How come mash needs this code, but not other tests
sadrul
2017/03/17 16:18:35
I had added a comment below where this is used. So
sky
2017/03/17 16:43:43
SGTM
|
| public: |
| - TestContextFactory() : frame_sink_id_allocator_(0) {} |
| - ~TestContextFactory() override {} |
| + TestContextFactoryPrivate() : frame_sink_id_allocator_(0) {} |
| + ~TestContextFactoryPrivate() {} |
| private: |
| - // ui::ContextFactory:: |
| - void CreateCompositorFrameSink( |
| - base::WeakPtr<ui::Compositor> compositor) override {} |
| - scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider() |
| - override { |
| - return nullptr; |
| - } |
| - void RemoveCompositor(ui::Compositor* compositor) override {} |
| - bool DoesCreateTestContexts() override { return true; } |
| - uint32_t GetImageTextureTarget(gfx::BufferFormat format, |
| - gfx::BufferUsage usage) override { |
| - return GL_TEXTURE_2D; |
| - } |
| - gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override { |
| - return &gpu_memory_buffer_manager_; |
| - } |
| - cc::TaskGraphRunner* GetTaskGraphRunner() override { |
| - return &task_graph_runner_; |
| - } |
| - void AddObserver(ui::ContextFactoryObserver* observer) override {} |
| - void RemoveObserver(ui::ContextFactoryObserver* observer) override {} |
| - |
| // ui::ContextFactoryPrivate: |
| std::unique_ptr<ui::Reflector> CreateReflector( |
| ui::Compositor* mirrored_compositor, |
| @@ -80,12 +56,10 @@ class TestContextFactory : public ui::ContextFactory, |
| base::TimeDelta interval) override {} |
| void SetOutputIsSecure(ui::Compositor* compositor, bool secure) override {} |
| - cc::TestTaskGraphRunner task_graph_runner_; |
| - cc::TestGpuMemoryBufferManager gpu_memory_buffer_manager_; |
| cc::FrameSinkIdAllocator frame_sink_id_allocator_; |
| cc::SurfaceManager surface_manager_; |
| - DISALLOW_COPY_AND_ASSIGN(TestContextFactory); |
| + DISALLOW_COPY_AND_ASSIGN(TestContextFactoryPrivate); |
| }; |
| MashTestSuite::MashTestSuite(int argc, char** argv) : TestSuite(argc, argv) {} |
| @@ -108,9 +82,13 @@ void MashTestSuite::Initialize() { |
| base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); |
| env_ = aura::Env::CreateInstance(aura::Env::Mode::MUS); |
| - compositor_context_factory_ = base::MakeUnique<TestContextFactory>(); |
| - env_->set_context_factory(compositor_context_factory_.get()); |
| - env_->set_context_factory_private(compositor_context_factory_.get()); |
| + context_factory_ = base::MakeUnique<aura::test::TestContextFactory>(); |
| + env_->set_context_factory(context_factory_.get()); |
| + |
| + // Some tests in ash use the ContextFactoryPrivate (e.g. |
|
Fady Samuel
2017/03/17 15:37:28
nit: Add a TODO to not depend on ContextFactoryPri
sadrul
2017/03/17 16:50:29
Just removed the dep instead.
|
| + // LaserPointerControllerTest). So install a dummy factory here. |
| + context_factory_private_ = base::MakeUnique<TestContextFactoryPrivate>(); |
| + env_->set_context_factory_private(context_factory_private_.get()); |
| } |
| void MashTestSuite::Shutdown() { |