| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/views/view.h" | 5 #include "ui/views/view.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include <memory> |
| 8 |
| 8 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 9 #include "ui/compositor/layer.h" | 10 #include "ui/compositor/layer.h" |
| 10 #include "ui/compositor/layer_tree_owner.h" | 11 #include "ui/compositor/layer_tree_owner.h" |
| 11 #include "ui/compositor/test/test_layers.h" | 12 #include "ui/compositor/test/test_layers.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
| 13 #include "ui/views/test/views_test_base.h" | 14 #include "ui/views/test/views_test_base.h" |
| 14 #include "ui/views/view_constants_aura.h" | 15 #include "ui/views/view_constants_aura.h" |
| 15 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 16 #include "ui/wm/core/window_util.h" | 17 #include "ui/wm/core/window_util.h" |
| 17 | 18 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 114 |
| 114 // Verify the value of Widget::GetRootLayers(). It should only include layers | 115 // Verify the value of Widget::GetRootLayers(). It should only include layers |
| 115 // from layer-backed Views descended from the Widget's root View. | 116 // from layer-backed Views descended from the Widget's root View. |
| 116 std::vector<ui::Layer*> old_w1_root_sublayers = w1->GetRootLayers(); | 117 std::vector<ui::Layer*> old_w1_root_sublayers = w1->GetRootLayers(); |
| 117 ASSERT_EQ(3u, old_w1_root_sublayers.size()); | 118 ASSERT_EQ(3u, old_w1_root_sublayers.size()); |
| 118 EXPECT_EQ(v1_layer, old_w1_root_sublayers[0]); | 119 EXPECT_EQ(v1_layer, old_w1_root_sublayers[0]); |
| 119 EXPECT_EQ(v4_layer, old_w1_root_sublayers[1]); | 120 EXPECT_EQ(v4_layer, old_w1_root_sublayers[1]); |
| 120 EXPECT_EQ(v7_layer, old_w1_root_sublayers[2]); | 121 EXPECT_EQ(v7_layer, old_w1_root_sublayers[2]); |
| 121 | 122 |
| 122 { | 123 { |
| 123 scoped_ptr<ui::LayerTreeOwner> cloned_owner( | 124 std::unique_ptr<ui::LayerTreeOwner> cloned_owner( |
| 124 wm::RecreateLayers(w1->GetNativeView())); | 125 wm::RecreateLayers(w1->GetNativeView())); |
| 125 EXPECT_EQ(w1_layer, cloned_owner->root()); | 126 EXPECT_EQ(w1_layer, cloned_owner->root()); |
| 126 EXPECT_NE(w1_layer, w1->GetNativeView()->layer()); | 127 EXPECT_NE(w1_layer, w1->GetNativeView()->layer()); |
| 127 | 128 |
| 128 // The old layers should still exist and have the same hierarchy. | 129 // The old layers should still exist and have the same hierarchy. |
| 129 ASSERT_EQ("w1", w1_layer->name()); | 130 ASSERT_EQ("w1", w1_layer->name()); |
| 130 ASSERT_EQ("v1 v4 w2 v7", ui::test::ChildLayerNamesAsString(*w1_layer)); | 131 ASSERT_EQ("v1 v4 w2 v7", ui::test::ChildLayerNamesAsString(*w1_layer)); |
| 131 ASSERT_EQ("v5", ui::test::ChildLayerNamesAsString(*w2_layer)); | 132 ASSERT_EQ("v5", ui::test::ChildLayerNamesAsString(*w2_layer)); |
| 132 ASSERT_EQ("v6", ui::test::ChildLayerNamesAsString(*v5_layer)); | 133 ASSERT_EQ("v6", ui::test::ChildLayerNamesAsString(*v5_layer)); |
| 133 EXPECT_EQ("v8 v9", ui::test::ChildLayerNamesAsString(*v7_layer)); | 134 EXPECT_EQ("v8 v9", ui::test::ChildLayerNamesAsString(*v7_layer)); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 std::vector<ui::Layer*> new_w1_root_sublayers = w1->GetRootLayers(); | 173 std::vector<ui::Layer*> new_w1_root_sublayers = w1->GetRootLayers(); |
| 173 ASSERT_EQ(3u, new_w1_root_sublayers.size()); | 174 ASSERT_EQ(3u, new_w1_root_sublayers.size()); |
| 174 EXPECT_EQ(v1_new_layer, new_w1_root_sublayers[0]); | 175 EXPECT_EQ(v1_new_layer, new_w1_root_sublayers[0]); |
| 175 EXPECT_EQ(v4_new_layer, new_w1_root_sublayers[1]); | 176 EXPECT_EQ(v4_new_layer, new_w1_root_sublayers[1]); |
| 176 EXPECT_EQ(v7_new_layer, new_w1_root_sublayers[2]); | 177 EXPECT_EQ(v7_new_layer, new_w1_root_sublayers[2]); |
| 177 } | 178 } |
| 178 w1->CloseNow(); | 179 w1->CloseNow(); |
| 179 } | 180 } |
| 180 | 181 |
| 181 } // namespace views | 182 } // namespace views |
| OLD | NEW |