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

Side by Side Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11377068: ui: Make gfx::Size::Scale() mutate the class. Add gfx::ScaleSize() similar to Rect/Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaseTOGO 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_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 "cc/layer_tree_host_impl.h" 7 #include "cc/layer_tree_host_impl.h"
8 8
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 // This point is still inside the non-fast region. 480 // This point is still inside the non-fast region.
481 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(10, 10), InputHandlerClient::Wh eel), InputHandlerClient::ScrollOnMainThread); 481 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(10, 10), InputHandlerClient::Wh eel), InputHandlerClient::ScrollOnMainThread);
482 } 482 }
483 483
484 TEST_P(LayerTreeHostImplTest, maxScrollOffsetChangedByDeviceScaleFactor) 484 TEST_P(LayerTreeHostImplTest, maxScrollOffsetChangedByDeviceScaleFactor)
485 { 485 {
486 setupScrollAndContentsLayers(gfx::Size(100, 100)); 486 setupScrollAndContentsLayers(gfx::Size(100, 100));
487 487
488 float deviceScaleFactor = 2; 488 float deviceScaleFactor = 2;
489 gfx::Size layoutViewport(25, 25); 489 gfx::Size layoutViewport(25, 25);
490 gfx::Size deviceViewport(gfx::ToFlooredSize(layoutViewport.Scale(deviceScale Factor))); 490 gfx::Size deviceViewport(gfx::ToFlooredSize(gfx::ScaleSize(layoutViewport, d eviceScaleFactor)));
491 m_hostImpl->setViewportSize(layoutViewport, deviceViewport); 491 m_hostImpl->setViewportSize(layoutViewport, deviceViewport);
492 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); 492 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor);
493 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), gfx::Vector2d(25, 25)) ; 493 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), gfx::Vector2d(25, 25)) ;
494 494
495 deviceScaleFactor = 1; 495 deviceScaleFactor = 1;
496 m_hostImpl->setViewportSize(layoutViewport, layoutViewport); 496 m_hostImpl->setViewportSize(layoutViewport, layoutViewport);
497 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor); 497 m_hostImpl->setDeviceScaleFactor(deviceScaleFactor);
498 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), gfx::Vector2d(75, 75)) ; 498 EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollOffset(), gfx::Vector2d(75, 75)) ;
499 } 499 }
500 500
(...skipping 3935 matching lines...) Expand 10 before | Expand all | Expand 10 after
4436 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a); 4436 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a);
4437 testCaseIndex++; 4437 testCaseIndex++;
4438 } 4438 }
4439 } 4439 }
4440 4440
4441 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, 4441 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests,
4442 LayerTreeHostImplTest, 4442 LayerTreeHostImplTest,
4443 ::testing::Values(false, true)); 4443 ::testing::Values(false, true));
4444 4444
4445 } // anonymous namespace 4445 } // anonymous 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