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

Side by Side Diff: ui/views/corewm/transient_window_manager_unittest.cc

Issue 121773003: Makes Window::Init take a WindowLayerType instead of LayerType. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge to master Created 6 years, 11 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 | Annotate | Revision Log
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/corewm/transient_window_manager.h" 5 #include "ui/views/corewm/transient_window_manager.h"
6 6
7 #include "ui/aura/client/visibility_client.h" 7 #include "ui/aura/client/visibility_client.h"
8 #include "ui/aura/client/window_tree_client.h" 8 #include "ui/aura/client/window_tree_client.h"
9 #include "ui/aura/layout_manager.h" 9 #include "ui/aura/layout_manager.h"
10 #include "ui/aura/test/test_windows.h" 10 #include "ui/aura/test/test_windows.h"
(...skipping 13 matching lines...) Expand all
24 public: 24 public:
25 TransientWindowManagerTest() {} 25 TransientWindowManagerTest() {}
26 virtual ~TransientWindowManagerTest() {} 26 virtual ~TransientWindowManagerTest() {}
27 27
28 protected: 28 protected:
29 // Creates a transient window that is transient to |parent|. 29 // Creates a transient window that is transient to |parent|.
30 Window* CreateTransientChild(int id, Window* parent) { 30 Window* CreateTransientChild(int id, Window* parent) {
31 Window* window = new Window(NULL); 31 Window* window = new Window(NULL);
32 window->set_id(id); 32 window->set_id(id);
33 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); 33 window->SetType(ui::wm::WINDOW_TYPE_NORMAL);
34 window->Init(ui::LAYER_TEXTURED); 34 window->Init(aura::WINDOW_LAYER_TEXTURED);
35 aura::client::ParentWindowWithContext(window, GetContext(), gfx::Rect()); 35 aura::client::ParentWindowWithContext(window, GetContext(), gfx::Rect());
36 AddTransientChild(parent, window); 36 AddTransientChild(parent, window);
37 return window; 37 return window;
38 } 38 }
39 39
40 private: 40 private:
41 DISALLOW_COPY_AND_ASSIGN(TransientWindowManagerTest); 41 DISALLOW_COPY_AND_ASSIGN(TransientWindowManagerTest);
42 }; 42 };
43 43
44 // Various assertions for transient children. 44 // Various assertions for transient children.
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 } // namespace 251 } // namespace
252 252
253 // Verifies the delegate is notified of destruction after transients are 253 // Verifies the delegate is notified of destruction after transients are
254 // destroyed. 254 // destroyed.
255 TEST_F(TransientWindowManagerTest, NotifyDelegateAfterDeletingTransients) { 255 TEST_F(TransientWindowManagerTest, NotifyDelegateAfterDeletingTransients) {
256 std::vector<std::string> destruction_order; 256 std::vector<std::string> destruction_order;
257 257
258 DestroyedTrackingDelegate parent_delegate("parent", &destruction_order); 258 DestroyedTrackingDelegate parent_delegate("parent", &destruction_order);
259 scoped_ptr<Window> parent(new Window(&parent_delegate)); 259 scoped_ptr<Window> parent(new Window(&parent_delegate));
260 parent->Init(ui::LAYER_NOT_DRAWN); 260 parent->Init(aura::WINDOW_LAYER_NOT_DRAWN);
261 261
262 DestroyedTrackingDelegate transient_delegate("transient", &destruction_order); 262 DestroyedTrackingDelegate transient_delegate("transient", &destruction_order);
263 Window* transient = new Window(&transient_delegate); // Owned by |parent|. 263 Window* transient = new Window(&transient_delegate); // Owned by |parent|.
264 transient->Init(ui::LAYER_NOT_DRAWN); 264 transient->Init(aura::WINDOW_LAYER_NOT_DRAWN);
265 AddTransientChild(parent.get(), transient); 265 AddTransientChild(parent.get(), transient);
266 parent.reset(); 266 parent.reset();
267 267
268 ASSERT_EQ(2u, destruction_order.size()); 268 ASSERT_EQ(2u, destruction_order.size());
269 EXPECT_EQ("transient", destruction_order[0]); 269 EXPECT_EQ("transient", destruction_order[0]);
270 EXPECT_EQ("parent", destruction_order[1]); 270 EXPECT_EQ("parent", destruction_order[1]);
271 } 271 }
272 272
273 TEST_F(TransientWindowManagerTest, StackTransientsWhoseLayersHaveNoDelegate) { 273 TEST_F(TransientWindowManagerTest, StackTransientsWhoseLayersHaveNoDelegate) {
274 // Create a window with several transients, then a couple windows on top. 274 // Create a window with several transients, then a couple windows on top.
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 EXPECT_EQ(root->children()[3], window3.get()); 568 EXPECT_EQ(root->children()[3], window3.get());
569 ASSERT_EQ(4u, root->layer()->children().size()); 569 ASSERT_EQ(4u, root->layer()->children().size());
570 EXPECT_EQ(root->layer()->children()[0], window2->layer()); 570 EXPECT_EQ(root->layer()->children()[0], window2->layer());
571 EXPECT_EQ(root->layer()->children()[1], transient2->layer()); 571 EXPECT_EQ(root->layer()->children()[1], transient2->layer());
572 EXPECT_EQ(root->layer()->children()[2], window1->layer()); 572 EXPECT_EQ(root->layer()->children()[2], window1->layer());
573 EXPECT_EQ(root->layer()->children()[3], window3->layer()); 573 EXPECT_EQ(root->layer()->children()[3], window3->layer());
574 } 574 }
575 575
576 } // namespace corewm 576 } // namespace corewm
577 } // namespace views 577 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/corewm/shadow_controller_unittest.cc ('k') | ui/views/widget/desktop_aura/desktop_native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698