OLD | NEW |
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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 EXPECT_FALSE(host_impl_->CanDraw()); | 320 EXPECT_FALSE(host_impl_->CanDraw()); |
321 on_can_draw_state_changed_called_ = false; | 321 on_can_draw_state_changed_called_ = false; |
322 | 322 |
323 // Set up the root layer, which allows us to draw. | 323 // Set up the root layer, which allows us to draw. |
324 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 324 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
325 EXPECT_TRUE(host_impl_->CanDraw()); | 325 EXPECT_TRUE(host_impl_->CanDraw()); |
326 EXPECT_TRUE(on_can_draw_state_changed_called_); | 326 EXPECT_TRUE(on_can_draw_state_changed_called_); |
327 on_can_draw_state_changed_called_ = false; | 327 on_can_draw_state_changed_called_ = false; |
328 | 328 |
329 // Toggle the root layer to make sure it toggles can_draw | 329 // Toggle the root layer to make sure it toggles can_draw |
330 host_impl_->active_tree()->SetRootLayer(scoped_ptr<LayerImpl>()); | 330 host_impl_->active_tree()->SetRootLayer(nullptr); |
331 EXPECT_FALSE(host_impl_->CanDraw()); | 331 EXPECT_FALSE(host_impl_->CanDraw()); |
332 EXPECT_TRUE(on_can_draw_state_changed_called_); | 332 EXPECT_TRUE(on_can_draw_state_changed_called_); |
333 on_can_draw_state_changed_called_ = false; | 333 on_can_draw_state_changed_called_ = false; |
334 | 334 |
335 SetupScrollAndContentsLayers(gfx::Size(100, 100)); | 335 SetupScrollAndContentsLayers(gfx::Size(100, 100)); |
336 EXPECT_TRUE(host_impl_->CanDraw()); | 336 EXPECT_TRUE(host_impl_->CanDraw()); |
337 EXPECT_TRUE(on_can_draw_state_changed_called_); | 337 EXPECT_TRUE(on_can_draw_state_changed_called_); |
338 on_can_draw_state_changed_called_ = false; | 338 on_can_draw_state_changed_called_ = false; |
339 | 339 |
340 // Toggle the device viewport size to make sure it toggles can_draw. | 340 // Toggle the device viewport size to make sure it toggles can_draw. |
(...skipping 6401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6742 | 6742 |
6743 int invisible_scroll_layer_id = 7; | 6743 int invisible_scroll_layer_id = 7; |
6744 scoped_ptr<LayerImpl> invisible_scroll = | 6744 scoped_ptr<LayerImpl> invisible_scroll = |
6745 CreateScrollableLayer(invisible_scroll_layer_id, content_size, root); | 6745 CreateScrollableLayer(invisible_scroll_layer_id, content_size, root); |
6746 invisible_scroll->SetDrawsContent(false); | 6746 invisible_scroll->SetDrawsContent(false); |
6747 | 6747 |
6748 int container_id = 8; | 6748 int container_id = 8; |
6749 scoped_ptr<LayerImpl> container = | 6749 scoped_ptr<LayerImpl> container = |
6750 LayerImpl::Create(host_impl_->active_tree(), container_id); | 6750 LayerImpl::Create(host_impl_->active_tree(), container_id); |
6751 | 6751 |
6752 scoped_ptr<std::set<LayerImpl*> > scroll_children(new std::set<LayerImpl*>()); | 6752 scoped_ptr<std::set<LayerImpl*>> scroll_children(new std::set<LayerImpl*>); |
6753 scroll_children->insert(scroll_child.get()); | 6753 scroll_children->insert(scroll_child.get()); |
6754 invisible_scroll->SetScrollChildren(scroll_children.release()); | 6754 invisible_scroll->SetScrollChildren(scroll_children.release()); |
6755 | 6755 |
6756 scroll_child->SetScrollParent(invisible_scroll.get()); | 6756 scroll_child->SetScrollParent(invisible_scroll.get()); |
6757 | 6757 |
6758 container->AddChild(invisible_scroll.Pass()); | 6758 container->AddChild(invisible_scroll.Pass()); |
6759 container->AddChild(scroll_child.Pass()); | 6759 container->AddChild(scroll_child.Pass()); |
6760 | 6760 |
6761 scroll_layer->AddChild(container.Pass()); | 6761 scroll_layer->AddChild(container.Pass()); |
6762 | 6762 |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7516 // surface. | 7516 // surface. |
7517 EXPECT_EQ(0, num_lost_surfaces_); | 7517 EXPECT_EQ(0, num_lost_surfaces_); |
7518 host_impl_->DidLoseOutputSurface(); | 7518 host_impl_->DidLoseOutputSurface(); |
7519 EXPECT_EQ(1, num_lost_surfaces_); | 7519 EXPECT_EQ(1, num_lost_surfaces_); |
7520 host_impl_->DidLoseOutputSurface(); | 7520 host_impl_->DidLoseOutputSurface(); |
7521 EXPECT_LE(1, num_lost_surfaces_); | 7521 EXPECT_LE(1, num_lost_surfaces_); |
7522 } | 7522 } |
7523 | 7523 |
7524 } // namespace | 7524 } // namespace |
7525 } // namespace cc | 7525 } // namespace cc |
OLD | NEW |