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

Side by Side Diff: cc/CCLayerTreeHostImplTest.cpp

Issue 11048044: cc: Switch to Chromium DCHECKs and LOGs (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months 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
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 "CCLayerTreeHostImpl.h" 7 #include "CCLayerTreeHostImpl.h"
8 8
9 #include "CCAnimationTestCommon.h" 9 #include "CCAnimationTestCommon.h"
10 #include "CCDelegatedRendererLayerImpl.h" 10 #include "CCDelegatedRendererLayerImpl.h"
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 { 470 {
471 // This test is specific to the page-scale based pinch zoom. 471 // This test is specific to the page-scale based pinch zoom.
472 if (!CCSettings::pageScalePinchZoomEnabled()) 472 if (!CCSettings::pageScalePinchZoomEnabled())
473 return; 473 return;
474 474
475 setupScrollAndContentsLayers(IntSize(100, 100)); 475 setupScrollAndContentsLayers(IntSize(100, 100));
476 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); 476 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
477 initializeRendererAndDrawFrame(); 477 initializeRendererAndDrawFrame();
478 478
479 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); 479 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
480 ASSERT(scrollLayer); 480 DCHECK(scrollLayer);
481 481
482 const float minPageScale = 1, maxPageScale = 4; 482 const float minPageScale = 1, maxPageScale = 4;
483 const WebTransformationMatrix identityScaleTransform; 483 const WebTransformationMatrix identityScaleTransform;
484 484
485 // The impl-based pinch zoome should not adjust the max scroll position. 485 // The impl-based pinch zoome should not adjust the max scroll position.
486 { 486 {
487 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); 487 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
488 scrollLayer->setImplTransform(identityScaleTransform); 488 scrollLayer->setImplTransform(identityScaleTransform);
489 scrollLayer->setScrollDelta(IntSize()); 489 scrollLayer->setScrollDelta(IntSize());
490 490
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 } 523 }
524 } 524 }
525 525
526 TEST_P(CCLayerTreeHostImplTest, pinchGesture) 526 TEST_P(CCLayerTreeHostImplTest, pinchGesture)
527 { 527 {
528 setupScrollAndContentsLayers(IntSize(100, 100)); 528 setupScrollAndContentsLayers(IntSize(100, 100));
529 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); 529 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
530 initializeRendererAndDrawFrame(); 530 initializeRendererAndDrawFrame();
531 531
532 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); 532 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
533 ASSERT(scrollLayer); 533 DCHECK(scrollLayer);
534 534
535 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ; 535 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ;
536 const float maxPageScale = 4; 536 const float maxPageScale = 4;
537 const WebTransformationMatrix identityScaleTransform; 537 const WebTransformationMatrix identityScaleTransform;
538 538
539 // Basic pinch zoom in gesture 539 // Basic pinch zoom in gesture
540 { 540 {
541 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); 541 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
542 scrollLayer->setImplTransform(identityScaleTransform); 542 scrollLayer->setImplTransform(identityScaleTransform);
543 scrollLayer->setScrollDelta(IntSize()); 543 scrollLayer->setScrollDelta(IntSize());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 } 610 }
611 } 611 }
612 612
613 TEST_P(CCLayerTreeHostImplTest, pageScaleAnimation) 613 TEST_P(CCLayerTreeHostImplTest, pageScaleAnimation)
614 { 614 {
615 setupScrollAndContentsLayers(IntSize(100, 100)); 615 setupScrollAndContentsLayers(IntSize(100, 100));
616 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); 616 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
617 initializeRendererAndDrawFrame(); 617 initializeRendererAndDrawFrame();
618 618
619 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); 619 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
620 ASSERT(scrollLayer); 620 DCHECK(scrollLayer);
621 621
622 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ; 622 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ;
623 const float maxPageScale = 4; 623 const float maxPageScale = 4;
624 const double startTime = 1; 624 const double startTime = 1;
625 const double duration = 0.1; 625 const double duration = 0.1;
626 const double halfwayThroughAnimation = startTime + duration / 2; 626 const double halfwayThroughAnimation = startTime + duration / 2;
627 const double endTime = startTime + duration; 627 const double endTime = startTime + duration;
628 const WebTransformationMatrix identityScaleTransform; 628 const WebTransformationMatrix identityScaleTransform;
629 629
630 // Non-anchor zoom-in 630 // Non-anchor zoom-in
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 } 662 }
663 } 663 }
664 664
665 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZoomin g) 665 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZoomin g)
666 { 666 {
667 setupScrollAndContentsLayers(IntSize(100, 100)); 667 setupScrollAndContentsLayers(IntSize(100, 100));
668 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); 668 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
669 initializeRendererAndDrawFrame(); 669 initializeRendererAndDrawFrame();
670 670
671 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); 671 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
672 ASSERT(scrollLayer); 672 DCHECK(scrollLayer);
673 673
674 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ; 674 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ;
675 const float maxPageScale = 4; 675 const float maxPageScale = 4;
676 676
677 // Pinch zoom in. 677 // Pinch zoom in.
678 { 678 {
679 // Start a pinch in gesture at the bottom right corner of the viewport. 679 // Start a pinch in gesture at the bottom right corner of the viewport.
680 const float zoomInDelta = 2; 680 const float zoomInDelta = 2;
681 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); 681 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
682 m_hostImpl->pinchGestureBegin(); 682 m_hostImpl->pinchGestureBegin();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 } 731 }
732 } 732 }
733 733
734 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPa geScale) 734 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPa geScale)
735 { 735 {
736 setupScrollAndContentsLayers(IntSize(100, 100)); 736 setupScrollAndContentsLayers(IntSize(100, 100));
737 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); 737 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
738 initializeRendererAndDrawFrame(); 738 initializeRendererAndDrawFrame();
739 739
740 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); 740 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
741 ASSERT(scrollLayer); 741 DCHECK(scrollLayer);
742 742
743 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ; 743 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ;
744 const float maxPageScale = 4; 744 const float maxPageScale = 4;
745 const double startTime = 1; 745 const double startTime = 1;
746 const double duration = 0.1; 746 const double duration = 0.1;
747 const double halfwayThroughAnimation = startTime + duration / 2; 747 const double halfwayThroughAnimation = startTime + duration / 2;
748 const double endTime = startTime + duration; 748 const double endTime = startTime + duration;
749 749
750 // Start a page scale animation. 750 // Start a page scale animation.
751 const float pageScaleDelta = 2; 751 const float pageScaleDelta = 2;
(...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after
2591 2591
2592 class FakeScrollbarLayerImpl : public CCScrollbarLayerImpl { 2592 class FakeScrollbarLayerImpl : public CCScrollbarLayerImpl {
2593 public: 2593 public:
2594 static PassOwnPtr<FakeScrollbarLayerImpl> create(int id) 2594 static PassOwnPtr<FakeScrollbarLayerImpl> create(int id)
2595 { 2595 {
2596 return adoptPtr(new FakeScrollbarLayerImpl(id)); 2596 return adoptPtr(new FakeScrollbarLayerImpl(id));
2597 } 2597 }
2598 2598
2599 void createResources(CCResourceProvider* provider) 2599 void createResources(CCResourceProvider* provider)
2600 { 2600 {
2601 ASSERT(provider); 2601 DCHECK(provider);
2602 int pool = 0; 2602 int pool = 0;
2603 IntSize size(10, 10); 2603 IntSize size(10, 10);
2604 GC3Denum format = GraphicsContext3D::RGBA; 2604 GC3Denum format = GraphicsContext3D::RGBA;
2605 CCResourceProvider::TextureUsageHint hint = CCResourceProvider::TextureU sageAny; 2605 CCResourceProvider::TextureUsageHint hint = CCResourceProvider::TextureU sageAny;
2606 setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(FakeWebScroll barThemeGeometryNonEmpty::create())); 2606 setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(FakeWebScroll barThemeGeometryNonEmpty::create()));
2607 2607
2608 setBackTrackResourceId(provider->createResource(pool, size, format, hint )); 2608 setBackTrackResourceId(provider->createResource(pool, size, format, hint ));
2609 setForeTrackResourceId(provider->createResource(pool, size, format, hint )); 2609 setForeTrackResourceId(provider->createResource(pool, size, format, hint ));
2610 setThumbResourceId(provider->createResource(pool, size, format, hint)); 2610 setThumbResourceId(provider->createResource(pool, size, format, hint));
2611 } 2611 }
(...skipping 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after
4335 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a); 4335 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a);
4336 testCaseIndex++; 4336 testCaseIndex++;
4337 } 4337 }
4338 } 4338 }
4339 4339
4340 INSTANTIATE_TEST_CASE_P(CCLayerTreeHostImplTests, 4340 INSTANTIATE_TEST_CASE_P(CCLayerTreeHostImplTests,
4341 CCLayerTreeHostImplTest, 4341 CCLayerTreeHostImplTest,
4342 ::testing::Values(false, true)); 4342 ::testing::Values(false, true));
4343 4343
4344 } // namespace 4344 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698