Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Unified Diff: ui/compositor/test/fake_context_factory.h

Issue 2752303002: views/mus: Install a mus-friend ContextFactory for tests. (Closed)
Patch Set: . Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/compositor_unittest.cc ('k') | ui/compositor/test/fake_context_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/test/fake_context_factory.h
diff --git a/ui/compositor/test/fake_context_factory.h b/ui/compositor/test/fake_context_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..616e1d7a2f290e821dee6670596eb064ec803186
--- /dev/null
+++ b/ui/compositor/test/fake_context_factory.h
@@ -0,0 +1,52 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_COMPOSITOR_TEST_FAKE_CONTEXT_FACTORY_H_
+#define UI_COMPOSITOR_TEST_FAKE_CONTEXT_FACTORY_H_
+
+#include "cc/test/test_gpu_memory_buffer_manager.h"
+#include "cc/test/test_task_graph_runner.h"
+#include "ui/compositor/compositor.h"
+
+namespace cc {
+class CompositorFrame;
+class ContextProvider;
+class FakeCompositorFrameSink;
+class TestTaskGraphRunner;
+class TestGpuMemoryBufferManager;
+}
+
+namespace ui {
+
+class FakeContextFactory : public ui::ContextFactory {
+ public:
+ FakeContextFactory() = default;
+ ~FakeContextFactory() override = default;
+
+ const cc::CompositorFrame& GetLastCompositorFrame() const;
+
+ // ui::ContextFactory:
+ void CreateCompositorFrameSink(
+ base::WeakPtr<ui::Compositor> compositor) override;
+ scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider() override;
+ void RemoveCompositor(ui::Compositor* compositor) override;
+ bool DoesCreateTestContexts() override;
+ uint32_t GetImageTextureTarget(gfx::BufferFormat format,
+ gfx::BufferUsage usage) override;
+ gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
+ cc::TaskGraphRunner* GetTaskGraphRunner() override;
+ void AddObserver(ui::ContextFactoryObserver* observer) override {}
+ void RemoveObserver(ui::ContextFactoryObserver* observer) override {}
+
+ private:
+ cc::FakeCompositorFrameSink* frame_sink_ = nullptr;
+ cc::TestTaskGraphRunner task_graph_runner_;
+ cc::TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeContextFactory);
+};
+
+} // namespace ui
+
+#endif // UI_COMPOSITOR_TEST_FAKE_CONTEXT_FACTORY_H_
« no previous file with comments | « ui/compositor/compositor_unittest.cc ('k') | ui/compositor/test/fake_context_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698