| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/layer_tree_host_impl.h" | 7 #include "cc/layer_tree_host_impl.h" |
| 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Gestur
e), InputHandlerClient::ScrollOnMainThread); | 432 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Gestur
e), InputHandlerClient::ScrollOnMainThread); |
| 433 } | 433 } |
| 434 | 434 |
| 435 TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionBasic) | 435 TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionBasic) |
| 436 { | 436 { |
| 437 setupScrollAndContentsLayers(gfx::Size(200, 200)); | 437 setupScrollAndContentsLayers(gfx::Size(200, 200)); |
| 438 m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); | 438 m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); |
| 439 initializeRendererAndDrawFrame(); | 439 initializeRendererAndDrawFrame(); |
| 440 LayerImpl* root = m_hostImpl->rootLayer(); | 440 LayerImpl* root = m_hostImpl->rootLayer(); |
| 441 | 441 |
| 442 root->setNonFastScrollableRegion(IntRect(0, 0, 50, 50)); | 442 root->setNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50)); |
| 443 | 443 |
| 444 // All scroll types inside the non-fast scrollable region should fail. | 444 // All scroll types inside the non-fast scrollable region should fail. |
| 445 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), InputHandlerClient::Whee
l), InputHandlerClient::ScrollOnMainThread); | 445 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), InputHandlerClient::Whee
l), InputHandlerClient::ScrollOnMainThread); |
| 446 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), InputHandlerClient::Gest
ure), InputHandlerClient::ScrollOnMainThread); | 446 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(25, 25), InputHandlerClient::Gest
ure), InputHandlerClient::ScrollOnMainThread); |
| 447 | 447 |
| 448 // All scroll types outside this region should succeed. | 448 // All scroll types outside this region should succeed. |
| 449 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(75, 75), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); | 449 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(75, 75), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); |
| 450 m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); | 450 m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); |
| 451 m_hostImpl->scrollEnd(); | 451 m_hostImpl->scrollEnd(); |
| 452 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(75, 75), InputHandlerClient::Gest
ure), InputHandlerClient::ScrollStarted); | 452 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(75, 75), InputHandlerClient::Gest
ure), InputHandlerClient::ScrollStarted); |
| 453 m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); | 453 m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); |
| 454 m_hostImpl->scrollEnd(); | 454 m_hostImpl->scrollEnd(); |
| 455 } | 455 } |
| 456 | 456 |
| 457 TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionWithOffset) | 457 TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionWithOffset) |
| 458 { | 458 { |
| 459 setupScrollAndContentsLayers(gfx::Size(200, 200)); | 459 setupScrollAndContentsLayers(gfx::Size(200, 200)); |
| 460 m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); | 460 m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); |
| 461 LayerImpl* root = m_hostImpl->rootLayer(); | 461 LayerImpl* root = m_hostImpl->rootLayer(); |
| 462 | 462 |
| 463 root->setNonFastScrollableRegion(IntRect(0, 0, 50, 50)); | 463 root->setNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50)); |
| 464 root->setPosition(gfx::PointF(-25, 0)); | 464 root->setPosition(gfx::PointF(-25, 0)); |
| 465 initializeRendererAndDrawFrame(); | 465 initializeRendererAndDrawFrame(); |
| 466 | 466 |
| 467 // This point would fall into the non-fast scrollable region except that we'
ve moved the layer down by 25 pixels. | 467 // This point would fall into the non-fast scrollable region except that we'
ve moved the layer down by 25 pixels. |
| 468 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(40, 10), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); | 468 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(40, 10), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); |
| 469 m_hostImpl->scrollBy(IntPoint(), IntSize(0, 1)); | 469 m_hostImpl->scrollBy(IntPoint(), IntSize(0, 1)); |
| 470 m_hostImpl->scrollEnd(); | 470 m_hostImpl->scrollEnd(); |
| 471 | 471 |
| 472 // This point is still inside the non-fast region. | 472 // This point is still inside the non-fast region. |
| 473 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(10, 10), InputHandlerClient::Whee
l), InputHandlerClient::ScrollOnMainThread); | 473 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(10, 10), InputHandlerClient::Whee
l), InputHandlerClient::ScrollOnMainThread); |
| (...skipping 3935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4409 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); | 4409 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat
a); |
| 4410 testCaseIndex++; | 4410 testCaseIndex++; |
| 4411 } | 4411 } |
| 4412 } | 4412 } |
| 4413 | 4413 |
| 4414 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4414 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
| 4415 LayerTreeHostImplTest, | 4415 LayerTreeHostImplTest, |
| 4416 ::testing::Values(false, true)); | 4416 ::testing::Values(false, true)); |
| 4417 | 4417 |
| 4418 } // namespace | 4418 } // namespace |
| OLD | NEW |