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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 | 534 |
535 // Scrolling diagonally against an edge will succeed. | 535 // Scrolling diagonally against an edge will succeed. |
536 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, -10))); | 536 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, -10))); |
537 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 0))); | 537 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 0))); |
538 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 10))); | 538 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 10))); |
539 | 539 |
540 // Trying to scroll more than the available space will also succeed. | 540 // Trying to scroll more than the available space will also succeed. |
541 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(5000, 5000))); | 541 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(5000, 5000))); |
542 } | 542 } |
543 | 543 |
544 TEST_P(LayerTreeHostImplTest, maxScrollOffsetChangedByDeviceScaleFactor) | |
545 { | |
546 setupScrollAndContentsLayers(gfx::Size(100, 100)); | |
547 | |
548 float deviceScaleFactor = 2; | |
549 gfx::Size layoutViewport(25, 25); | |
550 gfx::Size deviceViewport(gfx::ToFlooredSize(gfx::ScaleSize(layoutViewport, d
eviceScaleFactor))); | |
551 m_hostImpl->setViewportSize(layoutViewport, deviceViewport); | |
552 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); | |
553 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), gfx::Vector2d(25, 25))
; | |
554 | |
555 deviceScaleFactor = 1; | |
556 m_hostImpl->setViewportSize(layoutViewport, layoutViewport); | |
557 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); | |
558 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), gfx::Vector2d(75, 75))
; | |
559 } | |
560 | |
561 TEST_P(LayerTreeHostImplTest, clearRootRenderSurfaceAndHitTestTouchHandlerRegion
) | 544 TEST_P(LayerTreeHostImplTest, clearRootRenderSurfaceAndHitTestTouchHandlerRegion
) |
562 { | 545 { |
563 setupScrollAndContentsLayers(gfx::Size(100, 100)); | 546 setupScrollAndContentsLayers(gfx::Size(100, 100)); |
564 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); | 547 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); |
565 initializeRendererAndDrawFrame(); | 548 initializeRendererAndDrawFrame(); |
566 | 549 |
567 // We should be able to hit test for touch event handlers even if the root l
ayer loses | 550 // We should be able to hit test for touch event handlers even if the root l
ayer loses |
568 // its render surface after the most recent render. | 551 // its render surface after the most recent render. |
569 m_hostImpl->rootLayer()->clearRenderSurface(); | 552 m_hostImpl->rootLayer()->clearRenderSurface(); |
570 m_hostImpl->setNeedsUpdateDrawProperties(); | 553 m_hostImpl->setNeedsUpdateDrawProperties(); |
(...skipping 4121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4692 m_hostImpl->didDrawAllLayers(frame); | 4675 m_hostImpl->didDrawAllLayers(frame); |
4693 } | 4676 } |
4694 } | 4677 } |
4695 | 4678 |
4696 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4679 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4697 LayerTreeHostImplTest, | 4680 LayerTreeHostImplTest, |
4698 ::testing::Values(false, true)); | 4681 ::testing::Values(false, true)); |
4699 | 4682 |
4700 } // namespace | 4683 } // namespace |
4701 } // namespace cc | 4684 } // namespace cc |
OLD | NEW |