Chromium Code Reviews| Index: cc/trees/layer_tree_host_unittest_scroll.cc |
| diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc |
| index 1d74ddfcd30ede5166e6fe8c58c08c4605bb0985..289be4220e6e7a73671d1cf9e5685f37eccd87f5 100644 |
| --- a/cc/trees/layer_tree_host_unittest_scroll.cc |
| +++ b/cc/trees/layer_tree_host_unittest_scroll.cc |
| @@ -4,6 +4,7 @@ |
| #include "cc/trees/layer_tree_host.h" |
| +#include "base/memory/weak_ptr.h" |
| #include "cc/base/thread_impl.h" |
| #include "cc/layers/content_layer.h" |
| #include "cc/layers/layer.h" |
| @@ -670,11 +671,6 @@ class ThreadCheckingInputHandlerClient : public InputHandlerClient { |
| : task_runner_(runner) , |
| received_stop_flinging_(received_stop_flinging) {} |
| - virtual void BindToHandler(InputHandler* handler) OVERRIDE { |
| - if (!task_runner_->BelongsToCurrentThread()) |
| - ADD_FAILURE() << "BindToClient called on wrong thread"; |
| - } |
| - |
| virtual void Animate(base::TimeTicks time) OVERRIDE { |
| if (!task_runner_->BelongsToCurrentThread()) |
| ADD_FAILURE() << "Animate called on wrong thread"; |
| @@ -691,24 +687,11 @@ class ThreadCheckingInputHandlerClient : public InputHandlerClient { |
| bool* received_stop_flinging_; |
| }; |
| -class ThreadCheckingFakeLayerTreeHostClient : public FakeLayerTreeHostClient { |
| - public: |
| - ThreadCheckingFakeLayerTreeHostClient( |
| - base::SingleThreadTaskRunner* task_runner, |
| - bool* received_stop_flinging) |
| - : FakeLayerTreeHostClient(DIRECT_3D) , |
| - task_runner_(task_runner), |
| - received_stop_flinging_(received_stop_flinging) {} |
| - |
| - virtual scoped_ptr<InputHandlerClient> CreateInputHandlerClient() OVERRIDE { |
| - return scoped_ptr<InputHandlerClient>(new ThreadCheckingInputHandlerClient( |
| - task_runner_, received_stop_flinging_)).Pass(); |
| - } |
| - |
| - private: |
| - base::SingleThreadTaskRunner* task_runner_; |
| - bool* received_stop_flinging_; |
| -}; |
| +void BindInputHandlerOnCompositorThread( |
| + const base::WeakPtr<cc::InputHandler>& input_handler, |
| + ThreadCheckingInputHandlerClient* client) { |
| + input_handler->BindToClient(client); |
| +} |
| TEST(LayerTreeHostFlingTest, DidStopFlingingThread) { |
| base::Thread impl_thread("cc"); |
| @@ -718,14 +701,20 @@ TEST(LayerTreeHostFlingTest, DidStopFlingingThread) { |
| impl_thread.message_loop_proxy()); |
| bool received_stop_flinging = false; |
| - ThreadCheckingFakeLayerTreeHostClient client( |
| - impl_thread.message_loop_proxy().get(), |
| - &received_stop_flinging); |
| LayerTreeSettings settings; |
| + ThreadCheckingInputHandlerClient input_handler_client( |
| + impl_thread.message_loop_proxy().get(), &received_stop_flinging); |
| + cc::FakeLayerTreeHostClient client(cc::FakeLayerTreeHostClient::DIRECT_3D); |
|
danakj
2013/05/01 19:20:43
no cc:: needed
|
| + |
| scoped_ptr<LayerTreeHost> layer_tree_host = |
| LayerTreeHost::Create(&client, settings, impl_ccthread.Pass()); |
| + impl_thread.message_loop_proxy()->PostTask(FROM_HERE, |
| + base::Bind(&BindInputHandlerOnCompositorThread, |
| + layer_tree_host->GetInputHandler(), |
| + &input_handler_client)); |
| + |
| layer_tree_host->DidStopFlinging(); |
| layer_tree_host.reset(); |
| impl_thread.Stop(); |