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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 // Scrolling to the right/bottom will succeed. | 511 // Scrolling to the right/bottom will succeed. |
512 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, 0))); | 512 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, 0))); |
513 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 10))); | 513 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 10))); |
514 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, 10))); | 514 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, 10))); |
515 | 515 |
516 // Scrolling to left/top will now succeed. | 516 // Scrolling to left/top will now succeed. |
517 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 0))); | 517 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 0))); |
518 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, -10))); | 518 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, -10))); |
519 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, -10))); | 519 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, -10))); |
520 | 520 |
| 521 // Scrolling diagonally against an edge will succeed. |
| 522 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, -10))); |
| 523 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 0))); |
| 524 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 10))); |
| 525 |
521 // Trying to scroll more than the available space will also succeed. | 526 // Trying to scroll more than the available space will also succeed. |
522 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(5000, 5000))); | 527 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(5000, 5000))); |
523 } | 528 } |
524 | 529 |
525 TEST_P(LayerTreeHostImplTest, maxScrollOffsetChangedByDeviceScaleFactor) | 530 TEST_P(LayerTreeHostImplTest, maxScrollOffsetChangedByDeviceScaleFactor) |
526 { | 531 { |
527 setupScrollAndContentsLayers(gfx::Size(100, 100)); | 532 setupScrollAndContentsLayers(gfx::Size(100, 100)); |
528 | 533 |
529 float deviceScaleFactor = 2; | 534 float deviceScaleFactor = 2; |
530 gfx::Size layoutViewport(25, 25); | 535 gfx::Size layoutViewport(25, 25); |
(...skipping 4359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4890 { | 4895 { |
4891 pinchZoomPanViewportAndScrollBoundaryTest(2); | 4896 pinchZoomPanViewportAndScrollBoundaryTest(2); |
4892 } | 4897 } |
4893 | 4898 |
4894 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4899 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4895 LayerTreeHostImplTest, | 4900 LayerTreeHostImplTest, |
4896 ::testing::Values(false, true)); | 4901 ::testing::Values(false, true)); |
4897 | 4902 |
4898 } // namespace | 4903 } // namespace |
4899 } // namespace cc | 4904 } // namespace cc |
OLD | NEW |