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

Side by Side Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11958004: Make new-style page scale work on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to 177887 Created 7 years, 11 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
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/layer_tree_impl.h » ('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 "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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 534
535 // Scrolling diagonally against an edge will succeed. 535 // Scrolling diagonally against an edge will succeed.
536 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, -10))); 536 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, -10)));
537 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 0))); 537 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 0)));
538 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 10))); 538 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 10)));
539 539
540 // Trying to scroll more than the available space will also succeed. 540 // Trying to scroll more than the available space will also succeed.
541 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(5000, 5000))); 541 EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(5000, 5000)));
542 } 542 }
543 543
544 TEST_P(LayerTreeHostImplTest, maxScrollOffsetChangedByDeviceScaleFactor)
545 {
546 setupScrollAndContentsLayers(gfx::Size(100, 100));
547
548 float deviceScaleFactor = 2;
549 gfx::Size layoutViewport(25, 25);
550 gfx::Size deviceViewport(gfx::ToFlooredSize(gfx::ScaleSize(layoutViewport, d eviceScaleFactor)));
551 m_hostImpl->setViewportSize(layoutViewport, deviceViewport);
552 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor);
553 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), gfx::Vector2d(25, 25)) ;
554
555 deviceScaleFactor = 1;
556 m_hostImpl->setViewportSize(layoutViewport, layoutViewport);
557 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor);
558 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), gfx::Vector2d(75, 75)) ;
559 }
560
561 TEST_P(LayerTreeHostImplTest, clearRootRenderSurfaceAndHitTestTouchHandlerRegion ) 544 TEST_P(LayerTreeHostImplTest, clearRootRenderSurfaceAndHitTestTouchHandlerRegion )
562 { 545 {
563 setupScrollAndContentsLayers(gfx::Size(100, 100)); 546 setupScrollAndContentsLayers(gfx::Size(100, 100));
564 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50)); 547 m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
565 initializeRendererAndDrawFrame(); 548 initializeRendererAndDrawFrame();
566 549
567 // We should be able to hit test for touch event handlers even if the root l ayer loses 550 // We should be able to hit test for touch event handlers even if the root l ayer loses
568 // its render surface after the most recent render. 551 // its render surface after the most recent render.
569 m_hostImpl->rootLayer()->clearRenderSurface(); 552 m_hostImpl->rootLayer()->clearRenderSurface();
570 m_hostImpl->setNeedsUpdateDrawProperties(); 553 m_hostImpl->setNeedsUpdateDrawProperties();
(...skipping 4121 matching lines...) Expand 10 before | Expand all | Expand 10 after
4692 m_hostImpl->didDrawAllLayers(frame); 4675 m_hostImpl->didDrawAllLayers(frame);
4693 } 4676 }
4694 } 4677 }
4695 4678
4696 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, 4679 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests,
4697 LayerTreeHostImplTest, 4680 LayerTreeHostImplTest,
4698 ::testing::Values(false, true)); 4681 ::testing::Values(false, true));
4699 4682
4700 } // namespace 4683 } // namespace
4701 } // namespace cc 4684 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698