Chromium Code Reviews| Index: ui/views/view_unittest.cc |
| diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc |
| index 42ba4f3319b73c539f34d668a01a900a3f1d522c..79e92185458a59ce8ebc70398e1808d605c676ae 100644 |
| --- a/ui/views/view_unittest.cc |
| +++ b/ui/views/view_unittest.cc |
| @@ -5023,4 +5023,20 @@ TEST_F(ViewObserverTest, ChildViewReordered) { |
| EXPECT_EQ(child_view2.get(), view_reordered()); |
| } |
| +// Validates that if a child of a ScrollView adds a layer, then a layer |
| +// is added to the ScrollView's viewport. |
| +TEST_F(ViewObserverTest, ScrollViewChildAddLayerTest) { |
| + ScrollView* scroll_view = new ScrollView(); |
|
sky
2017/04/18 15:35:48
Declare this on the stack, otherwise you're going
ananta
2017/04/18 22:22:39
Changed to unique_ptr
|
| + scroll_view->SetContents(new View()); |
| + EXPECT_TRUE(scroll_view->contents_viewport()->layer() == nullptr); |
|
sky
2017/04/18 15:35:48
EXPECT_FALSE(scroll_view->contents_viewport()->lay
ananta
2017/04/18 22:22:39
Done.
|
| + |
| + std::unique_ptr<View> child_view = NewView(); |
| + scroll_view->AddChildView(child_view.get()); |
| + child_view->SetBounds(0, 0, 100, 100); |
| + child_view->SetPaintToLayer(ui::LAYER_TEXTURED); |
| + |
| + EXPECT_TRUE(scroll_view->contents_viewport()->layer() != nullptr); |
|
sky
2017/04/18 15:35:48
EXPECT_TRUE(scroll_view->contents_viewport()->laye
ananta
2017/04/18 22:22:39
Done.
|
| + scroll_view->RemoveChildView(child_view.get()); |
| +} |
| + |
| } // namespace views |