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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 206153002: Avoid unnecessary gloweffect calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added unitest Created 6 years, 9 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/trees/layer_tree_host_impl.cc ('k') | no next file » | 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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/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 3144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 EXPECT_EQ(gfx::Vector2dF(), host_impl_->current_fling_velocity()); 3155 EXPECT_EQ(gfx::Vector2dF(), host_impl_->current_fling_velocity());
3156 3156
3157 // Even though the layer can't scroll the overscroll still happens. 3157 // Even though the layer can't scroll the overscroll still happens.
3158 EXPECT_EQ(InputHandler::ScrollStarted, 3158 EXPECT_EQ(InputHandler::ScrollStarted,
3159 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel)); 3159 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
3160 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); 3160 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
3161 EXPECT_EQ(gfx::Vector2dF(0, 10), host_impl_->accumulated_root_overscroll()); 3161 EXPECT_EQ(gfx::Vector2dF(0, 10), host_impl_->accumulated_root_overscroll());
3162 EXPECT_EQ(gfx::Vector2dF(), host_impl_->current_fling_velocity()); 3162 EXPECT_EQ(gfx::Vector2dF(), host_impl_->current_fling_velocity());
3163 } 3163 }
3164 3164
3165 TEST_F(LayerTreeHostImplTest, GlowEffectOverScroll) {
3166 // When we scroll down and scroll up unnecessary GlowEffect calls are called.
danakj 2014/03/25 15:36:57 "are called" -> "should not be called"
3167 gfx::Size surface_size(100, 100);
3168 gfx::Size content_size(200, 200);
3169 scoped_ptr<LayerImpl> root_clip =
3170 LayerImpl::Create(host_impl_->active_tree(), 3);
3171 scoped_ptr<LayerImpl> root =
3172 CreateScrollableLayer(1, content_size, root_clip.get());
3173 root->SetIsContainerForFixedPositionLayers(true);
3174 scoped_ptr<LayerImpl> child =
3175 CreateScrollableLayer(2, content_size, root_clip.get());
3176
3177 child->SetScrollClipLayer(Layer::INVALID_ID);
3178 root->AddChild(child.Pass());
3179 root_clip->AddChild(root.Pass());
3180
3181 host_impl_->SetViewportSize(surface_size);
3182 host_impl_->active_tree()->SetRootLayer(root_clip.Pass());
3183 host_impl_->active_tree()->SetViewportLayersFromIds(3, 1, Layer::INVALID_ID);
3184 host_impl_->active_tree()->DidBecomeActive();
3185 DrawFrame();
3186 {
3187 EXPECT_EQ(InputHandler::ScrollStarted,
3188 host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::Wheel));
3189 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 100));
3190 EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
danakj 2014/03/25 15:36:57 can you compare EXPECT_EQ(gfx::Vector2dF().ToStrin
3191 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, -2.30));
3192 EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
danakj 2014/03/25 15:36:57 same
3193 host_impl_->ScrollEnd();
3194 }
3195 }
3196
3165 class BlendStateCheckLayer : public LayerImpl { 3197 class BlendStateCheckLayer : public LayerImpl {
3166 public: 3198 public:
3167 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, 3199 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl,
3168 int id, 3200 int id,
3169 ResourceProvider* resource_provider) { 3201 ResourceProvider* resource_provider) {
3170 return scoped_ptr<LayerImpl>(new BlendStateCheckLayer(tree_impl, 3202 return scoped_ptr<LayerImpl>(new BlendStateCheckLayer(tree_impl,
3171 id, 3203 id,
3172 resource_provider)); 3204 resource_provider));
3173 } 3205 }
3174 3206
(...skipping 3038 matching lines...) Expand 10 before | Expand all | Expand 10 after
6213 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes, 6245 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes,
6214 300u * 1024u * 1024u); 6246 300u * 1024u * 1024u);
6215 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes, 6247 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes,
6216 150u * 1024u * 1024u); 6248 150u * 1024u * 1024u);
6217 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes, 6249 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes,
6218 75u * 1024u * 1024u); 6250 75u * 1024u * 1024u);
6219 } 6251 }
6220 6252
6221 } // namespace 6253 } // namespace
6222 } // namespace cc 6254 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698