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

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

Issue 812543002: Update from https://crrev.com/308331 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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') | cc/trees/layer_tree_host_pixeltest_blending.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 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 <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 4163 matching lines...) Expand 10 before | Expand all | Expand 10 after
4174 4174
4175 TileDrawQuad* test_blending_draw_quad = 4175 TileDrawQuad* test_blending_draw_quad =
4176 render_pass->CreateAndAppendDrawQuad<TileDrawQuad>(); 4176 render_pass->CreateAndAppendDrawQuad<TileDrawQuad>();
4177 test_blending_draw_quad->SetNew(shared_quad_state, 4177 test_blending_draw_quad->SetNew(shared_quad_state,
4178 quad_rect_, 4178 quad_rect_,
4179 opaque_rect, 4179 opaque_rect,
4180 visible_quad_rect, 4180 visible_quad_rect,
4181 resource_id_, 4181 resource_id_,
4182 gfx::RectF(0.f, 0.f, 1.f, 1.f), 4182 gfx::RectF(0.f, 0.f, 1.f, 1.f),
4183 gfx::Size(1, 1), 4183 gfx::Size(1, 1),
4184 false,
4184 false); 4185 false);
4185 test_blending_draw_quad->visible_rect = quad_visible_rect_; 4186 test_blending_draw_quad->visible_rect = quad_visible_rect_;
4186 EXPECT_EQ(blend_, test_blending_draw_quad->ShouldDrawWithBlending()); 4187 EXPECT_EQ(blend_, test_blending_draw_quad->ShouldDrawWithBlending());
4187 EXPECT_EQ(has_render_surface_, !!render_surface()); 4188 EXPECT_EQ(has_render_surface_, !!render_surface());
4188 } 4189 }
4189 4190
4190 void SetExpectation(bool blend, bool has_render_surface) { 4191 void SetExpectation(bool blend, bool has_render_surface) {
4191 blend_ = blend; 4192 blend_ = blend;
4192 has_render_surface_ = has_render_surface; 4193 has_render_surface_ = has_render_surface;
4193 quads_appended_ = false; 4194 quads_appended_ = false;
(...skipping 3567 matching lines...) Expand 10 before | Expand all | Expand 10 after
7761 host_impl_->UpdateAnimationState(true); 7762 host_impl_->UpdateAnimationState(true);
7762 7763
7763 EXPECT_VECTOR_EQ(gfx::ScrollOffset(0, 100), 7764 EXPECT_VECTOR_EQ(gfx::ScrollOffset(0, 100),
7764 scrolling_layer->TotalScrollOffset()); 7765 scrolling_layer->TotalScrollOffset());
7765 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); 7766 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer());
7766 } 7767 }
7767 7768
7768 TEST_F(LayerTreeHostImplTest, GetPictureLayerImplPairs) { 7769 TEST_F(LayerTreeHostImplTest, GetPictureLayerImplPairs) {
7769 host_impl_->CreatePendingTree(); 7770 host_impl_->CreatePendingTree();
7770 host_impl_->pending_tree()->SetRootLayer( 7771 host_impl_->pending_tree()->SetRootLayer(
7771 PictureLayerImpl::Create(host_impl_->pending_tree(), 10)); 7772 PictureLayerImpl::Create(host_impl_->pending_tree(), 10, false));
7772 7773
7773 LayerTreeImpl* pending_tree = host_impl_->pending_tree(); 7774 LayerTreeImpl* pending_tree = host_impl_->pending_tree();
7774 LayerImpl* pending_layer = pending_tree->root_layer(); 7775 LayerImpl* pending_layer = pending_tree->root_layer();
7775 7776
7776 std::vector<PictureLayerImpl::Pair> layer_pairs; 7777 std::vector<PictureLayerImpl::Pair> layer_pairs;
7777 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true); 7778 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true);
7778 EXPECT_EQ(1u, layer_pairs.size()); 7779 EXPECT_EQ(1u, layer_pairs.size());
7779 EXPECT_EQ(pending_layer, layer_pairs[0].pending); 7780 EXPECT_EQ(pending_layer, layer_pairs[0].pending);
7780 EXPECT_EQ(nullptr, layer_pairs[0].active); 7781 EXPECT_EQ(nullptr, layer_pairs[0].active);
7781 7782
(...skipping 20 matching lines...) Expand all
7802 layer_pairs.clear(); 7803 layer_pairs.clear();
7803 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true); 7804 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true);
7804 EXPECT_EQ(1u, layer_pairs.size()); 7805 EXPECT_EQ(1u, layer_pairs.size());
7805 EXPECT_EQ(active_layer, layer_pairs[0].active); 7806 EXPECT_EQ(active_layer, layer_pairs[0].active);
7806 EXPECT_EQ(nullptr, layer_pairs[0].pending); 7807 EXPECT_EQ(nullptr, layer_pairs[0].pending);
7807 7808
7808 // Create another layer in the pending tree that's not in the active tree. We 7809 // Create another layer in the pending tree that's not in the active tree. We
7809 // should get two pairs. 7810 // should get two pairs.
7810 host_impl_->CreatePendingTree(); 7811 host_impl_->CreatePendingTree();
7811 host_impl_->pending_tree()->root_layer()->AddChild( 7812 host_impl_->pending_tree()->root_layer()->AddChild(
7812 PictureLayerImpl::Create(host_impl_->pending_tree(), 11)); 7813 PictureLayerImpl::Create(host_impl_->pending_tree(), 11, false));
7813 7814
7814 LayerImpl* new_pending_layer = pending_tree->root_layer()->children()[0]; 7815 LayerImpl* new_pending_layer = pending_tree->root_layer()->children()[0];
7815 7816
7816 layer_pairs.clear(); 7817 layer_pairs.clear();
7817 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true); 7818 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true);
7818 EXPECT_EQ(2u, layer_pairs.size()); 7819 EXPECT_EQ(2u, layer_pairs.size());
7819 7820
7820 // The pair ordering is flaky, so make it consistent. 7821 // The pair ordering is flaky, so make it consistent.
7821 if (layer_pairs[0].active != active_layer) 7822 if (layer_pairs[0].active != active_layer)
7822 std::swap(layer_pairs[0], layer_pairs[1]); 7823 std::swap(layer_pairs[0], layer_pairs[1]);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
7928 // surface. 7929 // surface.
7929 EXPECT_EQ(0, num_lost_surfaces_); 7930 EXPECT_EQ(0, num_lost_surfaces_);
7930 host_impl_->DidLoseOutputSurface(); 7931 host_impl_->DidLoseOutputSurface();
7931 EXPECT_EQ(1, num_lost_surfaces_); 7932 EXPECT_EQ(1, num_lost_surfaces_);
7932 host_impl_->DidLoseOutputSurface(); 7933 host_impl_->DidLoseOutputSurface();
7933 EXPECT_LE(1, num_lost_surfaces_); 7934 EXPECT_LE(1, num_lost_surfaces_);
7934 } 7935 }
7935 7936
7936 } // namespace 7937 } // namespace
7937 } // namespace cc 7938 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_pixeltest_blending.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698