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/layer_tree_host_impl.h" | 5 #include "cc/layer_tree_host_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 m_hostImpl->setViewportSize(layoutViewport, deviceViewport); | 543 m_hostImpl->setViewportSize(layoutViewport, deviceViewport); |
544 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); | 544 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); |
545 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), gfx::Vector2d(25, 25))
; | 545 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), gfx::Vector2d(25, 25))
; |
546 | 546 |
547 deviceScaleFactor = 1; | 547 deviceScaleFactor = 1; |
548 m_hostImpl->setViewportSize(layoutViewport, layoutViewport); | 548 m_hostImpl->setViewportSize(layoutViewport, layoutViewport); |
549 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); | 549 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); |
550 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), gfx::Vector2d(75, 75))
; | 550 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), gfx::Vector2d(75, 75))
; |
551 } | 551 } |
552 | 552 |
| 553 TEST_P(LayerTreeHostImplTest, clearRootRenderSurfaceAndHitTestTouchHandlerRegion
) |
| 554 { |
| 555 setupScrollAndContentsLayers(gfx::Size(100, 100)); |
| 556 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); |
| 557 initializeRendererAndDrawFrame(); |
| 558 |
| 559 // We should be able to hit test for touch event handlers even if the root l
ayer loses |
| 560 // its render surface after the most recent render. |
| 561 m_hostImpl->rootLayer()->clearRenderSurface(); |
| 562 m_hostImpl->setNeedsUpdateDrawProperties(); |
| 563 |
| 564 EXPECT_EQ(m_hostImpl->haveTouchEventHandlersAt(gfx::Point(0, 0)), false); |
| 565 } |
| 566 |
553 TEST_P(LayerTreeHostImplTest, implPinchZoom) | 567 TEST_P(LayerTreeHostImplTest, implPinchZoom) |
554 { | 568 { |
555 // This test is specific to the page-scale based pinch zoom. | 569 // This test is specific to the page-scale based pinch zoom. |
556 if (!m_hostImpl->settings().pageScalePinchZoomEnabled) | 570 if (!m_hostImpl->settings().pageScalePinchZoomEnabled) |
557 return; | 571 return; |
558 | 572 |
559 setupScrollAndContentsLayers(gfx::Size(100, 100)); | 573 setupScrollAndContentsLayers(gfx::Size(100, 100)); |
560 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 574 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); |
561 initializeRendererAndDrawFrame(); | 575 initializeRendererAndDrawFrame(); |
562 | 576 |
(...skipping 3835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4398 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); | 4412 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); |
4399 drawFrameAndTestDamage(noDamage); | 4413 drawFrameAndTestDamage(noDamage); |
4400 } | 4414 } |
4401 | 4415 |
4402 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4416 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4403 LayerTreeHostImplTest, | 4417 LayerTreeHostImplTest, |
4404 ::testing::Values(false, true)); | 4418 ::testing::Values(false, true)); |
4405 | 4419 |
4406 } // namespace | 4420 } // namespace |
4407 } // namespace cc | 4421 } // namespace cc |
OLD | NEW |