Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(955)

Side by Side Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11377006: LayerImpl::tryScroll must convert its content-space point to layer space before comparing to the no… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ToRoundedPoint Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layer_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 root->setShouldScrollOnMainThread(true); 425 root->setShouldScrollOnMainThread(true);
426 426
427 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Whee l), InputHandlerClient::ScrollOnMainThread); 427 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Whee l), InputHandlerClient::ScrollOnMainThread);
428 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gest ure), InputHandlerClient::ScrollOnMainThread); 428 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gest ure), InputHandlerClient::ScrollOnMainThread);
429 } 429 }
430 430
431 TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionBasic) 431 TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionBasic)
432 { 432 {
433 setupScrollAndContentsLayers(gfx::Size(200, 200)); 433 setupScrollAndContentsLayers(gfx::Size(200, 200));
434 m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); 434 m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
435
436 LayerImpl* root = m_hostImpl->rootLayer();
437 root->setContentsScale(2, 2);
438 root->setNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50));
439
435 initializeRendererAndDrawFrame(); 440 initializeRendererAndDrawFrame();
436 LayerImpl* root = m_hostImpl->rootLayer();
437
438 root->setNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50));
439 441
440 // All scroll types inside the non-fast scrollable region should fail. 442 // All scroll types inside the non-fast scrollable region should fail.
441 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(25, 25), InputHandlerClient::Wh eel), InputHandlerClient::ScrollOnMainThread); 443 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(25, 25), InputHandlerClient::Wh eel), InputHandlerClient::ScrollOnMainThread);
442 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(25, 25), InputHandlerClient::Ge sture), InputHandlerClient::ScrollOnMainThread); 444 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(25, 25), InputHandlerClient::Ge sture), InputHandlerClient::ScrollOnMainThread);
443 445
444 // All scroll types outside this region should succeed. 446 // All scroll types outside this region should succeed.
445 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(75, 75), InputHandlerClient::Wh eel), InputHandlerClient::ScrollStarted); 447 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(75, 75), InputHandlerClient::Wh eel), InputHandlerClient::ScrollStarted);
446 m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 10)); 448 m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 10));
447 m_hostImpl->scrollEnd(); 449 m_hostImpl->scrollEnd();
448 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(75, 75), InputHandlerClient::Ge sture), InputHandlerClient::ScrollStarted); 450 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(75, 75), InputHandlerClient::Ge sture), InputHandlerClient::ScrollStarted);
449 m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 10)); 451 m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 10));
450 m_hostImpl->scrollEnd(); 452 m_hostImpl->scrollEnd();
451 } 453 }
452 454
453 TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionWithOffset) 455 TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionWithOffset)
454 { 456 {
455 setupScrollAndContentsLayers(gfx::Size(200, 200)); 457 setupScrollAndContentsLayers(gfx::Size(200, 200));
456 m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); 458 m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
459
457 LayerImpl* root = m_hostImpl->rootLayer(); 460 LayerImpl* root = m_hostImpl->rootLayer();
458 461 root->setContentsScale(2, 2);
459 root->setNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50)); 462 root->setNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50));
460 root->setPosition(gfx::PointF(-25, 0)); 463 root->setPosition(gfx::PointF(-25, 0));
464
461 initializeRendererAndDrawFrame(); 465 initializeRendererAndDrawFrame();
462 466
463 // 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.
464 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(40, 10), InputHandlerClient::Wh eel), InputHandlerClient::ScrollStarted); 468 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(40, 10), InputHandlerClient::Wh eel), InputHandlerClient::ScrollStarted);
465 m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 1)); 469 m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 1));
466 m_hostImpl->scrollEnd(); 470 m_hostImpl->scrollEnd();
467 471
468 // This point is still inside the non-fast region. 472 // This point is still inside the non-fast region.
469 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(10, 10), InputHandlerClient::Wh eel), InputHandlerClient::ScrollOnMainThread); 473 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(10, 10), InputHandlerClient::Wh eel), InputHandlerClient::ScrollOnMainThread);
470 } 474 }
(...skipping 3933 matching lines...) Expand 10 before | Expand all | Expand 10 after
4404 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a); 4408 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a);
4405 testCaseIndex++; 4409 testCaseIndex++;
4406 } 4410 }
4407 } 4411 }
4408 4412
4409 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, 4413 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests,
4410 LayerTreeHostImplTest, 4414 LayerTreeHostImplTest,
4411 ::testing::Values(false, true)); 4415 ::testing::Values(false, true));
4412 4416
4413 } // anonymous namespace 4417 } // anonymous namespace
OLDNEW
« no previous file with comments | « cc/layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698