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

Side by Side Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11192030: cc: Switch to Chromium DCHECKs LOGs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaseonenne 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 | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/layer_tree_host_unittest.cc » ('j') | 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 "CCLayerTreeHostImpl.h" 7 #include "CCLayerTreeHostImpl.h"
8 8
9 #include "CCDelegatedRendererLayerImpl.h" 9 #include "CCDelegatedRendererLayerImpl.h"
10 #include "CCHeadsUpDisplayLayerImpl.h" 10 #include "CCHeadsUpDisplayLayerImpl.h"
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 { 483 {
484 // This test is specific to the page-scale based pinch zoom. 484 // This test is specific to the page-scale based pinch zoom.
485 if (!CCSettings::pageScalePinchZoomEnabled()) 485 if (!CCSettings::pageScalePinchZoomEnabled())
486 return; 486 return;
487 487
488 setupScrollAndContentsLayers(IntSize(100, 100)); 488 setupScrollAndContentsLayers(IntSize(100, 100));
489 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); 489 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
490 initializeRendererAndDrawFrame(); 490 initializeRendererAndDrawFrame();
491 491
492 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); 492 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
493 ASSERT(scrollLayer); 493 DCHECK(scrollLayer);
494 494
495 const float minPageScale = 1, maxPageScale = 4; 495 const float minPageScale = 1, maxPageScale = 4;
496 const WebTransformationMatrix identityScaleTransform; 496 const WebTransformationMatrix identityScaleTransform;
497 497
498 // The impl-based pinch zoome should not adjust the max scroll position. 498 // The impl-based pinch zoome should not adjust the max scroll position.
499 { 499 {
500 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); 500 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
501 scrollLayer->setImplTransform(identityScaleTransform); 501 scrollLayer->setImplTransform(identityScaleTransform);
502 scrollLayer->setScrollDelta(IntSize()); 502 scrollLayer->setScrollDelta(IntSize());
503 503
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 } 536 }
537 } 537 }
538 538
539 TEST_P(CCLayerTreeHostImplTest, pinchGesture) 539 TEST_P(CCLayerTreeHostImplTest, pinchGesture)
540 { 540 {
541 setupScrollAndContentsLayers(IntSize(100, 100)); 541 setupScrollAndContentsLayers(IntSize(100, 100));
542 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); 542 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
543 initializeRendererAndDrawFrame(); 543 initializeRendererAndDrawFrame();
544 544
545 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); 545 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
546 ASSERT(scrollLayer); 546 DCHECK(scrollLayer);
547 547
548 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ; 548 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ;
549 const float maxPageScale = 4; 549 const float maxPageScale = 4;
550 const WebTransformationMatrix identityScaleTransform; 550 const WebTransformationMatrix identityScaleTransform;
551 551
552 // Basic pinch zoom in gesture 552 // Basic pinch zoom in gesture
553 { 553 {
554 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); 554 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
555 scrollLayer->setImplTransform(identityScaleTransform); 555 scrollLayer->setImplTransform(identityScaleTransform);
556 scrollLayer->setScrollDelta(IntSize()); 556 scrollLayer->setScrollDelta(IntSize());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 } 623 }
624 } 624 }
625 625
626 TEST_P(CCLayerTreeHostImplTest, pageScaleAnimation) 626 TEST_P(CCLayerTreeHostImplTest, pageScaleAnimation)
627 { 627 {
628 setupScrollAndContentsLayers(IntSize(100, 100)); 628 setupScrollAndContentsLayers(IntSize(100, 100));
629 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); 629 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
630 initializeRendererAndDrawFrame(); 630 initializeRendererAndDrawFrame();
631 631
632 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); 632 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
633 ASSERT(scrollLayer); 633 DCHECK(scrollLayer);
634 634
635 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ; 635 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ;
636 const float maxPageScale = 4; 636 const float maxPageScale = 4;
637 const double startTime = 1; 637 const double startTime = 1;
638 const double duration = 0.1; 638 const double duration = 0.1;
639 const double halfwayThroughAnimation = startTime + duration / 2; 639 const double halfwayThroughAnimation = startTime + duration / 2;
640 const double endTime = startTime + duration; 640 const double endTime = startTime + duration;
641 const WebTransformationMatrix identityScaleTransform; 641 const WebTransformationMatrix identityScaleTransform;
642 642
643 // Non-anchor zoom-in 643 // Non-anchor zoom-in
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 } 675 }
676 } 676 }
677 677
678 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZoomin g) 678 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZoomin g)
679 { 679 {
680 setupScrollAndContentsLayers(IntSize(100, 100)); 680 setupScrollAndContentsLayers(IntSize(100, 100));
681 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); 681 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
682 initializeRendererAndDrawFrame(); 682 initializeRendererAndDrawFrame();
683 683
684 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); 684 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
685 ASSERT(scrollLayer); 685 DCHECK(scrollLayer);
686 686
687 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ; 687 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ;
688 const float maxPageScale = 4; 688 const float maxPageScale = 4;
689 689
690 // Pinch zoom in. 690 // Pinch zoom in.
691 { 691 {
692 // Start a pinch in gesture at the bottom right corner of the viewport. 692 // Start a pinch in gesture at the bottom right corner of the viewport.
693 const float zoomInDelta = 2; 693 const float zoomInDelta = 2;
694 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale); 694 m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
695 m_hostImpl->pinchGestureBegin(); 695 m_hostImpl->pinchGestureBegin();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 } 744 }
745 } 745 }
746 746
747 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPa geScale) 747 TEST_P(CCLayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPa geScale)
748 { 748 {
749 setupScrollAndContentsLayers(IntSize(100, 100)); 749 setupScrollAndContentsLayers(IntSize(100, 100));
750 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50)); 750 m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
751 initializeRendererAndDrawFrame(); 751 initializeRendererAndDrawFrame();
752 752
753 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer(); 753 CCLayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
754 ASSERT(scrollLayer); 754 DCHECK(scrollLayer);
755 755
756 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ; 756 const float minPageScale = CCSettings::pageScalePinchZoomEnabled() ? 1 : 0.5 ;
757 const float maxPageScale = 4; 757 const float maxPageScale = 4;
758 const double startTime = 1; 758 const double startTime = 1;
759 const double duration = 0.1; 759 const double duration = 0.1;
760 const double halfwayThroughAnimation = startTime + duration / 2; 760 const double halfwayThroughAnimation = startTime + duration / 2;
761 const double endTime = startTime + duration; 761 const double endTime = startTime + duration;
762 762
763 // Start a page scale animation. 763 // Start a page scale animation.
764 const float pageScaleDelta = 2; 764 const float pageScaleDelta = 2;
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after
2609 2609
2610 class FakeScrollbarLayerImpl : public CCScrollbarLayerImpl { 2610 class FakeScrollbarLayerImpl : public CCScrollbarLayerImpl {
2611 public: 2611 public:
2612 static scoped_ptr<FakeScrollbarLayerImpl> create(int id) 2612 static scoped_ptr<FakeScrollbarLayerImpl> create(int id)
2613 { 2613 {
2614 return make_scoped_ptr(new FakeScrollbarLayerImpl(id)); 2614 return make_scoped_ptr(new FakeScrollbarLayerImpl(id));
2615 } 2615 }
2616 2616
2617 void createResources(CCResourceProvider* provider) 2617 void createResources(CCResourceProvider* provider)
2618 { 2618 {
2619 ASSERT(provider); 2619 DCHECK(provider);
2620 int pool = 0; 2620 int pool = 0;
2621 IntSize size(10, 10); 2621 IntSize size(10, 10);
2622 GC3Denum format = GraphicsContext3D::RGBA; 2622 GC3Denum format = GraphicsContext3D::RGBA;
2623 CCResourceProvider::TextureUsageHint hint = CCResourceProvider::TextureU sageAny; 2623 CCResourceProvider::TextureUsageHint hint = CCResourceProvider::TextureU sageAny;
2624 setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(FakeWebScroll barThemeGeometryNonEmpty::create())); 2624 setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(FakeWebScroll barThemeGeometryNonEmpty::create()));
2625 2625
2626 setBackTrackResourceId(provider->createResource(pool, size, format, hint )); 2626 setBackTrackResourceId(provider->createResource(pool, size, format, hint ));
2627 setForeTrackResourceId(provider->createResource(pool, size, format, hint )); 2627 setForeTrackResourceId(provider->createResource(pool, size, format, hint ));
2628 setThumbResourceId(provider->createResource(pool, size, format, hint)); 2628 setThumbResourceId(provider->createResource(pool, size, format, hint));
2629 } 2629 }
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after
4374 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a); 4374 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a);
4375 testCaseIndex++; 4375 testCaseIndex++;
4376 } 4376 }
4377 } 4377 }
4378 4378
4379 INSTANTIATE_TEST_CASE_P(CCLayerTreeHostImplTests, 4379 INSTANTIATE_TEST_CASE_P(CCLayerTreeHostImplTests,
4380 CCLayerTreeHostImplTest, 4380 CCLayerTreeHostImplTest,
4381 ::testing::Values(false, true)); 4381 ::testing::Values(false, true));
4382 4382
4383 } // namespace 4383 } // namespace
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698