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

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: changes made for complier warnings 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, UnnecessaryGlowEffectCallsWhileScrollingUp) {
3166 // Edge glow effect should be applicable only upon reaching Edges
3167 // of the content. unnecessary glow effect calls shouldn't be
3168 // called while scrolling up without reaching the edge of the content.
3169 gfx::Size surface_size(100, 100);
3170 gfx::Size content_size(200, 200);
3171 scoped_ptr<LayerImpl> root_clip =
3172 LayerImpl::Create(host_impl_->active_tree(), 3);
3173 scoped_ptr<LayerImpl> root =
3174 CreateScrollableLayer(1, content_size, root_clip.get());
3175 root->SetIsContainerForFixedPositionLayers(true);
3176 scoped_ptr<LayerImpl> child =
3177 CreateScrollableLayer(2, content_size, root_clip.get());
3178
3179 child->SetScrollClipLayer(Layer::INVALID_ID);
3180 root->AddChild(child.Pass());
3181 root_clip->AddChild(root.Pass());
3182
3183 host_impl_->SetViewportSize(surface_size);
3184 host_impl_->active_tree()->SetRootLayer(root_clip.Pass());
3185 host_impl_->active_tree()->SetViewportLayersFromIds(3, 1, Layer::INVALID_ID);
3186 host_impl_->active_tree()->DidBecomeActive();
3187 DrawFrame();
3188 {
3189 EXPECT_EQ(InputHandler::ScrollStarted,
3190 host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::Wheel));
3191 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 100));
3192 EXPECT_EQ(gfx::Vector2dF().ToString(),
3193 host_impl_->accumulated_root_overscroll().ToString());
3194 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, -2.30f));
3195 EXPECT_EQ(gfx::Vector2dF().ToString(),
3196 host_impl_->accumulated_root_overscroll().ToString());
3197 host_impl_->ScrollEnd();
3198 }
3199 }
3200
3165 class BlendStateCheckLayer : public LayerImpl { 3201 class BlendStateCheckLayer : public LayerImpl {
3166 public: 3202 public:
3167 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, 3203 static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl,
3168 int id, 3204 int id,
3169 ResourceProvider* resource_provider) { 3205 ResourceProvider* resource_provider) {
3170 return scoped_ptr<LayerImpl>(new BlendStateCheckLayer(tree_impl, 3206 return scoped_ptr<LayerImpl>(new BlendStateCheckLayer(tree_impl,
3171 id, 3207 id,
3172 resource_provider)); 3208 resource_provider));
3173 } 3209 }
3174 3210
(...skipping 3030 matching lines...) Expand 10 before | Expand all | Expand 10 after
6205 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes, 6241 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes,
6206 300u * 1024u * 1024u); 6242 300u * 1024u * 1024u);
6207 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes, 6243 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes,
6208 150u * 1024u * 1024u); 6244 150u * 1024u * 1024u);
6209 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes, 6245 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes,
6210 75u * 1024u * 1024u); 6246 75u * 1024u * 1024u);
6211 } 6247 }
6212 6248
6213 } // namespace 6249 } // namespace
6214 } // namespace cc 6250 } // 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