OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2290 EventListenerProperties::kBlocking); | 2290 EventListenerProperties::kBlocking); |
2291 layer_tree_host()->SetEventListenerProperties( | 2291 layer_tree_host()->SetEventListenerProperties( |
2292 EventListenerClass::kTouchEndOrCancel, | 2292 EventListenerClass::kTouchEndOrCancel, |
2293 EventListenerProperties::kBlockingAndPassive); | 2293 EventListenerProperties::kBlockingAndPassive); |
2294 layer_tree_host()->SetHaveScrollEventHandlers(true); | 2294 layer_tree_host()->SetHaveScrollEventHandlers(true); |
2295 | 2295 |
2296 PostSetNeedsCommitToMainThread(); | 2296 PostSetNeedsCommitToMainThread(); |
2297 } | 2297 } |
2298 | 2298 |
2299 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 2299 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
2300 EXPECT_EQ(gfx::Size(20, 20), impl->DrawViewportSize()); | 2300 EXPECT_EQ(gfx::Rect(20, 20), impl->DeviceViewport()); |
2301 EXPECT_EQ(SK_ColorGRAY, impl->active_tree()->background_color()); | 2301 EXPECT_EQ(SK_ColorGRAY, impl->active_tree()->background_color()); |
2302 EXPECT_EQ(EventListenerProperties::kPassive, | 2302 EXPECT_EQ(EventListenerProperties::kPassive, |
2303 impl->active_tree()->event_listener_properties( | 2303 impl->active_tree()->event_listener_properties( |
2304 EventListenerClass::kMouseWheel)); | 2304 EventListenerClass::kMouseWheel)); |
2305 EXPECT_EQ(EventListenerProperties::kBlocking, | 2305 EXPECT_EQ(EventListenerProperties::kBlocking, |
2306 impl->active_tree()->event_listener_properties( | 2306 impl->active_tree()->event_listener_properties( |
2307 EventListenerClass::kTouchStartOrMove)); | 2307 EventListenerClass::kTouchStartOrMove)); |
2308 EXPECT_EQ(EventListenerProperties::kBlockingAndPassive, | 2308 EXPECT_EQ(EventListenerProperties::kBlockingAndPassive, |
2309 impl->active_tree()->event_listener_properties( | 2309 impl->active_tree()->event_listener_properties( |
2310 EventListenerClass::kTouchEndOrCancel)); | 2310 EventListenerClass::kTouchEndOrCancel)); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2562 client_.set_bounds(root_layer_->bounds()); | 2562 client_.set_bounds(root_layer_->bounds()); |
2563 } | 2563 } |
2564 | 2564 |
2565 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 2565 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
2566 // Should only do one commit. | 2566 // Should only do one commit. |
2567 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); | 2567 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); |
2568 // Device scale factor should come over to impl. | 2568 // Device scale factor should come over to impl. |
2569 EXPECT_NEAR(impl->active_tree()->device_scale_factor(), 1.5f, 0.00001f); | 2569 EXPECT_NEAR(impl->active_tree()->device_scale_factor(), 1.5f, 0.00001f); |
2570 | 2570 |
2571 // Device viewport is scaled. | 2571 // Device viewport is scaled. |
2572 EXPECT_EQ(gfx::Size(60, 60), impl->DrawViewportSize()); | 2572 EXPECT_EQ(gfx::Rect(60, 60), impl->DeviceViewport()); |
2573 | 2573 |
2574 FakePictureLayerImpl* root = static_cast<FakePictureLayerImpl*>( | 2574 FakePictureLayerImpl* root = static_cast<FakePictureLayerImpl*>( |
2575 impl->active_tree()->root_layer_for_testing()); | 2575 impl->active_tree()->root_layer_for_testing()); |
2576 FakePictureLayerImpl* child = static_cast<FakePictureLayerImpl*>( | 2576 FakePictureLayerImpl* child = static_cast<FakePictureLayerImpl*>( |
2577 impl->active_tree()->LayerById(child_layer_->id())); | 2577 impl->active_tree()->LayerById(child_layer_->id())); |
2578 | 2578 |
2579 // Positions remain in layout pixels. | 2579 // Positions remain in layout pixels. |
2580 EXPECT_EQ(gfx::PointF(), root->position()); | 2580 EXPECT_EQ(gfx::PointF(), root->position()); |
2581 EXPECT_EQ(gfx::PointF(2.f, 2.f), child->position()); | 2581 EXPECT_EQ(gfx::PointF(2.f, 2.f), child->position()); |
2582 | 2582 |
(...skipping 5062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7645 void AfterTest() override {} | 7645 void AfterTest() override {} |
7646 | 7646 |
7647 private: | 7647 private: |
7648 bool received_ack_ = false; | 7648 bool received_ack_ = false; |
7649 }; | 7649 }; |
7650 | 7650 |
7651 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease); | 7651 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease); |
7652 | 7652 |
7653 } // namespace | 7653 } // namespace |
7654 } // namespace cc | 7654 } // namespace cc |
OLD | NEW |