Index: cc/test/layer_tree_test.cc |
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc |
index a40a8c72bf6b8140c638207e3b3d00d80b77e4dd..4e3adda5e702173df157ac5ff6a09c4d81d6f2fc 100644 |
--- a/cc/test/layer_tree_test.cc |
+++ b/cc/test/layer_tree_test.cc |
@@ -60,6 +60,20 @@ void TestHooks::CreateResourceAndTileTaskWorkerPool( |
tile_task_worker_pool, resource_pool, staging_resource_pool); |
} |
+class TestProxyBeginFrameSource : public ProxyBeginFrameSource { |
+ public: |
+ explicit TestProxyBeginFrameSource(TestHooks* test_hooks) |
+ : test_hooks_(test_hooks) {} |
+ ~TestProxyBeginFrameSource() override {} |
+ |
+ void BeginFrames(const BeginFrameArgs& args) override { |
+ test_hooks_->SendBeginFramesToChildren(args); |
+ } |
+ |
+ private: |
+ TestHooks* test_hooks_; |
+}; |
+ |
// Adapts ThreadProxy for test. Injects test hooks for testing. |
class ThreadProxyForTest : public ThreadProxy { |
public: |
@@ -349,10 +363,6 @@ class LayerTreeHostClientForTesting : public LayerTreeHostClient, |
test_hooks_->DidInitializeOutputSurface(); |
} |
- void SendBeginFramesToChildren(const BeginFrameArgs& args) override { |
- test_hooks_->SendBeginFramesToChildren(args); |
- } |
- |
void DidFailToInitializeOutputSurface() override { |
test_hooks_->DidFailToInitializeOutputSurface(); |
RequestNewOutputSurface(); |
@@ -391,7 +401,8 @@ class LayerTreeHostForTesting : public LayerTreeHost { |
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<BeginFrameSource> external_begin_frame_source, |
+ ProxyBeginFrameSource* proxy_begin_frame_source) { |
scoped_ptr<LayerTreeHostForTesting> layer_tree_host( |
new LayerTreeHostForTesting(test_hooks, client, settings)); |
if (impl_task_runner.get()) { |
@@ -406,7 +417,8 @@ class LayerTreeHostForTesting : public LayerTreeHost { |
layer_tree_host.get(), |
client, |
main_task_runner, |
- external_begin_frame_source.Pass())); |
+ external_begin_frame_source.Pass(), |
+ proxy_begin_frame_source)); |
} |
return layer_tree_host.Pass(); |
} |
@@ -587,6 +599,10 @@ void LayerTreeTest::DoBeginTest() { |
external_begin_frame_source_ = external_begin_frame_source.get(); |
} |
+ if (settings_.forward_begin_frames_to_children) { |
+ proxy_begin_frame_source_.reset(new TestProxyBeginFrameSource(this)); |
+ } |
+ |
DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); |
layer_tree_host_ = LayerTreeHostForTesting::Create( |
this, |
@@ -594,7 +610,8 @@ void LayerTreeTest::DoBeginTest() { |
settings_, |
base::MessageLoopProxy::current(), |
impl_thread_ ? impl_thread_->message_loop_proxy() : NULL, |
- external_begin_frame_source.Pass()); |
+ external_begin_frame_source.Pass(), |
+ proxy_begin_frame_source_.get()); |
ASSERT_TRUE(layer_tree_host_); |
started_ = true; |