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

Unified Diff: cc/test/test_layer_tree_host_base.h

Issue 1974033004: (reland) cc: Refactor layer/tile manager unittest to extract common code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix perftests Created 4 years, 7 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 | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/test/test_layer_tree_host_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/test_layer_tree_host_base.h
diff --git a/cc/test/test_layer_tree_host_base.h b/cc/test/test_layer_tree_host_base.h
new file mode 100644
index 0000000000000000000000000000000000000000..849ed66b2068e8c82d78c91a3ba80a0876b7ac06
--- /dev/null
+++ b/cc/test/test_layer_tree_host_base.h
@@ -0,0 +1,83 @@
+// Copyright 2016 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 CC_TEST_TEST_LAYER_TREE_HOST_BASE_H_
+#define CC_TEST_TEST_LAYER_TREE_HOST_BASE_H_
+
+#include <memory>
+
+#include "cc/output/output_surface.h"
+#include "cc/test/fake_impl_task_runner_provider.h"
+#include "cc/test/fake_layer_tree_host_impl.h"
+#include "cc/test/fake_picture_layer_impl.h"
+#include "cc/test/test_gpu_memory_buffer_manager.h"
+#include "cc/test/test_shared_bitmap_manager.h"
+#include "cc/test/test_task_graph_runner.h"
+#include "cc/tiles/tile_priority.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace cc {
+
+class TestLayerTreeHostBase : public testing::Test {
+ protected:
+ TestLayerTreeHostBase();
+ ~TestLayerTreeHostBase() override;
+
+ void SetUp() override;
+
+ virtual LayerTreeSettings CreateSettings();
+ virtual std::unique_ptr<OutputSurface> CreateOutputSurface();
+ virtual std::unique_ptr<FakeLayerTreeHostImpl> CreateHostImpl(
+ const LayerTreeSettings& settings,
+ TaskRunnerProvider* task_runner_provider,
+ SharedBitmapManager* shared_bitmap_manager,
+ TaskGraphRunner* task_graph_runner,
+ gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_);
+ virtual std::unique_ptr<TaskGraphRunner> CreateTaskGraphRunner();
+ virtual void InitializeRenderer();
+
+ void ResetOutputSurface(std::unique_ptr<OutputSurface> output_surface);
+ std::unique_ptr<FakeLayerTreeHostImpl> TakeHostImpl();
+
+ void SetupDefaultTrees(const gfx::Size& layer_bounds);
+ void SetupTrees(scoped_refptr<RasterSource> pending_raster_source,
+ scoped_refptr<RasterSource> active_raster_source);
+ void SetupPendingTree(scoped_refptr<RasterSource> raster_source);
+ void SetupPendingTree(scoped_refptr<RasterSource> raster_source,
+ const gfx::Size& tile_size,
+ const Region& invalidation);
+ void ActivateTree();
+ void RebuildPropertyTreesOnPendingTree();
+
+ FakeLayerTreeHostImpl* host_impl() const { return host_impl_.get(); }
+ TaskGraphRunner* task_graph_runner() const {
+ return task_graph_runner_.get();
+ }
+ OutputSurface* output_surface() const { return output_surface_.get(); }
+ FakePictureLayerImpl* pending_layer() const { return pending_layer_; }
+ FakePictureLayerImpl* active_layer() const { return active_layer_; }
+ FakePictureLayerImpl* old_pending_layer() const { return old_pending_layer_; }
+ int layer_id() const { return id_; }
+
+ private:
+ void SetInitialTreePriority();
+
+ FakeImplTaskRunnerProvider task_runner_provider_;
+ TestSharedBitmapManager shared_bitmap_manager_;
+ std::unique_ptr<TaskGraphRunner> task_graph_runner_;
+ TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
+ std::unique_ptr<OutputSurface> output_surface_;
+ std::unique_ptr<FakeLayerTreeHostImpl> host_impl_;
+
+ FakePictureLayerImpl* pending_layer_;
+ FakePictureLayerImpl* active_layer_;
+ FakePictureLayerImpl* old_pending_layer_;
+ const int root_id_;
+ const int id_;
+};
+
+} // namespace cc
+
+#endif // CC_TEST_TEST_LAYER_TREE_HOST_BASE_H_
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/test/test_layer_tree_host_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698