OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
8 #include "cc/base/thread_impl.h" | |
9 #include "cc/layers/content_layer.h" | 8 #include "cc/layers/content_layer.h" |
10 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
11 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
12 #include "cc/test/fake_content_layer_client.h" | 11 #include "cc/test/fake_content_layer_client.h" |
13 #include "cc/test/fake_layer_tree_host_client.h" | 12 #include "cc/test/fake_layer_tree_host_client.h" |
14 #include "cc/test/geometry_test_utils.h" | 13 #include "cc/test/geometry_test_utils.h" |
15 #include "cc/test/layer_tree_test.h" | 14 #include "cc/test/layer_tree_test.h" |
16 #include "cc/trees/layer_tree_impl.h" | 15 #include "cc/trees/layer_tree_impl.h" |
17 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" | 16 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" |
18 #include "ui/gfx/point_conversions.h" | 17 #include "ui/gfx/point_conversions.h" |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 }; | 718 }; |
720 | 719 |
721 void BindInputHandlerOnCompositorThread( | 720 void BindInputHandlerOnCompositorThread( |
722 const base::WeakPtr<InputHandler>& input_handler, | 721 const base::WeakPtr<InputHandler>& input_handler, |
723 ThreadCheckingInputHandlerClient* client) { | 722 ThreadCheckingInputHandlerClient* client) { |
724 input_handler->BindToClient(client); | 723 input_handler->BindToClient(client); |
725 } | 724 } |
726 | 725 |
727 TEST(LayerTreeHostFlingTest, DidStopFlingingThread) { | 726 TEST(LayerTreeHostFlingTest, DidStopFlingingThread) { |
728 base::Thread impl_thread("cc"); | 727 base::Thread impl_thread("cc"); |
729 impl_thread.Start(); | 728 ASSERT_TRUE(impl_thread.Start()); |
730 scoped_ptr<Thread> impl_ccthread = | |
731 ThreadImpl::CreateForDifferentThread(impl_thread.message_loop_proxy()); | |
732 | 729 |
733 bool received_stop_flinging = false; | 730 bool received_stop_flinging = false; |
734 LayerTreeSettings settings; | 731 LayerTreeSettings settings; |
735 | 732 |
736 ThreadCheckingInputHandlerClient input_handler_client( | 733 ThreadCheckingInputHandlerClient input_handler_client( |
737 impl_thread.message_loop_proxy().get(), &received_stop_flinging); | 734 impl_thread.message_loop_proxy().get(), &received_stop_flinging); |
738 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 735 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
739 | 736 |
| 737 ASSERT_TRUE(impl_thread.message_loop_proxy()); |
740 scoped_ptr<LayerTreeHost> layer_tree_host = | 738 scoped_ptr<LayerTreeHost> layer_tree_host = |
741 LayerTreeHost::Create(&client, settings, impl_ccthread.Pass()); | 739 LayerTreeHost::Create(&client, |
| 740 settings, |
| 741 impl_thread.message_loop_proxy()); |
742 | 742 |
743 impl_thread.message_loop_proxy() | 743 impl_thread.message_loop_proxy() |
744 ->PostTask(FROM_HERE, | 744 ->PostTask(FROM_HERE, |
745 base::Bind(&BindInputHandlerOnCompositorThread, | 745 base::Bind(&BindInputHandlerOnCompositorThread, |
746 layer_tree_host->GetInputHandler(), | 746 layer_tree_host->GetInputHandler(), |
747 base::Unretained(&input_handler_client))); | 747 base::Unretained(&input_handler_client))); |
748 | 748 |
749 layer_tree_host->DidStopFlinging(); | 749 layer_tree_host->DidStopFlinging(); |
750 layer_tree_host.reset(); | 750 layer_tree_host.reset(); |
751 impl_thread.Stop(); | 751 impl_thread.Stop(); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 RunTest(true, false, false); | 840 RunTest(true, false, false); |
841 } | 841 } |
842 | 842 |
843 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { | 843 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { |
844 scroll_destroy_whole_tree_ = true; | 844 scroll_destroy_whole_tree_ = true; |
845 RunTest(true, false, false); | 845 RunTest(true, false, false); |
846 } | 846 } |
847 | 847 |
848 } // namespace | 848 } // namespace |
849 } // namespace cc | 849 } // namespace cc |
OLD | NEW |