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

Unified Diff: ui/aura/test/mus/test_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
Index: ui/aura/test/mus/test_context_factory.h
diff --git a/ui/aura/test/mus/test_context_factory.h b/ui/aura/test/mus/test_context_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..8c35e1155abbeae15936c5c48b462afff1d2462f
--- /dev/null
+++ b/ui/aura/test/mus/test_context_factory.h
@@ -0,0 +1,54 @@
+// 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_AURA_TEST_MUS_TEST_CONTEXT_FACTORY_H_
+#define UI_AURA_TEST_MUS_TEST_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 aura {
+namespace test {
+
+class TestContextFactory : public ui::ContextFactory {
sky 2017/03/17 15:48:16 Please add a description of this.
+ public:
+ TestContextFactory() = default;
+ ~TestContextFactory() 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(TestContextFactory);
+};
+
+} // namespace test
+} // namespace aura
+
+#endif // UI_AURA_TEST_MUS_TEST_CONTEXT_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698