Chromium Code Reviews| Index: cc/test/layer_tree_test.cc |
| diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc |
| index 122480630afa5194ca2ca24b75b2c0b4494cbdfa..0fea26c16b122ada17b15f7afa6d9b25d9315cb0 100644 |
| --- a/cc/test/layer_tree_test.cc |
| +++ b/cc/test/layer_tree_test.cc |
| @@ -26,18 +26,17 @@ |
| #include "cc/test/fake_image_serialization_processor.h" |
| #include "cc/test/fake_layer_tree_host_client.h" |
| #include "cc/test/fake_output_surface.h" |
| -#include "cc/test/remote_channel_impl_for_test.h" |
| #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/threaded_channel_for_test.h" |
| #include "cc/trees/layer_tree_host_client.h" |
| #include "cc/trees/layer_tree_host_impl.h" |
| #include "cc/trees/layer_tree_host_single_thread_client.h" |
| #include "cc/trees/layer_tree_impl.h" |
| #include "cc/trees/proxy_impl.h" |
| #include "cc/trees/proxy_main.h" |
| +#include "cc/trees/remote_channel_impl.h" |
| #include "cc/trees/single_thread_proxy.h" |
| #include "cc/trees/threaded_channel.h" |
| #include "testing/gmock/include/gmock/gmock.h" |
| @@ -89,70 +88,6 @@ void CreateVirtualViewportLayers(Layer* root_layer, |
| inner_bounds, outer_bounds, host); |
| } |
| -// Creates a SingleThreadProxy that notifies the supplied |test_hooks| of |
| -// various actions. |
| -class SingleThreadProxyForTest : public SingleThreadProxy { |
| - public: |
| - static std::unique_ptr<Proxy> Create( |
| - TestHooks* test_hooks, |
| - LayerTreeHost* host, |
| - LayerTreeHostSingleThreadClient* client, |
| - TaskRunnerProvider* task_runner_provider) { |
| - return base::WrapUnique(new SingleThreadProxyForTest( |
| - test_hooks, host, client, task_runner_provider)); |
| - } |
| - |
| - ~SingleThreadProxyForTest() override {} |
| - |
| - private: |
| - SingleThreadProxyForTest(TestHooks* test_hooks, |
| - LayerTreeHost* host, |
| - LayerTreeHostSingleThreadClient* client, |
| - TaskRunnerProvider* task_runner_provider) |
| - : SingleThreadProxy(host, client, task_runner_provider), |
| - test_hooks_(test_hooks) {} |
| - |
| - void ScheduledActionSendBeginMainFrame(const BeginFrameArgs& args) override { |
| - test_hooks_->ScheduledActionWillSendBeginMainFrame(); |
| - SingleThreadProxy::ScheduledActionSendBeginMainFrame(args); |
| - test_hooks_->ScheduledActionSendBeginMainFrame(); |
| - } |
| - |
| - DrawResult ScheduledActionDrawAndSwapIfPossible() override { |
| - DrawResult result = |
| - SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible(); |
| - test_hooks_->ScheduledActionDrawAndSwapIfPossible(); |
| - return result; |
| - } |
| - |
| - void ScheduledActionCommit() override { |
| - SingleThreadProxy::ScheduledActionCommit(); |
| - test_hooks_->ScheduledActionCommit(); |
| - } |
| - |
| - void ScheduledActionBeginOutputSurfaceCreation() override { |
| - SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation(); |
| - test_hooks_->ScheduledActionBeginOutputSurfaceCreation(); |
| - } |
| - |
| - void ScheduledActionPrepareTiles() override { |
| - SingleThreadProxy::ScheduledActionPrepareTiles(); |
| - test_hooks_->ScheduledActionPrepareTiles(); |
| - } |
| - |
| - void ScheduledActionInvalidateOutputSurface() override { |
| - SingleThreadProxy::ScheduledActionInvalidateOutputSurface(); |
| - test_hooks_->ScheduledActionInvalidateOutputSurface(); |
| - } |
| - |
| - void SendBeginMainFrameNotExpectedSoon() override { |
| - SingleThreadProxy::SendBeginMainFrameNotExpectedSoon(); |
| - test_hooks_->SendBeginMainFrameNotExpectedSoon(); |
| - } |
| - |
| - TestHooks* test_hooks_; |
| -}; |
| - |
| // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks. |
| class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| public: |
| @@ -216,6 +151,11 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| test_hooks_->BeginMainFrameAbortedOnThread(this, reason); |
| } |
| + void BeginMainFrameCompleted() override { |
| + LayerTreeHostImpl::BeginMainFrameCompleted(); |
| + test_hooks_->BeginMainFrameCompletedOnThread(this); |
| + } |
| + |
| void BeginCommit() override { |
| LayerTreeHostImpl::BeginCommit(); |
| test_hooks_->BeginCommitOnThread(this); |
| @@ -228,7 +168,7 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { |
| } |
| bool PrepareTiles() override { |
| - test_hooks_->WillPrepareTiles(this); |
| + test_hooks_->WillPrepareTilesOnThread(this); |
| return LayerTreeHostImpl::PrepareTiles(); |
| } |
| @@ -390,7 +330,9 @@ class LayerTreeHostClientForTesting : public LayerTreeHostClient, |
| void DidAbortSwapBuffers() override {} |
| void RequestScheduleComposite() override { test_hooks_->ScheduleComposite(); } |
| void DidCompletePageScaleAnimation() override {} |
| - void BeginMainFrameNotExpectedSoon() override {} |
| + void BeginMainFrameNotExpectedSoon() override { |
| + test_hooks_->BeginMainFrameNotExpectedSoon(); |
| + } |
| private: |
| explicit LayerTreeHostClientForTesting(TestHooks* test_hooks) |
| @@ -432,26 +374,25 @@ class LayerTreeHostForTesting : public LayerTreeHost { |
| std::unique_ptr<Proxy> proxy; |
| switch (mode) { |
| case CompositorMode::SINGLE_THREADED: |
| - proxy = SingleThreadProxyForTest::Create(test_hooks, |
| - layer_tree_host.get(), client, |
| - task_runner_provider.get()); |
| + proxy = SingleThreadProxy::Create(layer_tree_host.get(), client, |
| + task_runner_provider.get()); |
| break; |
| case CompositorMode::THREADED: |
| DCHECK(impl_task_runner.get()); |
| - proxy = ProxyMainForTest::CreateThreaded( |
| - test_hooks, layer_tree_host.get(), task_runner_provider.get()); |
| + proxy = ProxyMain::CreateThreaded(layer_tree_host.get(), |
| + task_runner_provider.get()); |
| break; |
| case CompositorMode::REMOTE: |
| DCHECK(!external_begin_frame_source); |
| // The Remote LayerTreeHost on the client has the impl task runner. |
| if (task_runner_provider->HasImplThread()) { |
| - proxy = RemoteChannelImplForTest::Create( |
| - test_hooks, layer_tree_host.get(), remote_proto_channel, |
| + proxy = base::MakeUnique<RemoteChannelImpl>( |
| + layer_tree_host.get(), remote_proto_channel, |
| task_runner_provider.get()); |
| } else { |
| - proxy = ProxyMainForTest::CreateRemote( |
| - test_hooks, remote_proto_channel, layer_tree_host.get(), |
| - task_runner_provider.get()); |
| + proxy = ProxyMain::CreateRemote(remote_proto_channel, |
| + layer_tree_host.get(), |
| + task_runner_provider.get()); |
| // The LayerTreeHost on the server will never have an output surface. |
| // Set output_surface_lost_ to false by default. |
| @@ -476,12 +417,14 @@ class LayerTreeHostForTesting : public LayerTreeHost { |
| void SetNeedsCommit() override { |
| if (!test_started_) |
| return; |
| + test_hooks_->DidSetNeedsCommit(); |
|
enne (OOO)
2016/07/18 21:48:02
What is this used for?
danakj
2016/07/18 23:20:10
I just added this cuz I added it below. <_<
danakj
2016/07/19 00:56:24
Removed
|
| LayerTreeHost::SetNeedsCommit(); |
| } |
| void SetNeedsUpdateLayers() override { |
| if (!test_started_) |
| return; |
| + test_hooks_->DidSetNeedsUpdateLayers(); |
|
enne (OOO)
2016/07/18 21:48:02
This looks like it's used by only one test. Is it
danakj
2016/07/18 23:20:10
That test is checking that layer_tree_host()->Appl
danakj
2016/07/18 23:24:11
It could also maybe not be a LayerTreeTest and jus
danakj
2016/07/19 00:56:24
Removed along with the test since it is covered by
|
| LayerTreeHost::SetNeedsUpdateLayers(); |
| } |
| @@ -993,39 +936,4 @@ LayerTreeHost* LayerTreeTest::remote_client_layer_tree_host() { |
| return remote_client_layer_tree_host_.get(); |
| } |
| -ProxyMainForTest* LayerTreeTest::GetProxyMainForTest() const { |
| - DCHECK(HasImplThread()); |
| - return static_cast<ProxyMainForTest*>(proxy()); |
| -} |
| - |
| -ProxyImplForTest* LayerTreeTest::GetProxyImplForTest() const { |
| - DCHECK(HasImplThread()); |
| - |
| - if (IsRemoteTest()) { |
| - return GetRemoteChannelImplForTest()->proxy_impl_for_test(); |
| - } |
| - |
| - ProxyImplForTest* proxy_impl_for_test = |
| - GetThreadedChannelForTest()->proxy_impl_for_test(); |
| - |
| - // We check for null ProxyImpl since ProxyImpl exists in the ThreadedChannel |
| - // only after it is initialized. |
| - DCHECK(proxy_impl_for_test); |
| - return proxy_impl_for_test; |
| -} |
| - |
| -ThreadedChannelForTest* LayerTreeTest::GetThreadedChannelForTest() const { |
| - DCHECK(mode_ == CompositorMode::THREADED); |
| - |
| - return GetProxyMainForTest()->threaded_channel_for_test(); |
| -} |
| - |
| -RemoteChannelImplForTest* LayerTreeTest::GetRemoteChannelImplForTest() const { |
| - DCHECK(IsRemoteTest()); |
| - DCHECK(remote_client_layer_tree_host_); |
| - |
| - return static_cast<RemoteChannelImplForTest*>( |
| - remote_client_layer_tree_host_->proxy()); |
| -} |
| - |
| } // namespace cc |