Index: cc/test/layer_tree_test.cc |
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc |
index 3c6ff57baeaebe5bf0f899ffd2557d842c06d77a..2fff95f81745aa344eb538201f74df505638f083 100644 |
--- a/cc/test/layer_tree_test.cc |
+++ b/cc/test/layer_tree_test.cc |
@@ -22,6 +22,7 @@ |
#include "cc/test/test_context_provider.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/test/tiled_layer_test_common.h" |
#include "cc/trees/layer_tree_host_client.h" |
#include "cc/trees/layer_tree_host_impl.h" |
@@ -209,15 +210,11 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
Proxy* proxy, |
SharedBitmapManager* shared_bitmap_manager, |
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
+ TaskGraphRunner* task_graph_runner, |
RenderingStatsInstrumentation* stats_instrumentation) { |
- return make_scoped_ptr( |
- new LayerTreeHostImplForTesting(test_hooks, |
- settings, |
- host_impl_client, |
- proxy, |
- shared_bitmap_manager, |
- gpu_memory_buffer_manager, |
- stats_instrumentation)); |
+ return make_scoped_ptr(new LayerTreeHostImplForTesting( |
+ test_hooks, settings, host_impl_client, proxy, shared_bitmap_manager, |
+ gpu_memory_buffer_manager, task_graph_runner, stats_instrumentation)); |
} |
protected: |
@@ -228,6 +225,7 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
Proxy* proxy, |
SharedBitmapManager* shared_bitmap_manager, |
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
+ TaskGraphRunner* task_graph_runner, |
RenderingStatsInstrumentation* stats_instrumentation) |
: LayerTreeHostImpl(settings, |
host_impl_client, |
@@ -235,6 +233,7 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
stats_instrumentation, |
shared_bitmap_manager, |
gpu_memory_buffer_manager, |
+ task_graph_runner, |
0), |
test_hooks_(test_hooks), |
block_notify_ready_to_activate_for_testing_(false), |
@@ -455,12 +454,17 @@ class LayerTreeHostForTesting : public LayerTreeHost { |
static scoped_ptr<LayerTreeHostForTesting> Create( |
TestHooks* test_hooks, |
LayerTreeHostClientForTesting* client, |
+ SharedBitmapManager* shared_bitmap_manager, |
+ gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
+ TaskGraphRunner* task_graph_runner, |
const LayerTreeSettings& settings, |
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
scoped_ptr<LayerTreeHostForTesting> layer_tree_host( |
- new LayerTreeHostForTesting(test_hooks, client, settings)); |
+ new LayerTreeHostForTesting(test_hooks, client, shared_bitmap_manager, |
+ gpu_memory_buffer_manager, |
+ task_graph_runner, settings)); |
if (impl_task_runner.get()) { |
layer_tree_host->InitializeForTesting( |
ThreadProxyForTest::Create(test_hooks, |
@@ -483,12 +487,8 @@ class LayerTreeHostForTesting : public LayerTreeHost { |
scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( |
LayerTreeHostImplClient* host_impl_client) override { |
return LayerTreeHostImplForTesting::Create( |
- test_hooks_, |
- settings(), |
- host_impl_client, |
- proxy(), |
- shared_bitmap_manager_.get(), |
- gpu_memory_buffer_manager_.get(), |
+ test_hooks_, settings(), host_impl_client, proxy(), |
+ shared_bitmap_manager_, gpu_memory_buffer_manager_, task_graph_runner_, |
rendering_stats_instrumentation()); |
} |
@@ -501,17 +501,23 @@ class LayerTreeHostForTesting : public LayerTreeHost { |
void set_test_started(bool started) { test_started_ = started; } |
private: |
- LayerTreeHostForTesting(TestHooks* test_hooks, |
- LayerTreeHostClient* client, |
- const LayerTreeSettings& settings) |
- : LayerTreeHost(client, NULL, NULL, settings), |
- shared_bitmap_manager_(new TestSharedBitmapManager), |
- gpu_memory_buffer_manager_(new TestGpuMemoryBufferManager), |
+ LayerTreeHostForTesting( |
+ TestHooks* test_hooks, |
+ LayerTreeHostClient* client, |
+ SharedBitmapManager* shared_bitmap_manager, |
+ gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
+ TaskGraphRunner* task_graph_runner, |
+ const LayerTreeSettings& settings) |
+ : LayerTreeHost(client, NULL, NULL, NULL, settings), |
+ shared_bitmap_manager_(shared_bitmap_manager), |
+ gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
+ task_graph_runner_(task_graph_runner), |
test_hooks_(test_hooks), |
test_started_(false) {} |
- scoped_ptr<TestSharedBitmapManager> shared_bitmap_manager_; |
- scoped_ptr<TestGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
+ SharedBitmapManager* shared_bitmap_manager_; |
+ gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
+ TaskGraphRunner* task_graph_runner_; |
TestHooks* test_hooks_; |
bool test_started_; |
}; |
@@ -663,9 +669,8 @@ void LayerTreeTest::DoBeginTest() { |
DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); |
layer_tree_host_ = LayerTreeHostForTesting::Create( |
- this, |
- client_.get(), |
- settings_, |
+ this, client_.get(), shared_bitmap_manager_.get(), |
+ gpu_memory_buffer_manager_.get(), task_graph_runner_.get(), settings_, |
base::MessageLoopProxy::current(), |
impl_thread_ ? impl_thread_->message_loop_proxy() : NULL, |
external_begin_frame_source.Pass()); |
@@ -793,6 +798,10 @@ void LayerTreeTest::RunTest(bool threaded, |
main_task_runner_ = base::MessageLoopProxy::current(); |
+ shared_bitmap_manager_.reset(new TestSharedBitmapManager); |
+ gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); |
+ task_graph_runner_.reset(new TestTaskGraphRunner); |
+ |
delegating_renderer_ = delegating_renderer; |
// Spend less time waiting for BeginFrame because the output is |
@@ -878,4 +887,13 @@ void LayerTreeTest::DestroyLayerTreeHost() { |
layer_tree_host_ = nullptr; |
} |
+LayerTreeHost* LayerTreeTest::layer_tree_host() { |
+ // We check for a null proxy here as we sometimes ask for the layer tree host |
+ // when the proxy does not exist, often for checking settings after a test has |
+ // completed. For example, LTHPixelResourceTest::RunPixelResourceTest. See |
+ // elsewhere in this file for other examples. |
+ DCHECK(!proxy() || proxy()->IsMainThread() || proxy()->IsMainThreadBlocked()); |
+ return layer_tree_host_.get(); |
+} |
+ |
} // namespace cc |