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

Unified Diff: cc/layers/painted_scrollbar_layer_impl_unittest.cc

Issue 913133004: cc: Make PaintedScrollbarLayer not use ContentsScalingLayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: danakj review Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: cc/layers/painted_scrollbar_layer_impl_unittest.cc
diff --git a/cc/layers/painted_scrollbar_layer_impl_unittest.cc b/cc/layers/painted_scrollbar_layer_impl_unittest.cc
index 3994cc36ca19b323b54e004576e31ce6ddc66b94..9da6783cce3a5234978d5d6fc1b943936db7e037 100644
--- a/cc/layers/painted_scrollbar_layer_impl_unittest.cc
+++ b/cc/layers/painted_scrollbar_layer_impl_unittest.cc
@@ -4,6 +4,7 @@
#include "cc/layers/painted_scrollbar_layer_impl.h"
+#include "cc/quads/draw_quad.h"
#include "cc/test/layer_test_common.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -12,6 +13,8 @@ namespace {
TEST(PaintedScrollbarLayerImplTest, Occlusion) {
gfx::Size layer_size(10, 1000);
+ float scale = 2.f;
+ gfx::Size scaled_layer_size(20, 2000);
gfx::Size viewport_size(1000, 1000);
LayerTestCommon::LayerImplTest impl;
@@ -36,6 +39,8 @@ TEST(PaintedScrollbarLayerImplTest, Occlusion) {
impl.AddChildToRoot<PaintedScrollbarLayerImpl>(orientation);
scrollbar_layer_impl->SetBounds(layer_size);
scrollbar_layer_impl->SetContentBounds(layer_size);
+ scrollbar_layer_impl->set_internal_contents_scale_and_bounds(
+ scale, scaled_layer_size);
scrollbar_layer_impl->SetDrawsContent(true);
scrollbar_layer_impl->SetThumbThickness(layer_size.width());
scrollbar_layer_impl->SetThumbLength(500);
@@ -62,6 +67,14 @@ TEST(PaintedScrollbarLayerImplTest, Occlusion) {
impl.quad_list(), occluded, &partially_occluded_count);
EXPECT_EQ(2u, impl.quad_list().size());
EXPECT_EQ(0u, partially_occluded_count);
+
+ const DrawQuad* thumb_quad = impl.quad_list().ElementAt(0);
+ const DrawQuad* track_quad = impl.quad_list().ElementAt(1);
+
+ gfx::Rect scaled_thumb_rect = gfx::ScaleToEnclosingRect(thumb_rect, scale);
danakj 2015/02/12 22:18:05 Can you leave a comment making note that this is t
enne (OOO) 2015/02/12 22:26:34 Done.
+ EXPECT_EQ(track_quad->rect.ToString(),
+ gfx::Rect(scaled_layer_size).ToString());
+ EXPECT_EQ(thumb_quad->rect.ToString(), scaled_thumb_rect.ToString());
}
{

Powered by Google App Engine
This is Rietveld 408576698