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

Side by Side Diff: cc/layers/scrollbar_layer_unittest.cc

Issue 306683002: MockQC stops create its own RP and MockOcclusionTracker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@testocclusiontracking
Patch Set: rebase Created 6 years, 6 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/layers/render_surface_unittest.cc ('k') | cc/layers/solid_color_layer_impl_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "base/containers/hash_tables.h" 5 #include "base/containers/hash_tables.h"
6 #include "cc/animation/scrollbar_animation_controller.h" 6 #include "cc/animation/scrollbar_animation_controller.h"
7 #include "cc/layers/append_quads_data.h" 7 #include "cc/layers/append_quads_data.h"
8 #include "cc/layers/painted_scrollbar_layer.h" 8 #include "cc/layers/painted_scrollbar_layer.h"
9 #include "cc/layers/painted_scrollbar_layer_impl.h" 9 #include "cc/layers/painted_scrollbar_layer_impl.h"
10 #include "cc/layers/scrollbar_layer_interface.h" 10 #include "cc/layers/scrollbar_layer_interface.h"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 ScrollbarLayerImplBase* scrollbar_layer_impl = 287 ScrollbarLayerImplBase* scrollbar_layer_impl =
288 static_cast<SolidColorScrollbarLayerImpl*>( 288 static_cast<SolidColorScrollbarLayerImpl*>(
289 layer_impl_tree_root->children()[1]); 289 layer_impl_tree_root->children()[1]);
290 scrollbar_layer_impl->SetBounds(gfx::Size(kTrackLength, kThumbThickness)); 290 scrollbar_layer_impl->SetBounds(gfx::Size(kTrackLength, kThumbThickness));
291 scrollbar_layer_impl->SetCurrentPos(10.f); 291 scrollbar_layer_impl->SetCurrentPos(10.f);
292 scrollbar_layer_impl->SetMaximum(100); 292 scrollbar_layer_impl->SetMaximum(100);
293 scrollbar_layer_impl->SetVisibleToTotalLengthRatio(0.4f); 293 scrollbar_layer_impl->SetVisibleToTotalLengthRatio(0.4f);
294 294
295 // Thickness should be overridden to 3. 295 // Thickness should be overridden to 3.
296 { 296 {
297 MockQuadCuller quad_culler; 297 MockOcclusionTracker<LayerImpl> occlusion_tracker;
298 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
299 MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker);
298 AppendQuadsData data; 300 AppendQuadsData data;
299 scrollbar_layer_impl->AppendQuads(&quad_culler, &data); 301 scrollbar_layer_impl->AppendQuads(&quad_culler, &data);
300 302
301 const QuadList& quads = quad_culler.quad_list(); 303 const QuadList& quads = quad_culler.quad_list();
302 ASSERT_EQ(1u, quads.size()); 304 ASSERT_EQ(1u, quads.size());
303 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material); 305 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material);
304 EXPECT_RECT_EQ(gfx::Rect(6, 0, 40, 3), quads[0]->rect); 306 EXPECT_RECT_EQ(gfx::Rect(6, 0, 40, 3), quads[0]->rect);
305 } 307 }
306 308
307 // Contents scale should scale the draw quad. 309 // Contents scale should scale the draw quad.
308 scrollbar_layer_impl->draw_properties().contents_scale_x = 2.f; 310 scrollbar_layer_impl->draw_properties().contents_scale_x = 2.f;
309 scrollbar_layer_impl->draw_properties().contents_scale_y = 2.f; 311 scrollbar_layer_impl->draw_properties().contents_scale_y = 2.f;
310 { 312 {
311 MockQuadCuller quad_culler; 313 MockOcclusionTracker<LayerImpl> occlusion_tracker;
314 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
315 MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker);
312 AppendQuadsData data; 316 AppendQuadsData data;
313 scrollbar_layer_impl->AppendQuads(&quad_culler, &data); 317 scrollbar_layer_impl->AppendQuads(&quad_culler, &data);
314 318
315 const QuadList& quads = quad_culler.quad_list(); 319 const QuadList& quads = quad_culler.quad_list();
316 ASSERT_EQ(1u, quads.size()); 320 ASSERT_EQ(1u, quads.size());
317 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material); 321 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material);
318 EXPECT_RECT_EQ(gfx::Rect(12, 0, 80, 6), quads[0]->rect); 322 EXPECT_RECT_EQ(gfx::Rect(12, 0, 80, 6), quads[0]->rect);
319 } 323 }
320 scrollbar_layer_impl->draw_properties().contents_scale_x = 1.f; 324 scrollbar_layer_impl->draw_properties().contents_scale_x = 1.f;
321 scrollbar_layer_impl->draw_properties().contents_scale_y = 1.f; 325 scrollbar_layer_impl->draw_properties().contents_scale_y = 1.f;
322 326
323 // For solid color scrollbars, position and size should reflect the 327 // For solid color scrollbars, position and size should reflect the
324 // current viewport state. 328 // current viewport state.
325 scrollbar_layer_impl->SetVisibleToTotalLengthRatio(0.2f); 329 scrollbar_layer_impl->SetVisibleToTotalLengthRatio(0.2f);
326 { 330 {
327 MockQuadCuller quad_culler; 331 MockOcclusionTracker<LayerImpl> occlusion_tracker;
332 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
333 MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker);
328 AppendQuadsData data; 334 AppendQuadsData data;
329 scrollbar_layer_impl->AppendQuads(&quad_culler, &data); 335 scrollbar_layer_impl->AppendQuads(&quad_culler, &data);
330 336
331 const QuadList& quads = quad_culler.quad_list(); 337 const QuadList& quads = quad_culler.quad_list();
332 ASSERT_EQ(1u, quads.size()); 338 ASSERT_EQ(1u, quads.size());
333 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material); 339 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material);
334 EXPECT_RECT_EQ(gfx::Rect(8, 0, 20, 3), quads[0]->rect); 340 EXPECT_RECT_EQ(gfx::Rect(8, 0, 20, 3), quads[0]->rect);
335 } 341 }
336 } 342 }
337 343
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 // Choose layer bounds to give max_scroll_offset = (8, 8). 380 // Choose layer bounds to give max_scroll_offset = (8, 8).
375 layer_impl_tree_root->SetBounds(gfx::Size(2, 2)); 381 layer_impl_tree_root->SetBounds(gfx::Size(2, 2));
376 scroll_layer_impl->SetBounds(gfx::Size(10, 10)); 382 scroll_layer_impl->SetBounds(gfx::Size(10, 10));
377 scroll_layer_impl->ScrollBy(gfx::Vector2dF(4.f, 0.f)); 383 scroll_layer_impl->ScrollBy(gfx::Vector2dF(4.f, 0.f));
378 384
379 scrollbar_layer_impl->SetBounds(gfx::Size(kTrackLength, kThumbThickness)); 385 scrollbar_layer_impl->SetBounds(gfx::Size(kTrackLength, kThumbThickness));
380 scrollbar_layer_impl->SetCurrentPos(4.f); 386 scrollbar_layer_impl->SetCurrentPos(4.f);
381 scrollbar_layer_impl->SetMaximum(8); 387 scrollbar_layer_impl->SetMaximum(8);
382 388
383 { 389 {
384 MockQuadCuller quad_culler; 390 MockOcclusionTracker<LayerImpl> occlusion_tracker;
391 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
392 MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker);
393
385 AppendQuadsData data; 394 AppendQuadsData data;
386 scrollbar_layer_impl->AppendQuads(&quad_culler, &data); 395 scrollbar_layer_impl->AppendQuads(&quad_culler, &data);
387 396
388 const QuadList& quads = quad_culler.quad_list(); 397 const QuadList& quads = quad_culler.quad_list();
389 ASSERT_EQ(1u, quads.size()); 398 ASSERT_EQ(1u, quads.size());
390 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material); 399 EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material);
391 EXPECT_RECT_EQ(gfx::Rect(3, 0, 3, 3), quads[0]->rect); 400 EXPECT_RECT_EQ(gfx::Rect(3, 0, 3, 3), quads[0]->rect);
392 } 401 }
393 } 402 }
394 403
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); 893 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f);
885 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); 894 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f);
886 895
887 // Horizontal Scrollbars. 896 // Horizontal Scrollbars.
888 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); 897 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f);
889 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); 898 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f);
890 } 899 }
891 900
892 } // namespace 901 } // namespace
893 } // namespace cc 902 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/render_surface_unittest.cc ('k') | cc/layers/solid_color_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698