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

Side by Side Diff: ui/aura/window_unittest.cc

Issue 58343004: Allow stacking below windows with layers with NULL delegates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« ui/aura/window.cc ('K') | « ui/aura/window.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/aura/window.h" 5 #include "ui/aura/window.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 2153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(0, 0, 100, 100), 2164 CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(0, 0, 100, 100),
2165 root_window())); 2165 root_window()));
2166 scoped_ptr<ui::Layer>acquired_layer(w->AcquireLayer()); 2166 scoped_ptr<ui::Layer>acquired_layer(w->AcquireLayer());
2167 scoped_ptr<ui::Layer>doubly_acquired_layer(w->RecreateLayer()); 2167 scoped_ptr<ui::Layer>doubly_acquired_layer(w->RecreateLayer());
2168 EXPECT_EQ(NULL, doubly_acquired_layer.get()); 2168 EXPECT_EQ(NULL, doubly_acquired_layer.get());
2169 2169
2170 // Destroy window before layer gets destroyed. 2170 // Destroy window before layer gets destroyed.
2171 w.reset(); 2171 w.reset();
2172 } 2172 }
2173 2173
2174 TEST_F(WindowTest, StackWindowAtBottomBelowWindowWhoseLayerHasNoDelegate) {
2175 scoped_ptr<Window> window1(CreateTestWindowWithId(1, root_window()));
2176 window1->layer()->set_name("1");
2177 scoped_ptr<Window> window2(CreateTestWindowWithId(2, root_window()));
2178 window2->layer()->set_name("2");
2179 scoped_ptr<Window> window3(CreateTestWindowWithId(3, root_window()));
2180 window3->layer()->set_name("3");
2181
2182 EXPECT_EQ("1 2 3", ChildWindowIDsAsString(root_window()));
2183 EXPECT_EQ("1 2 3",
2184 ui::test::ChildLayerNamesAsString(*root_window()->layer()));
2185 window1->layer()->set_delegate(NULL);
2186 root_window()->StackChildAtBottom(window3.get());
2187
2188 // Window 3 should have moved to the bottom.
2189 EXPECT_EQ("3 1 2", ChildWindowIDsAsString(root_window()));
2190 EXPECT_EQ("3 1 2",
2191 ui::test::ChildLayerNamesAsString(*root_window()->layer()));
2192 }
2193
2174 TEST_F(WindowTest, StackWindowsWhoseLayersHaveNoDelegate) { 2194 TEST_F(WindowTest, StackWindowsWhoseLayersHaveNoDelegate) {
2175 scoped_ptr<Window> window1(CreateTestWindowWithId(1, root_window())); 2195 scoped_ptr<Window> window1(CreateTestWindowWithId(1, root_window()));
2176 window1->layer()->set_name("1"); 2196 window1->layer()->set_name("1");
2177 scoped_ptr<Window> window2(CreateTestWindowWithId(2, root_window())); 2197 scoped_ptr<Window> window2(CreateTestWindowWithId(2, root_window()));
2178 window2->layer()->set_name("2"); 2198 window2->layer()->set_name("2");
2179 scoped_ptr<Window> window3(CreateTestWindowWithId(3, root_window())); 2199 scoped_ptr<Window> window3(CreateTestWindowWithId(3, root_window()));
2180 window3->layer()->set_name("3"); 2200 window3->layer()->set_name("3");
2181 2201
2182 // This brings |window1| (and its layer) to the front. 2202 // This brings |window1| (and its layer) to the front.
2183 root_window()->StackChildAbove(window1.get(), window3.get()); 2203 root_window()->StackChildAbove(window1.get(), window3.get());
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
3163 parent->AddTransientChild(transient); 3183 parent->AddTransientChild(transient);
3164 parent.reset(); 3184 parent.reset();
3165 3185
3166 ASSERT_EQ(2u, destruction_order.size()); 3186 ASSERT_EQ(2u, destruction_order.size());
3167 EXPECT_EQ("transient", destruction_order[0]); 3187 EXPECT_EQ("transient", destruction_order[0]);
3168 EXPECT_EQ("parent", destruction_order[1]); 3188 EXPECT_EQ("parent", destruction_order[1]);
3169 } 3189 }
3170 3190
3171 } // namespace test 3191 } // namespace test
3172 } // namespace aura 3192 } // namespace aura
OLDNEW
« ui/aura/window.cc ('K') | « ui/aura/window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698