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

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

Issue 21839004: cc: Push valid property values when CalcDrawProps skips layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pushpaintprops: Call SavePaintProps when needed in tests Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/scrollbar_layer.cc ('k') | cc/layers/texture_layer.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 "cc/layers/scrollbar_layer.h" 5 #include "cc/layers/scrollbar_layer.h"
6 6
7 #include "cc/animation/scrollbar_animation_controller.h" 7 #include "cc/animation/scrollbar_animation_controller.h"
8 #include "cc/layers/append_quads_data.h" 8 #include "cc/layers/append_quads_data.h"
9 #include "cc/layers/scrollbar_layer_impl.h" 9 #include "cc/layers/scrollbar_layer_impl.h"
10 #include "cc/quads/solid_color_draw_quad.h" 10 #include "cc/quads/solid_color_draw_quad.h"
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 scrollbar_layer->CreateRenderSurface(); 444 scrollbar_layer->CreateRenderSurface();
445 scrollbar_layer->draw_properties().render_target = scrollbar_layer.get(); 445 scrollbar_layer->draw_properties().render_target = scrollbar_layer.get();
446 446
447 testing::Mock::VerifyAndClearExpectations(layer_tree_host_.get()); 447 testing::Mock::VerifyAndClearExpectations(layer_tree_host_.get());
448 EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get()); 448 EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get());
449 449
450 PriorityCalculator calculator; 450 PriorityCalculator calculator;
451 ResourceUpdateQueue queue; 451 ResourceUpdateQueue queue;
452 OcclusionTracker occlusion_tracker(gfx::Rect(), false); 452 OcclusionTracker occlusion_tracker(gfx::Rect(), false);
453 453
454 scrollbar_layer->SavePaintProperties();
454 scrollbar_layer->SetTexturePriorities(calculator); 455 scrollbar_layer->SetTexturePriorities(calculator);
455 layer_tree_host_->contents_texture_manager()->PrioritizeTextures(); 456 layer_tree_host_->contents_texture_manager()->PrioritizeTextures();
456 scrollbar_layer->Update(&queue, &occlusion_tracker); 457 scrollbar_layer->Update(&queue, &occlusion_tracker);
457 EXPECT_EQ(0u, queue.FullUploadSize()); 458 EXPECT_EQ(0u, queue.FullUploadSize());
458 EXPECT_EQ(expected_resources, queue.PartialUploadSize()); 459 EXPECT_EQ(expected_resources, queue.PartialUploadSize());
459 460
460 testing::Mock::VerifyAndClearExpectations(layer_tree_host_.get()); 461 testing::Mock::VerifyAndClearExpectations(layer_tree_host_.get());
461 462
462 scrollbar_layer->ClearRenderSurface(); 463 scrollbar_layer->ClearRenderSurface();
463 } 464 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 scrollbar_layer->CreateRenderSurface(); 526 scrollbar_layer->CreateRenderSurface();
526 scrollbar_layer->draw_properties().render_target = scrollbar_layer.get(); 527 scrollbar_layer->draw_properties().render_target = scrollbar_layer.get();
527 528
528 testing::Mock::VerifyAndClearExpectations(layer_tree_host_.get()); 529 testing::Mock::VerifyAndClearExpectations(layer_tree_host_.get());
529 EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get()); 530 EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get());
530 531
531 PriorityCalculator calculator; 532 PriorityCalculator calculator;
532 ResourceUpdateQueue queue; 533 ResourceUpdateQueue queue;
533 OcclusionTracker occlusion_tracker(gfx::Rect(), false); 534 OcclusionTracker occlusion_tracker(gfx::Rect(), false);
534 535
536 scrollbar_layer->SavePaintProperties();
535 scrollbar_layer->SetTexturePriorities(calculator); 537 scrollbar_layer->SetTexturePriorities(calculator);
536 layer_tree_host_->contents_texture_manager()->PrioritizeTextures(); 538 layer_tree_host_->contents_texture_manager()->PrioritizeTextures();
537 scrollbar_layer->Update(&queue, &occlusion_tracker); 539 scrollbar_layer->Update(&queue, &occlusion_tracker);
538 EXPECT_EQ(expected_resources, queue.PartialUploadSize()); 540 EXPECT_EQ(expected_resources, queue.PartialUploadSize());
539 541
540 // Verify that we have not generated any content uploads that are larger 542 // Verify that we have not generated any content uploads that are larger
541 // than their destination textures. 543 // than their destination textures.
542 while (queue.HasMoreUpdates()) { 544 while (queue.HasMoreUpdates()) {
543 ResourceUpdate update = queue.TakeFirstPartialUpload(); 545 ResourceUpdate update = queue.TakeFirstPartialUpload();
544 EXPECT_LE(update.texture->size().width(), 546 EXPECT_LE(update.texture->size().width(),
(...skipping 20 matching lines...) Expand all
565 567
566 TEST_F(ScaledScrollbarLayerTestResourceCreation, ScaledResourceUpload) { 568 TEST_F(ScaledScrollbarLayerTestResourceCreation, ScaledResourceUpload) {
567 layer_tree_settings_.solid_color_scrollbars = false; 569 layer_tree_settings_.solid_color_scrollbars = false;
568 // Pick a test scale that moves the scrollbar's (non-zero) position to 570 // Pick a test scale that moves the scrollbar's (non-zero) position to
569 // a non-pixel-aligned location. 571 // a non-pixel-aligned location.
570 TestResourceUpload(2, 1.41f); 572 TestResourceUpload(2, 1.41f);
571 } 573 }
572 574
573 } // namespace 575 } // namespace
574 } // namespace cc 576 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/scrollbar_layer.cc ('k') | cc/layers/texture_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698