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

Side by Side Diff: ui/views/view_unittest_aura.cc

Issue 2383263002: Generalize layer mirroring for phantom windows (Closed)
Patch Set: Revert layer renaming Created 4 years, 2 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 unified diff | Download patch
OLDNEW
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 <memory> 7 #include <memory>
8 8
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/compositor/layer.h" 10 #include "ui/compositor/layer.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // Verify the value of Widget::GetRootLayers(). It should only include layers 115 // Verify the value of Widget::GetRootLayers(). It should only include layers
116 // from layer-backed Views descended from the Widget's root View. 116 // from layer-backed Views descended from the Widget's root View.
117 std::vector<ui::Layer*> old_w1_root_sublayers = w1->GetRootLayers(); 117 std::vector<ui::Layer*> old_w1_root_sublayers = w1->GetRootLayers();
118 ASSERT_EQ(3u, old_w1_root_sublayers.size()); 118 ASSERT_EQ(3u, old_w1_root_sublayers.size());
119 EXPECT_EQ(v1_layer, old_w1_root_sublayers[0]); 119 EXPECT_EQ(v1_layer, old_w1_root_sublayers[0]);
120 EXPECT_EQ(v4_layer, old_w1_root_sublayers[1]); 120 EXPECT_EQ(v4_layer, old_w1_root_sublayers[1]);
121 EXPECT_EQ(v7_layer, old_w1_root_sublayers[2]); 121 EXPECT_EQ(v7_layer, old_w1_root_sublayers[2]);
122 122
123 { 123 {
124 std::unique_ptr<ui::LayerTreeOwner> cloned_owner( 124 std::unique_ptr<ui::LayerTreeOwner> cloned_owner(
125 wm::RecreateLayers(w1->GetNativeView(), nullptr)); 125 wm::RecreateLayers(w1->GetNativeView()));
126 EXPECT_EQ(w1_layer, cloned_owner->root()); 126 EXPECT_EQ(w1_layer, cloned_owner->root());
127 EXPECT_NE(w1_layer, w1->GetNativeView()->layer()); 127 EXPECT_NE(w1_layer, w1->GetNativeView()->layer());
128 128
129 // The old layers should still exist and have the same hierarchy. 129 // The old layers should still exist and have the same hierarchy.
130 ASSERT_EQ("w1", w1_layer->name()); 130 ASSERT_EQ("w1", w1_layer->name());
131 ASSERT_EQ("v1 v4 w2 v7", ui::test::ChildLayerNamesAsString(*w1_layer)); 131 ASSERT_EQ("v1 v4 w2 v7", ui::test::ChildLayerNamesAsString(*w1_layer));
132 ASSERT_EQ("v5", ui::test::ChildLayerNamesAsString(*w2_layer)); 132 ASSERT_EQ("v5", ui::test::ChildLayerNamesAsString(*w2_layer));
133 ASSERT_EQ("v6", ui::test::ChildLayerNamesAsString(*v5_layer)); 133 ASSERT_EQ("v6", ui::test::ChildLayerNamesAsString(*v5_layer));
134 EXPECT_EQ("v8 v9", ui::test::ChildLayerNamesAsString(*v7_layer)); 134 EXPECT_EQ("v8 v9", ui::test::ChildLayerNamesAsString(*v7_layer));
135 135
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 std::vector<ui::Layer*> new_w1_root_sublayers = w1->GetRootLayers(); 173 std::vector<ui::Layer*> new_w1_root_sublayers = w1->GetRootLayers();
174 ASSERT_EQ(3u, new_w1_root_sublayers.size()); 174 ASSERT_EQ(3u, new_w1_root_sublayers.size());
175 EXPECT_EQ(v1_new_layer, new_w1_root_sublayers[0]); 175 EXPECT_EQ(v1_new_layer, new_w1_root_sublayers[0]);
176 EXPECT_EQ(v4_new_layer, new_w1_root_sublayers[1]); 176 EXPECT_EQ(v4_new_layer, new_w1_root_sublayers[1]);
177 EXPECT_EQ(v7_new_layer, new_w1_root_sublayers[2]); 177 EXPECT_EQ(v7_new_layer, new_w1_root_sublayers[2]);
178 } 178 }
179 w1->CloseNow(); 179 w1->CloseNow();
180 } 180 }
181 181
182 } // namespace views 182 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698