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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 1944623002: CC Animation: Use ElementId to attach CC animation players. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@erasedomids
Patch Set: Let CC clients generate their own ElementIds locally. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 5f3e847ca826439f28c517a761f18631f0bbc2da..78675418ce73ca53118450a8550306c0baea6b32 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -281,13 +281,13 @@ class LayerTreeHostImplTest : public testing::Test,
const int kInnerViewportClipLayerId = 4;
const int kPageScaleLayerId = 5;
- std::unique_ptr<LayerImpl> root = LayerImpl::Create(layer_tree_impl, 1);
+ std::unique_ptr<LayerImpl> root = CreateTestLayerImpl(layer_tree_impl, 1);
root->SetBounds(content_size);
root->SetPosition(gfx::PointF());
root->test_properties()->force_render_surface = true;
std::unique_ptr<LayerImpl> inner_scroll =
- LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId);
+ CreateTestLayerImpl(layer_tree_impl, kInnerViewportScrollLayerId);
inner_scroll->test_properties()->is_container_for_fixed_position_layers =
true;
inner_scroll->layer_tree_impl()
@@ -296,25 +296,25 @@ class LayerTreeHostImplTest : public testing::Test,
gfx::ScrollOffset());
std::unique_ptr<LayerImpl> inner_clip =
- LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId);
+ CreateTestLayerImpl(layer_tree_impl, kInnerViewportClipLayerId);
inner_clip->SetBounds(
gfx::Size(content_size.width() / 2, content_size.height() / 2));
std::unique_ptr<LayerImpl> page_scale =
- LayerImpl::Create(layer_tree_impl, kPageScaleLayerId);
+ CreateTestLayerImpl(layer_tree_impl, kPageScaleLayerId);
inner_scroll->SetScrollClipLayer(inner_clip->id());
inner_scroll->SetBounds(content_size);
inner_scroll->SetPosition(gfx::PointF());
std::unique_ptr<LayerImpl> outer_clip =
- LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId);
+ CreateTestLayerImpl(layer_tree_impl, kOuterViewportClipLayerId);
outer_clip->SetBounds(content_size);
outer_clip->test_properties()->is_container_for_fixed_position_layers =
true;
std::unique_ptr<LayerImpl> outer_scroll =
- LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId);
+ CreateTestLayerImpl(layer_tree_impl, kOuterViewportScrollLayerId);
outer_scroll->SetScrollClipLayer(outer_clip->id());
outer_scroll->layer_tree_impl()
->property_trees()
@@ -324,7 +324,7 @@ class LayerTreeHostImplTest : public testing::Test,
outer_scroll->SetPosition(gfx::PointF());
std::unique_ptr<LayerImpl> contents =
- LayerImpl::Create(layer_tree_impl, kContentLayerId);
+ CreateTestLayerImpl(layer_tree_impl, kContentLayerId);
contents->SetDrawsContent(true);
contents->SetBounds(content_size);
contents->SetPosition(gfx::PointF());
@@ -389,7 +389,7 @@ class LayerTreeHostImplTest : public testing::Test,
DCHECK(clip_layer);
DCHECK(id != clip_layer->id());
std::unique_ptr<LayerImpl> layer =
- LayerImpl::Create(host_impl_->active_tree(), id);
+ CreateTestLayerImpl(host_impl_->active_tree(), id);
layer->SetScrollClipLayer(clip_layer->id());
layer->SetDrawsContent(true);
layer->SetBounds(size);
@@ -459,6 +459,13 @@ class LayerTreeHostImplTest : public testing::Test,
scoped_refptr<AnimationTimeline> timeline() { return timeline_; }
+ std::unique_ptr<LayerImpl> CreateTestLayerImpl(LayerTreeImpl* tree_impl,
+ int id) {
+ auto layer = LayerImpl::Create(tree_impl, id);
+ layer->SetElementId(NextTestElementId());
+ return layer;
+ }
+
protected:
virtual std::unique_ptr<OutputSurface> CreateOutputSurface() {
return FakeOutputSurface::Create3d();
@@ -590,15 +597,15 @@ TEST_F(LayerTreeHostImplTest, ScrollDeltaNoLayers) {
TEST_F(LayerTreeHostImplTest, ScrollDeltaTreeButNoChanges) {
{
std::unique_ptr<LayerImpl> root =
- LayerImpl::Create(host_impl_->active_tree(), 1);
- root->AddChild(LayerImpl::Create(host_impl_->active_tree(), 2));
- root->AddChild(LayerImpl::Create(host_impl_->active_tree(), 3));
+ CreateTestLayerImpl(host_impl_->active_tree(), 1);
+ root->AddChild(CreateTestLayerImpl(host_impl_->active_tree(), 2));
+ root->AddChild(CreateTestLayerImpl(host_impl_->active_tree(), 3));
root->children()[1]->AddChild(
- LayerImpl::Create(host_impl_->active_tree(), 4));
+ CreateTestLayerImpl(host_impl_->active_tree(), 4));
root->children()[1]->AddChild(
- LayerImpl::Create(host_impl_->active_tree(), 5));
+ CreateTestLayerImpl(host_impl_->active_tree(), 5));
root->children()[1]->children()[0]->AddChild(
- LayerImpl::Create(host_impl_->active_tree(), 6));
+ CreateTestLayerImpl(host_impl_->active_tree(), 6));
host_impl_->active_tree()->SetRootLayer(std::move(root));
}
LayerImpl* root = host_impl_->active_tree()->root_layer();
@@ -621,9 +628,9 @@ TEST_F(LayerTreeHostImplTest, ScrollDeltaRepeatedScrolls) {
gfx::Vector2d scroll_delta(11, -15);
{
std::unique_ptr<LayerImpl> root_clip =
- LayerImpl::Create(host_impl_->active_tree(), 2);
+ CreateTestLayerImpl(host_impl_->active_tree(), 2);
std::unique_ptr<LayerImpl> root =
- LayerImpl::Create(host_impl_->active_tree(), 1);
+ CreateTestLayerImpl(host_impl_->active_tree(), 1);
root_clip->SetBounds(gfx::Size(10, 10));
LayerImpl* root_layer = root.get();
root_clip->AddChild(std::move(root));
@@ -809,7 +816,7 @@ TEST_F(LayerTreeHostImplTest, ScrollBlocksOnTouchEventHandlers) {
LayerImpl* child = 0;
{
std::unique_ptr<LayerImpl> child_layer =
- LayerImpl::Create(host_impl_->active_tree(), 6);
+ CreateTestLayerImpl(host_impl_->active_tree(), 6);
child = child_layer.get();
child_layer->SetDrawsContent(true);
child_layer->SetPosition(gfx::PointF(0, 20));
@@ -943,15 +950,15 @@ TEST_F(LayerTreeHostImplTest, ScrollWithOverlappingNonScrollableLayer) {
gfx::Size scrollbar_size = gfx::Size(15, 600);
host_impl_->SetViewportSize(content_size);
- std::unique_ptr<LayerImpl> root = LayerImpl::Create(layer_tree_impl, 1);
+ std::unique_ptr<LayerImpl> root = CreateTestLayerImpl(layer_tree_impl, 1);
root->SetBounds(content_size);
root->SetPosition(gfx::PointF());
- std::unique_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, 2);
+ std::unique_ptr<LayerImpl> clip = CreateTestLayerImpl(layer_tree_impl, 2);
clip->SetBounds(content_size);
clip->SetPosition(gfx::PointF());
- std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 3);
+ std::unique_ptr<LayerImpl> scroll = CreateTestLayerImpl(layer_tree_impl, 3);
scroll->SetBounds(scroll_content_size);
scroll->SetScrollClipLayer(clip->id());
scroll->SetDrawsContent(true);
@@ -965,12 +972,12 @@ TEST_F(LayerTreeHostImplTest, ScrollWithOverlappingNonScrollableLayer) {
scrollbar->SetDrawsContent(true);
scrollbar->SetOpacity(1.f);
- std::unique_ptr<LayerImpl> squash1 = LayerImpl::Create(layer_tree_impl, 5);
+ std::unique_ptr<LayerImpl> squash1 = CreateTestLayerImpl(layer_tree_impl, 5);
squash1->SetBounds(gfx::Size(140, 300));
squash1->SetPosition(gfx::PointF(220, 0));
squash1->SetDrawsContent(true);
- std::unique_ptr<LayerImpl> squash2 = LayerImpl::Create(layer_tree_impl, 6);
+ std::unique_ptr<LayerImpl> squash2 = CreateTestLayerImpl(layer_tree_impl, 6);
squash2->SetBounds(gfx::Size(140, 300));
squash2->SetPosition(gfx::PointF(220, 300));
squash2->SetDrawsContent(true);
@@ -1303,17 +1310,18 @@ TEST_F(LayerTreeHostImplTest, AnimationSchedulingPendingTree) {
host_impl_->CreatePendingTree();
host_impl_->pending_tree()->SetRootLayer(
- LayerImpl::Create(host_impl_->pending_tree(), 1));
+ CreateTestLayerImpl(host_impl_->pending_tree(), 1));
LayerImpl* root = host_impl_->pending_tree()->root_layer();
root->SetBounds(gfx::Size(50, 50));
root->test_properties()->force_render_surface = true;
- root->AddChild(LayerImpl::Create(host_impl_->pending_tree(), 2));
+ root->AddChild(CreateTestLayerImpl(host_impl_->pending_tree(), 2));
LayerImpl* child = root->children()[0];
child->SetBounds(gfx::Size(10, 10));
child->draw_properties().visible_layer_rect = gfx::Rect(10, 10);
child->SetDrawsContent(true);
- AddAnimatedTransformToLayerWithPlayer(child->id(), timeline(), 10.0, 3, 0);
+ AddAnimatedTransformToElementWithPlayer(child->element_id(), timeline(), 10.0,
+ 3, 0);
EXPECT_FALSE(did_request_next_frame_);
EXPECT_FALSE(did_request_redraw_);
@@ -1353,12 +1361,12 @@ TEST_F(LayerTreeHostImplTest, AnimationSchedulingActiveTree) {
host_impl_->SetViewportSize(gfx::Size(50, 50));
host_impl_->active_tree()->SetRootLayer(
- LayerImpl::Create(host_impl_->active_tree(), 1));
+ CreateTestLayerImpl(host_impl_->active_tree(), 1));
LayerImpl* root = host_impl_->active_tree()->root_layer();
root->SetBounds(gfx::Size(50, 50));
root->test_properties()->force_render_surface = true;
- root->AddChild(LayerImpl::Create(host_impl_->active_tree(), 2));
+ root->AddChild(CreateTestLayerImpl(host_impl_->active_tree(), 2));
LayerImpl* child = root->children()[0];
child->SetBounds(gfx::Size(10, 10));
child->draw_properties().visible_layer_rect = gfx::Rect(10, 10);
@@ -1369,8 +1377,8 @@ TEST_F(LayerTreeHostImplTest, AnimationSchedulingActiveTree) {
start.AppendTranslate(6.f, 7.f, 0.f);
TransformOperations end;
end.AppendTranslate(8.f, 9.f, 0.f);
- AddAnimatedTransformToLayerWithPlayer(child->id(), timeline(), 4.0, start,
- end);
+ AddAnimatedTransformToElementWithPlayer(child->element_id(), timeline(), 4.0,
+ start, end);
base::TimeTicks now = base::TimeTicks::Now();
host_impl_->WillBeginImplFrame(
@@ -1417,17 +1425,18 @@ TEST_F(LayerTreeHostImplTest, AnimationSchedulingCommitToActiveTree) {
host_impl_->SetViewportSize(gfx::Size(50, 50));
host_impl_->active_tree()->SetRootLayer(
- LayerImpl::Create(host_impl_->active_tree(), 1));
+ CreateTestLayerImpl(host_impl_->active_tree(), 1));
LayerImpl* root = host_impl_->active_tree()->root_layer();
root->SetBounds(gfx::Size(50, 50));
root->SetHasRenderSurface(true);
- root->AddChild(LayerImpl::Create(host_impl_->active_tree(), 2));
+ root->AddChild(CreateTestLayerImpl(host_impl_->active_tree(), 2));
LayerImpl* child = root->children()[0];
child->SetBounds(gfx::Size(10, 10));
child->draw_properties().visible_layer_rect = gfx::Rect(10, 10);
child->SetDrawsContent(true);
- AddAnimatedTransformToLayerWithPlayer(child->id(), timeline(), 10.0, 3, 0);
+ AddAnimatedTransformToElementWithPlayer(child->element_id(), timeline(), 10.0,
+ 3, 0);
// Set up the property trees so that UpdateDrawProperties will work in
// CommitComplete below.
@@ -1455,7 +1464,9 @@ TEST_F(LayerTreeHostImplTest, AnimationSchedulingCommitToActiveTree) {
class MissingTilesLayer : public LayerImpl {
public:
MissingTilesLayer(LayerTreeImpl* layer_tree_impl, int id)
- : LayerImpl(layer_tree_impl, id), has_missing_tiles_(true) {}
+ : LayerImpl(layer_tree_impl, id), has_missing_tiles_(true) {
+ SetElementId(NextTestElementId());
+ }
void set_has_missing_tiles(bool has_missing_tiles) {
has_missing_tiles_ = has_missing_tiles;
@@ -1474,7 +1485,7 @@ TEST_F(LayerTreeHostImplTest, AnimationMarksLayerNotReady) {
host_impl_->SetViewportSize(gfx::Size(50, 50));
host_impl_->active_tree()->SetRootLayer(
- LayerImpl::Create(host_impl_->active_tree(), 1));
+ CreateTestLayerImpl(host_impl_->active_tree(), 1));
LayerImpl* root = host_impl_->active_tree()->root_layer();
root->SetBounds(gfx::Size(50, 50));
root->SetHasRenderSurface(true);
@@ -1494,8 +1505,8 @@ TEST_F(LayerTreeHostImplTest, AnimationMarksLayerNotReady) {
start.AppendTranslate(6.f, 7.f, 0.f);
TransformOperations end;
end.AppendTranslate(8.f, 9.f, 0.f);
- int animation_id = AddAnimatedTransformToLayerWithPlayer(
- child->id(), timeline(), 4.0, start, end);
+ int animation_id = AddAnimatedTransformToElementWithPlayer(
+ child->element_id(), timeline(), 4.0, start, end);
base::TimeTicks now = base::TimeTicks::Now();
host_impl_->WillBeginImplFrame(
@@ -1526,8 +1537,8 @@ TEST_F(LayerTreeHostImplTest, AnimationMarksLayerNotReady) {
// Remove the animation.
child->set_has_missing_tiles(true);
- RemoveAnimationFromLayerWithExistingPlayer(child->id(), timeline(),
- animation_id);
+ RemoveAnimationFromElementWithExistingPlayer(child->element_id(), timeline(),
+ animation_id);
child->draw_properties().screen_space_transform_is_animating = false;
// Child layer doesn't have an animation, but was never ready since the last
@@ -1994,7 +2005,7 @@ TEST_F(LayerTreeHostImplTest, ScrollDoesntBubble) {
LayerImpl *child_clip;
std::unique_ptr<LayerImpl> scroll_parent_clip =
- LayerImpl::Create(host_impl_->active_tree(), 6);
+ CreateTestLayerImpl(host_impl_->active_tree(), 6);
std::unique_ptr<LayerImpl> scroll_parent =
CreateScrollableLayer(7, gfx::Size(10, 10), scroll_parent_clip.get());
parent = scroll_parent.get();
@@ -2003,7 +2014,7 @@ TEST_F(LayerTreeHostImplTest, ScrollDoesntBubble) {
viewport_scroll->AddChild(std::move(scroll_parent_clip));
std::unique_ptr<LayerImpl> scroll_child_clip =
- LayerImpl::Create(host_impl_->active_tree(), 8);
+ CreateTestLayerImpl(host_impl_->active_tree(), 8);
std::unique_ptr<LayerImpl> scroll_child =
CreateScrollableLayer(9, gfx::Size(10, 10), scroll_child_clip.get());
child = scroll_child.get();
@@ -2929,10 +2940,10 @@ TEST_F(LayerTreeHostImplTest, ScrollbarInnerLargerThanOuter) {
SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), horiz_id,
HORIZONTAL, 5, 5, true, true);
std::unique_ptr<LayerImpl> child =
- LayerImpl::Create(host_impl_->active_tree(), child_scroll_id);
+ CreateTestLayerImpl(host_impl_->active_tree(), child_scroll_id);
child->SetBounds(content_size);
std::unique_ptr<LayerImpl> child_clip =
- LayerImpl::Create(host_impl_->active_tree(), child_clip_id);
+ CreateTestLayerImpl(host_impl_->active_tree(), child_clip_id);
child->SetBounds(inner_viewport_size);
horiz_scrollbar->SetScrollLayerId(root_scroll->id());
@@ -2975,10 +2986,10 @@ TEST_F(LayerTreeHostImplTest, ScrollbarRegistration) {
SolidColorScrollbarLayerImpl::Create(
host_impl_->active_tree(), horiz_2_id, HORIZONTAL, 5, 5, true, true);
std::unique_ptr<LayerImpl> child =
- LayerImpl::Create(host_impl_->active_tree(), child_scroll_id);
+ CreateTestLayerImpl(host_impl_->active_tree(), child_scroll_id);
child->SetBounds(content_size);
std::unique_ptr<LayerImpl> child_clip =
- LayerImpl::Create(host_impl_->active_tree(), child_clip_id);
+ CreateTestLayerImpl(host_impl_->active_tree(), child_clip_id);
child->SetBounds(viewport_size);
LayerImpl* child_ptr = child.get();
LayerImpl* child_clip_ptr = child_clip.get();
@@ -3310,6 +3321,7 @@ class DidDrawCheckLayer : public LayerImpl {
will_draw_called_(false),
append_quads_called_(false),
did_draw_called_(false) {
+ SetElementId(NextTestElementId());
SetBounds(gfx::Size(10, 10));
SetDrawsContent(true);
draw_properties().visible_layer_rect = gfx::Rect(0, 0, 10, 10);
@@ -3525,7 +3537,8 @@ class MissingTextureAnimatingLayer : public DidDrawCheckLayer {
tile_missing_(tile_missing),
had_incomplete_tile_(had_incomplete_tile) {
if (animating)
- AddAnimatedTransformToLayerWithPlayer(this->id(), timeline, 10.0, 3, 0);
+ AddAnimatedTransformToElementWithPlayer(this->element_id(), timeline,
+ 10.0, 3, 0);
}
bool tile_missing_;
@@ -3782,7 +3795,7 @@ TEST_F(LayerTreeHostImplTest,
TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) {
std::unique_ptr<LayerImpl> root =
- LayerImpl::Create(host_impl_->active_tree(), 1);
+ CreateTestLayerImpl(host_impl_->active_tree(), 1);
root->SetScrollClipLayer(Layer::INVALID_ID);
root->test_properties()->force_render_surface = true;
host_impl_->active_tree()->SetRootLayer(std::move(root));
@@ -3869,12 +3882,12 @@ class LayerTreeHostImplTopControlsTest : public LayerTreeHostImplTest {
tree_impl->PushPageScaleFromMainThread(1.f, 1.f, 1.f);
host_impl_->DidChangeTopControlsPosition();
- std::unique_ptr<LayerImpl> root = LayerImpl::Create(tree_impl, 1);
- std::unique_ptr<LayerImpl> root_clip = LayerImpl::Create(tree_impl, 2);
- std::unique_ptr<LayerImpl> page_scale = LayerImpl::Create(tree_impl, 3);
+ std::unique_ptr<LayerImpl> root = CreateTestLayerImpl(tree_impl, 1);
+ std::unique_ptr<LayerImpl> root_clip = CreateTestLayerImpl(tree_impl, 2);
+ std::unique_ptr<LayerImpl> page_scale = CreateTestLayerImpl(tree_impl, 3);
- std::unique_ptr<LayerImpl> outer_scroll = LayerImpl::Create(tree_impl, 4);
- std::unique_ptr<LayerImpl> outer_clip = LayerImpl::Create(tree_impl, 5);
+ std::unique_ptr<LayerImpl> outer_scroll = CreateTestLayerImpl(tree_impl, 4);
+ std::unique_ptr<LayerImpl> outer_clip = CreateTestLayerImpl(tree_impl, 5);
root_clip->SetBounds(inner_viewport_size);
root->SetScrollClipLayer(root_clip->id());
@@ -3935,7 +3948,7 @@ TEST_F(LayerTreeHostImplTopControlsTest,
// Create a content layer beneath the outer viewport scroll layer.
int id = host_impl_->OuterViewportScrollLayer()->id();
host_impl_->OuterViewportScrollLayer()->AddChild(
- LayerImpl::Create(host_impl_->active_tree(), id + 2));
+ CreateTestLayerImpl(host_impl_->active_tree(), id + 2));
LayerImpl* content = active_tree->OuterViewportScrollLayer()->children()[0];
content->SetBounds(gfx::Size(50, 50));
@@ -4198,9 +4211,9 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollableSublayer) {
int id = outer_viewport_scroll_layer->id();
std::unique_ptr<LayerImpl> child =
- LayerImpl::Create(host_impl_->active_tree(), id + 2);
+ CreateTestLayerImpl(host_impl_->active_tree(), id + 2);
std::unique_ptr<LayerImpl> child_clip =
- LayerImpl::Create(host_impl_->active_tree(), id + 3);
+ CreateTestLayerImpl(host_impl_->active_tree(), id + 3);
child_clip->SetBounds(sub_content_layer_size);
child->SetScrollClipLayer(child_clip->id());
@@ -4676,17 +4689,17 @@ TEST_F(LayerTreeHostImplTest, ScrollNonCompositedRoot) {
gfx::Size contents_size(20, 20);
std::unique_ptr<LayerImpl> content_layer =
- LayerImpl::Create(host_impl_->active_tree(), 1);
+ CreateTestLayerImpl(host_impl_->active_tree(), 1);
content_layer->SetDrawsContent(true);
content_layer->SetPosition(gfx::PointF());
content_layer->SetBounds(contents_size);
std::unique_ptr<LayerImpl> scroll_clip_layer =
- LayerImpl::Create(host_impl_->active_tree(), 3);
+ CreateTestLayerImpl(host_impl_->active_tree(), 3);
scroll_clip_layer->SetBounds(surface_size);
std::unique_ptr<LayerImpl> scroll_layer =
- LayerImpl::Create(host_impl_->active_tree(), 2);
+ CreateTestLayerImpl(host_impl_->active_tree(), 2);
scroll_layer->SetScrollClipLayer(3);
scroll_layer->SetBounds(contents_size);
scroll_layer->SetPosition(gfx::PointF());
@@ -4713,7 +4726,7 @@ TEST_F(LayerTreeHostImplTest, ScrollChildCallsCommitAndRedraw) {
gfx::Size surface_size(10, 10);
gfx::Size contents_size(20, 20);
std::unique_ptr<LayerImpl> root =
- LayerImpl::Create(host_impl_->active_tree(), 1);
+ CreateTestLayerImpl(host_impl_->active_tree(), 1);
root->SetBounds(surface_size);
root->AddChild(CreateScrollableLayer(2, contents_size, root.get()));
root->test_properties()->force_render_surface = true;
@@ -4735,7 +4748,7 @@ TEST_F(LayerTreeHostImplTest, ScrollChildCallsCommitAndRedraw) {
TEST_F(LayerTreeHostImplTest, ScrollMissesChild) {
gfx::Size surface_size(10, 10);
std::unique_ptr<LayerImpl> root =
- LayerImpl::Create(host_impl_->active_tree(), 1);
+ CreateTestLayerImpl(host_impl_->active_tree(), 1);
root->AddChild(CreateScrollableLayer(2, surface_size, root.get()));
root->test_properties()->force_render_surface = true;
host_impl_->active_tree()->SetRootLayer(std::move(root));
@@ -4758,7 +4771,7 @@ TEST_F(LayerTreeHostImplTest, ScrollMissesChild) {
TEST_F(LayerTreeHostImplTest, ScrollMissesBackfacingChild) {
gfx::Size surface_size(10, 10);
std::unique_ptr<LayerImpl> root =
- LayerImpl::Create(host_impl_->active_tree(), 1);
+ CreateTestLayerImpl(host_impl_->active_tree(), 1);
root->test_properties()->force_render_surface = true;
std::unique_ptr<LayerImpl> child =
CreateScrollableLayer(2, surface_size, root.get());
@@ -4789,7 +4802,7 @@ TEST_F(LayerTreeHostImplTest, ScrollMissesBackfacingChild) {
TEST_F(LayerTreeHostImplTest, ScrollBlockedByContentLayer) {
gfx::Size surface_size(10, 10);
std::unique_ptr<LayerImpl> clip_layer =
- LayerImpl::Create(host_impl_->active_tree(), 3);
+ CreateTestLayerImpl(host_impl_->active_tree(), 3);
std::unique_ptr<LayerImpl> content_layer =
CreateScrollableLayer(1, surface_size, clip_layer.get());
content_layer->set_main_thread_scrolling_reasons(
@@ -4935,7 +4948,7 @@ TEST_F(LayerTreeHostImplTest, PageScaleDeltaAppliedToRootScrollLayerOnly) {
child->SetDrawsContent(true);
std::unique_ptr<LayerImpl> scrollable_child_clip =
- LayerImpl::Create(host_impl_->active_tree(), 6);
+ CreateTestLayerImpl(host_impl_->active_tree(), 6);
std::unique_ptr<LayerImpl> scrollable_child =
CreateScrollableLayer(7, surface_size, scrollable_child_clip.get());
scrollable_child_clip->AddChild(std::move(scrollable_child));
@@ -5019,7 +5032,7 @@ TEST_F(LayerTreeHostImplTest, ScrollChildBeyondLimit) {
gfx::Size surface_size(10, 10);
gfx::Size content_size(20, 20);
std::unique_ptr<LayerImpl> root =
- LayerImpl::Create(host_impl_->active_tree(), 1);
+ CreateTestLayerImpl(host_impl_->active_tree(), 1);
root->SetBounds(surface_size);
root->test_properties()->force_render_surface = true;
std::unique_ptr<LayerImpl> grand_child =
@@ -5075,9 +5088,9 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
gfx::Size surface_size(20, 20);
gfx::Size viewport_size(10, 10);
std::unique_ptr<LayerImpl> root_ptr =
- LayerImpl::Create(host_impl_->active_tree(), 1);
+ CreateTestLayerImpl(host_impl_->active_tree(), 1);
std::unique_ptr<LayerImpl> root_clip =
- LayerImpl::Create(host_impl_->active_tree(), 2);
+ CreateTestLayerImpl(host_impl_->active_tree(), 2);
root_clip->test_properties()->force_render_surface = true;
std::unique_ptr<LayerImpl> root_scrolling =
CreateScrollableLayer(3, surface_size, root_clip.get());
@@ -5208,9 +5221,9 @@ TEST_F(LayerTreeHostImplTest, ScrollEventBubbling) {
gfx::Size surface_size(10, 10);
gfx::Size content_size(20, 20);
std::unique_ptr<LayerImpl> root_ptr =
- LayerImpl::Create(host_impl_->active_tree(), 4);
+ CreateTestLayerImpl(host_impl_->active_tree(), 4);
std::unique_ptr<LayerImpl> root_clip =
- LayerImpl::Create(host_impl_->active_tree(), 3);
+ CreateTestLayerImpl(host_impl_->active_tree(), 3);
root_clip->test_properties()->force_render_surface = true;
std::unique_ptr<LayerImpl> root_scroll =
CreateScrollableLayer(1, content_size, root_clip.get());
@@ -5255,9 +5268,9 @@ TEST_F(LayerTreeHostImplTest, ScrollEventBubbling) {
TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) {
gfx::Size surface_size(10, 10);
std::unique_ptr<LayerImpl> root_ptr =
- LayerImpl::Create(host_impl_->active_tree(), 1);
+ CreateTestLayerImpl(host_impl_->active_tree(), 1);
std::unique_ptr<LayerImpl> root_clip =
- LayerImpl::Create(host_impl_->active_tree(), 2);
+ CreateTestLayerImpl(host_impl_->active_tree(), 2);
std::unique_ptr<LayerImpl> root_scroll =
CreateScrollableLayer(3, surface_size, root_clip.get());
root_clip->test_properties()->force_render_surface = true;
@@ -5276,9 +5289,9 @@ TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) {
DrawFrame();
host_impl_->active_tree()->ClearLayers();
std::unique_ptr<LayerImpl> root_ptr2 =
- LayerImpl::Create(host_impl_->active_tree(), 4);
+ CreateTestLayerImpl(host_impl_->active_tree(), 4);
std::unique_ptr<LayerImpl> root_clip2 =
- LayerImpl::Create(host_impl_->active_tree(), 5);
+ CreateTestLayerImpl(host_impl_->active_tree(), 5);
std::unique_ptr<LayerImpl> root_scroll2 =
CreateScrollableLayer(6, surface_size, root_clip2.get());
root_scroll2->test_properties()->is_container_for_fixed_position_layers =
@@ -5354,7 +5367,7 @@ TEST_F(LayerTreeHostImplTest, ScrollNonAxisAlignedRotatedLayer) {
// Create a child layer that is rotated to a non-axis-aligned angle.
std::unique_ptr<LayerImpl> clip_layer =
- LayerImpl::Create(host_impl_->active_tree(), child_clip_layer_id);
+ CreateTestLayerImpl(host_impl_->active_tree(), child_clip_layer_id);
std::unique_ptr<LayerImpl> child = CreateScrollableLayer(
child_layer_id, scroll_layer->bounds(), clip_layer.get());
gfx::Transform rotate_transform;
@@ -5439,7 +5452,7 @@ TEST_F(LayerTreeHostImplTest, ScrollPerspectiveTransformedLayer) {
// Create a child layer that is rotated on its x axis, with perspective.
std::unique_ptr<LayerImpl> clip_layer =
- LayerImpl::Create(host_impl_->active_tree(), child_clip_layer_id);
+ CreateTestLayerImpl(host_impl_->active_tree(), child_clip_layer_id);
std::unique_ptr<LayerImpl> child = CreateScrollableLayer(
child_layer_id, scroll_layer->bounds(), clip_layer.get());
LayerImpl* child_ptr = child.get();
@@ -5910,7 +5923,7 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) {
InputHandlerScrollResult scroll_result;
gfx::Size surface_size(10, 10);
std::unique_ptr<LayerImpl> root_clip =
- LayerImpl::Create(host_impl_->active_tree(), 4);
+ CreateTestLayerImpl(host_impl_->active_tree(), 4);
root_clip->test_properties()->force_render_surface = true;
std::unique_ptr<LayerImpl> root =
@@ -6197,7 +6210,7 @@ class BlendStateCheckLayer : public LayerImpl {
TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
{
std::unique_ptr<LayerImpl> root =
- LayerImpl::Create(host_impl_->active_tree(), 1);
+ CreateTestLayerImpl(host_impl_->active_tree(), 1);
root->SetBounds(gfx::Size(10, 10));
root->SetDrawsContent(false);
root->test_properties()->force_render_surface = true;
@@ -6465,7 +6478,7 @@ class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest {
void SetupActiveTreeLayers() {
host_impl_->active_tree()->set_background_color(SK_ColorGRAY);
host_impl_->active_tree()->SetRootLayer(
- LayerImpl::Create(host_impl_->active_tree(), 1));
+ CreateTestLayerImpl(host_impl_->active_tree(), 1));
host_impl_->active_tree()
->root_layer()
->test_properties()
@@ -6756,7 +6769,9 @@ class FakeDrawableLayerImpl: public LayerImpl {
}
protected:
FakeDrawableLayerImpl(LayerTreeImpl* tree_impl, int id)
- : LayerImpl(tree_impl, id) {}
+ : LayerImpl(tree_impl, id) {
+ SetElementId(NextTestElementId());
+ }
};
// Only reshape when we know we are going to draw. Otherwise, the reshape
@@ -7151,8 +7166,12 @@ static std::unique_ptr<LayerTreeHostImpl> SetupLayersForOpacity(
*/
std::unique_ptr<LayerImpl> root =
LayerImpl::Create(my_host_impl->active_tree(), 1);
+ root->SetElementId(NextTestElementId());
+
std::unique_ptr<LayerImpl> child =
LayerImpl::Create(my_host_impl->active_tree(), 2);
+ child->SetElementId(NextTestElementId());
+
std::unique_ptr<LayerImpl> grand_child =
FakeLayerWithQuads::Create(my_host_impl->active_tree(), 3);
@@ -7255,7 +7274,7 @@ TEST_F(LayerTreeHostImplTest, LayersFreeTextures) {
CreateHostImpl(DefaultSettings(), std::move(output_surface));
std::unique_ptr<LayerImpl> root_layer =
- LayerImpl::Create(host_impl_->active_tree(), 1);
+ CreateTestLayerImpl(host_impl_->active_tree(), 1);
root_layer->SetBounds(gfx::Size(10, 10));
root_layer->test_properties()->force_render_surface = true;
@@ -7266,6 +7285,7 @@ TEST_F(LayerTreeHostImplTest, LayersFreeTextures) {
provider.set_frame(softwareFrame);
std::unique_ptr<VideoLayerImpl> video_layer = VideoLayerImpl::Create(
host_impl_->active_tree(), 4, &provider, media::VIDEO_ROTATION_0);
+ video_layer->SetElementId(NextTestElementId());
video_layer->SetBounds(gfx::Size(10, 10));
video_layer->SetDrawsContent(true);
root_layer->AddChild(std::move(video_layer));
@@ -7284,7 +7304,7 @@ TEST_F(LayerTreeHostImplTest, LayersFreeTextures) {
// Kill the layer tree.
host_impl_->active_tree()->SetRootLayer(
- LayerImpl::Create(host_impl_->active_tree(), 100));
+ CreateTestLayerImpl(host_impl_->active_tree(), 100));
// There should be no textures left in use after.
EXPECT_EQ(0u, context3d->NumTextures());
}
@@ -7308,7 +7328,7 @@ TEST_F(LayerTreeHostImplTest, HasTransparentBackground) {
settings.renderer_settings.partial_swap_enabled = false;
CreateHostImpl(settings,
FakeOutputSurface::Create3d(std::move(mock_context_owned)));
- SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1));
+ SetupRootLayerImpl(CreateTestLayerImpl(host_impl_->active_tree(), 1));
host_impl_->active_tree()->set_background_color(SK_ColorWHITE);
// Verify one quad is drawn when transparent background set is not set.
@@ -7379,6 +7399,7 @@ class LayerTreeHostImplTestWithDelegatingRenderer
TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect) {
std::unique_ptr<SolidColorLayerImpl> root =
SolidColorLayerImpl::Create(host_impl_->active_tree(), 1);
+ root->SetElementId(NextTestElementId());
root->SetPosition(gfx::PointF());
root->SetBounds(gfx::Size(10, 10));
root->SetDrawsContent(true);
@@ -7387,6 +7408,7 @@ TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect) {
// Child layer is in the bottom right corner.
std::unique_ptr<SolidColorLayerImpl> child =
SolidColorLayerImpl::Create(host_impl_->active_tree(), 2);
+ child->SetElementId(NextTestElementId());
child->SetPosition(gfx::PointF(9.f, 9.f));
child->SetBounds(gfx::Size(1, 1));
child->SetDrawsContent(true);
@@ -7437,14 +7459,14 @@ TEST_F(LayerTreeHostImplTest, FarAwayQuadsDontNeedAA) {
16.f);
std::unique_ptr<LayerImpl> scoped_root =
- LayerImpl::Create(host_impl_->pending_tree(), 1);
+ CreateTestLayerImpl(host_impl_->pending_tree(), 1);
LayerImpl* root = scoped_root.get();
root->test_properties()->force_render_surface = true;
host_impl_->pending_tree()->SetRootLayer(std::move(scoped_root));
std::unique_ptr<LayerImpl> scoped_scrolling_layer =
- LayerImpl::Create(host_impl_->pending_tree(), 2);
+ CreateTestLayerImpl(host_impl_->pending_tree(), 2);
LayerImpl* scrolling_layer = scoped_scrolling_layer.get();
root->AddChild(std::move(scoped_scrolling_layer));
@@ -7591,11 +7613,13 @@ TEST_F(LayerTreeHostImplTest,
// SolidColorLayerImpl will be drawn.
std::unique_ptr<SolidColorLayerImpl> root_layer =
SolidColorLayerImpl::Create(host_impl_->active_tree(), 1);
+ root_layer->SetElementId(NextTestElementId());
// VideoLayerImpl will not be drawn.
FakeVideoFrameProvider provider;
std::unique_ptr<VideoLayerImpl> video_layer = VideoLayerImpl::Create(
host_impl_->active_tree(), 2, &provider, media::VIDEO_ROTATION_0);
+ video_layer->SetElementId(NextTestElementId());
video_layer->SetBounds(gfx::Size(10, 10));
video_layer->SetDrawsContent(true);
root_layer->AddChild(std::move(video_layer));
@@ -7777,7 +7801,7 @@ TEST_F(LayerTreeHostImplTest, ShutdownReleasesContext) {
CreateHostImpl(DefaultSettings(),
FakeOutputSurface::Create3d(context_provider));
- SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1));
+ SetupRootLayerImpl(CreateTestLayerImpl(host_impl_->active_tree(), 1));
std::vector<std::unique_ptr<CopyOutputRequest>> requests;
requests.push_back(CopyOutputRequest::CreateRequest(
@@ -7810,9 +7834,9 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldNotBubble) {
gfx::Size surface_size(10, 10);
gfx::Size content_size(20, 20);
std::unique_ptr<LayerImpl> root_ptr =
- LayerImpl::Create(host_impl_->active_tree(), 4);
+ CreateTestLayerImpl(host_impl_->active_tree(), 4);
std::unique_ptr<LayerImpl> root_clip =
- LayerImpl::Create(host_impl_->active_tree(), 3);
+ CreateTestLayerImpl(host_impl_->active_tree(), 3);
root_clip->test_properties()->force_render_surface = true;
std::unique_ptr<LayerImpl> root_scroll =
@@ -7863,7 +7887,7 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldContinueScrollingCurrentLayer) {
// the scroll doesn't bubble up to the parent layer.
gfx::Size surface_size(10, 10);
std::unique_ptr<LayerImpl> root =
- LayerImpl::Create(host_impl_->active_tree(), 1);
+ CreateTestLayerImpl(host_impl_->active_tree(), 1);
root->test_properties()->force_render_surface = true;
std::unique_ptr<LayerImpl> root_scrolling =
CreateScrollableLayer(2, surface_size, root.get());
@@ -7952,7 +7976,7 @@ TEST_F(LayerTreeHostImplTest, WheelFlingShouldntBubble) {
gfx::Size surface_size(10, 10);
gfx::Size content_size(20, 20);
std::unique_ptr<LayerImpl> root_clip =
- LayerImpl::Create(host_impl_->active_tree(), 3);
+ CreateTestLayerImpl(host_impl_->active_tree(), 3);
root_clip->test_properties()->force_render_surface = true;
std::unique_ptr<LayerImpl> root_scroll =
CreateScrollableLayer(1, content_size, root_clip.get());
@@ -8009,7 +8033,7 @@ TEST_F(LayerTreeHostImplTest, ScrollUnknownNotOnAncestorChain) {
int occluder_layer_id = 6;
std::unique_ptr<LayerImpl> occluder_layer =
- LayerImpl::Create(host_impl_->active_tree(), occluder_layer_id);
+ CreateTestLayerImpl(host_impl_->active_tree(), occluder_layer_id);
occluder_layer->SetDrawsContent(true);
occluder_layer->SetBounds(content_size);
occluder_layer->SetPosition(gfx::PointF());
@@ -8041,14 +8065,14 @@ TEST_F(LayerTreeHostImplTest, ScrollUnknownScrollAncestorMismatch) {
int occluder_layer_id = 6;
std::unique_ptr<LayerImpl> occluder_layer =
- LayerImpl::Create(host_impl_->active_tree(), occluder_layer_id);
+ CreateTestLayerImpl(host_impl_->active_tree(), occluder_layer_id);
occluder_layer->SetDrawsContent(true);
occluder_layer->SetBounds(content_size);
occluder_layer->SetPosition(gfx::PointF(-10.f, -10.f));
int child_scroll_clip_layer_id = 7;
- std::unique_ptr<LayerImpl> child_scroll_clip =
- LayerImpl::Create(host_impl_->active_tree(), child_scroll_clip_layer_id);
+ std::unique_ptr<LayerImpl> child_scroll_clip = CreateTestLayerImpl(
+ host_impl_->active_tree(), child_scroll_clip_layer_id);
int child_scroll_layer_id = 8;
std::unique_ptr<LayerImpl> child_scroll = CreateScrollableLayer(
@@ -8116,11 +8140,11 @@ TEST_F(LayerTreeHostImplTest, ScrollInvisibleScrollerWithVisibleDescendent) {
invisible_scroll_layer->SetDrawsContent(false);
std::unique_ptr<LayerImpl> child_layer =
- LayerImpl::Create(host_impl_->active_tree(), 8);
+ CreateTestLayerImpl(host_impl_->active_tree(), 8);
child_layer->SetDrawsContent(false);
std::unique_ptr<LayerImpl> grand_child_layer =
- LayerImpl::Create(host_impl_->active_tree(), 9);
+ CreateTestLayerImpl(host_impl_->active_tree(), 9);
grand_child_layer->SetDrawsContent(true);
grand_child_layer->SetBounds(content_size);
// Move the grand child so it's not hit by our test point.
@@ -8159,7 +8183,7 @@ TEST_F(LayerTreeHostImplTest, ScrollInvisibleScrollerWithVisibleScrollChild) {
int scroll_child_id = 6;
std::unique_ptr<LayerImpl> scroll_child =
- LayerImpl::Create(host_impl_->active_tree(), scroll_child_id);
+ CreateTestLayerImpl(host_impl_->active_tree(), scroll_child_id);
scroll_child->SetDrawsContent(true);
scroll_child->SetBounds(content_size);
// Move the scroll child so it's not hit by our test point.
@@ -8172,7 +8196,7 @@ TEST_F(LayerTreeHostImplTest, ScrollInvisibleScrollerWithVisibleScrollChild) {
int container_id = 8;
std::unique_ptr<LayerImpl> container =
- LayerImpl::Create(host_impl_->active_tree(), container_id);
+ CreateTestLayerImpl(host_impl_->active_tree(), container_id);
std::unique_ptr<std::set<LayerImpl*>> scroll_children(
new std::set<LayerImpl*>);
@@ -8206,6 +8230,7 @@ TEST_F(LayerTreeHostImplTest, ScrollInvisibleScrollerWithVisibleScrollChild) {
TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) {
std::unique_ptr<SolidColorLayerImpl> root =
SolidColorLayerImpl::Create(host_impl_->active_tree(), 1);
+ root->SetElementId(NextTestElementId());
root->SetPosition(gfx::PointF());
root->SetBounds(gfx::Size(10, 10));
root->SetDrawsContent(true);
@@ -8246,6 +8271,7 @@ TEST_F(LayerTreeHostImplTest, SelectionBoundsPassedToCompositorFrameMetadata) {
int root_layer_id = 1;
std::unique_ptr<SolidColorLayerImpl> root =
SolidColorLayerImpl::Create(host_impl_->active_tree(), root_layer_id);
+ root->SetElementId(NextTestElementId());
root->SetPosition(gfx::PointF());
root->SetBounds(gfx::Size(10, 10));
root->SetDrawsContent(true);
@@ -8901,7 +8927,7 @@ class LayerTreeHostImplVirtualViewportTest : public LayerTreeHostImplTest {
const int kPageScaleLayerId = 5;
std::unique_ptr<LayerImpl> inner_scroll =
- LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId);
+ CreateTestLayerImpl(layer_tree_impl, kInnerViewportScrollLayerId);
inner_scroll->test_properties()->is_container_for_fixed_position_layers =
true;
inner_scroll->layer_tree_impl()
@@ -8910,24 +8936,24 @@ class LayerTreeHostImplVirtualViewportTest : public LayerTreeHostImplTest {
gfx::ScrollOffset());
std::unique_ptr<LayerImpl> inner_clip =
- LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId);
+ CreateTestLayerImpl(layer_tree_impl, kInnerViewportClipLayerId);
inner_clip->SetBounds(inner_viewport);
std::unique_ptr<LayerImpl> page_scale =
- LayerImpl::Create(layer_tree_impl, kPageScaleLayerId);
+ CreateTestLayerImpl(layer_tree_impl, kPageScaleLayerId);
inner_scroll->SetScrollClipLayer(inner_clip->id());
inner_scroll->SetBounds(outer_viewport);
inner_scroll->SetPosition(gfx::PointF());
std::unique_ptr<LayerImpl> outer_clip =
- LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId);
+ CreateTestLayerImpl(layer_tree_impl, kOuterViewportClipLayerId);
outer_clip->SetBounds(outer_viewport);
outer_clip->test_properties()->is_container_for_fixed_position_layers =
true;
std::unique_ptr<LayerImpl> outer_scroll =
- LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId);
+ CreateTestLayerImpl(layer_tree_impl, kOuterViewportScrollLayerId);
outer_scroll->SetScrollClipLayer(outer_clip->id());
outer_scroll->layer_tree_impl()
->property_trees()
@@ -8936,7 +8962,8 @@ class LayerTreeHostImplVirtualViewportTest : public LayerTreeHostImplTest {
outer_scroll->SetBounds(content_size);
outer_scroll->SetPosition(gfx::PointF());
- std::unique_ptr<LayerImpl> contents = LayerImpl::Create(layer_tree_impl, 8);
+ std::unique_ptr<LayerImpl> contents =
+ CreateTestLayerImpl(layer_tree_impl, 8);
contents->SetDrawsContent(true);
contents->SetBounds(content_size);
contents->SetPosition(gfx::PointF());
@@ -9296,7 +9323,7 @@ TEST_F(LayerTreeHostImplTest, ExternalTransformReflectedInNextDraw) {
}
TEST_F(LayerTreeHostImplTest, ExternalTransformSetNeedsRedraw) {
- SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1));
+ SetupRootLayerImpl(CreateTestLayerImpl(host_impl_->active_tree(), 1));
const gfx::Size viewport_size(100, 100);
host_impl_->SetViewportSize(viewport_size);
@@ -9327,7 +9354,7 @@ TEST_F(LayerTreeHostImplTest, ExternalTransformSetNeedsRedraw) {
}
TEST_F(LayerTreeHostImplTest, OnDrawConstraintSetNeedsRedraw) {
- SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1));
+ SetupRootLayerImpl(CreateTestLayerImpl(host_impl_->active_tree(), 1));
const gfx::Size viewport_size(100, 100);
host_impl_->SetViewportSize(viewport_size);
@@ -9368,7 +9395,7 @@ class ResourcelessSoftwareLayerTreeHostImplTest : public LayerTreeHostImplTest {
TEST_F(ResourcelessSoftwareLayerTreeHostImplTest,
ResourcelessSoftwareSetNeedsRedraw) {
- SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1));
+ SetupRootLayerImpl(CreateTestLayerImpl(host_impl_->active_tree(), 1));
const gfx::Size viewport_size(100, 100);
host_impl_->SetViewportSize(viewport_size);
@@ -9445,7 +9472,7 @@ TEST_F(LayerTreeHostImplTest, ExternalTileConstraintReflectedInPendingTree) {
// Set up active and pending tree.
host_impl_->CreatePendingTree();
host_impl_->pending_tree()->SetRootLayer(
- LayerImpl::Create(host_impl_->pending_tree(), 1));
+ CreateTestLayerImpl(host_impl_->pending_tree(), 1));
host_impl_->pending_tree()->BuildPropertyTreesForTesting();
host_impl_->pending_tree()->UpdateDrawProperties(update_lcd_text);
@@ -9548,7 +9575,7 @@ TEST_F(LayerTreeHostImplTest, ExternalTransformAffectsSublayerScaleFactor) {
SetupScrollAndContentsLayers(layer_size);
LayerImpl* content_layer =
host_impl_->active_tree()->OuterViewportScrollLayer()->children()[0];
- content_layer->AddChild(LayerImpl::Create(host_impl_->active_tree(), 100));
+ content_layer->AddChild(CreateTestLayerImpl(host_impl_->active_tree(), 100));
LayerImpl* test_layer = host_impl_->active_tree()->LayerById(100);
test_layer->test_properties()->force_render_surface = true;
test_layer->SetDrawsContent(true);
@@ -9691,7 +9718,7 @@ TEST_F(LayerTreeHostImplTimelinesTest, ScrollAnimatedAborted) {
host_impl_->UpdateAnimationState(true);
EXPECT_TRUE(host_impl_->animation_host()->HasAnyAnimationTargetingProperty(
- scrolling_layer->id(), TargetProperty::SCROLL_OFFSET));
+ scrolling_layer->element_id(), TargetProperty::SCROLL_OFFSET));
EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset());
host_impl_->DidFinishImplFrame();
@@ -9762,7 +9789,7 @@ TEST_F(LayerTreeHostImplTimelinesTest,
host_impl_->UpdateAnimationState(true);
EXPECT_TRUE(host_impl_->animation_host()->HasAnyAnimationTargetingProperty(
- scrolling_layer->id(), TargetProperty::SCROLL_OFFSET));
+ scrolling_layer->element_id(), TargetProperty::SCROLL_OFFSET));
EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset());
host_impl_->DidFinishImplFrame();
@@ -10637,7 +10664,8 @@ TEST_F(LayerTreeHostImplTest, SubLayerScaleForNodeInSubtreeOfPageScaleLayer) {
host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 3.f);
CreateScrollAndContentsLayers(host_impl_->active_tree(), gfx::Size(100, 100));
LayerImpl* page_scale_layer = host_impl_->active_tree()->PageScaleLayer();
- page_scale_layer->AddChild(LayerImpl::Create(host_impl_->active_tree(), 100));
+ page_scale_layer->AddChild(
+ CreateTestLayerImpl(host_impl_->active_tree(), 100));
LayerImpl* in_subtree_of_page_scale_layer =
host_impl_->active_tree()->LayerById(100);

Powered by Google App Engine
This is Rietveld 408576698