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

Side by Side Diff: ash/wm/system_modal_container_layout_manager_unittest.cc

Issue 10857021: Prepare a bunch of ash tests for workspace2. With Workspace2 you can't (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
« no previous file with comments | « ash/wm/shelf_layout_manager_unittest.cc ('k') | ash/wm/window_animations_unittest.cc » ('j') | 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 "ash/wm/system_modal_container_layout_manager.h" 5 #include "ash/wm/system_modal_container_layout_manager.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_delegate.h" 8 #include "ash/shell_delegate.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 11 matching lines...) Expand all
22 namespace test { 22 namespace test {
23 23
24 namespace { 24 namespace {
25 25
26 aura::Window* GetModalContainer() { 26 aura::Window* GetModalContainer() {
27 return Shell::GetContainer( 27 return Shell::GetContainer(
28 Shell::GetPrimaryRootWindow(), 28 Shell::GetPrimaryRootWindow(),
29 ash::internal::kShellWindowId_SystemModalContainer); 29 ash::internal::kShellWindowId_SystemModalContainer);
30 } 30 }
31 31
32 aura::Window* GetDefaultContainer() {
33 return Shell::GetContainer(
34 Shell::GetPrimaryRootWindow(),
35 ash::internal::kShellWindowId_DefaultContainer);
36 }
37
38 class TestWindow : public views::WidgetDelegateView { 32 class TestWindow : public views::WidgetDelegateView {
39 public: 33 public:
40 explicit TestWindow(bool modal) : modal_(modal) {} 34 explicit TestWindow(bool modal) : modal_(modal) {}
41 virtual ~TestWindow() {} 35 virtual ~TestWindow() {}
42 36
43 static aura::Window* OpenTestWindow(aura::Window* parent, bool modal) { 37 static aura::Window* OpenTestWindow(aura::Window* parent, bool modal) {
44 views::Widget* widget = 38 views::Widget* widget =
45 views::Widget::CreateWindowWithParent(new TestWindow(modal), parent); 39 views::Widget::CreateWindowWithParent(new TestWindow(modal), parent);
46 widget->Show(); 40 widget->Show();
47 return widget->GetNativeView(); 41 return widget->GetNativeView();
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 108
115 typedef AshTestBase SystemModalContainerLayoutManagerTest; 109 typedef AshTestBase SystemModalContainerLayoutManagerTest;
116 110
117 TEST_F(SystemModalContainerLayoutManagerTest, NonModalTransient) { 111 TEST_F(SystemModalContainerLayoutManagerTest, NonModalTransient) {
118 scoped_ptr<aura::Window> parent(TestWindow::OpenTestWindow(NULL, false)); 112 scoped_ptr<aura::Window> parent(TestWindow::OpenTestWindow(NULL, false));
119 aura::Window* transient = TestWindow::OpenTestWindow(parent.get(), false); 113 aura::Window* transient = TestWindow::OpenTestWindow(parent.get(), false);
120 TransientWindowObserver destruction_observer; 114 TransientWindowObserver destruction_observer;
121 transient->AddObserver(&destruction_observer); 115 transient->AddObserver(&destruction_observer);
122 116
123 EXPECT_EQ(parent.get(), transient->transient_parent()); 117 EXPECT_EQ(parent.get(), transient->transient_parent());
124 EXPECT_EQ(GetDefaultContainer(), transient->parent()); 118 EXPECT_EQ(parent->parent(), transient->parent());
125 119
126 // The transient should be destroyed with its parent. 120 // The transient should be destroyed with its parent.
127 parent.reset(); 121 parent.reset();
128 EXPECT_TRUE(destruction_observer.destroyed()); 122 EXPECT_TRUE(destruction_observer.destroyed());
129 } 123 }
130 124
131 TEST_F(SystemModalContainerLayoutManagerTest, ModalTransient) { 125 TEST_F(SystemModalContainerLayoutManagerTest, ModalTransient) {
132 scoped_ptr<aura::Window> parent(TestWindow::OpenTestWindow(NULL, false)); 126 scoped_ptr<aura::Window> parent(TestWindow::OpenTestWindow(NULL, false));
133 // parent should be active. 127 // parent should be active.
134 EXPECT_TRUE(wm::IsActiveWindow(parent.get())); 128 EXPECT_TRUE(wm::IsActiveWindow(parent.get()));
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 // We set now the bounds of the root window to something new which will 336 // We set now the bounds of the root window to something new which will
343 // Then trigger the repos operation. 337 // Then trigger the repos operation.
344 GetModalContainer()->SetBounds(gfx::Rect(0, 0, 800, 600)); 338 GetModalContainer()->SetBounds(gfx::Rect(0, 0, 800, 600));
345 339
346 gfx::Rect bounds = main->bounds(); 340 gfx::Rect bounds = main->bounds();
347 EXPECT_EQ(bounds, gfx::Rect(700, 500, 100, 100)); 341 EXPECT_EQ(bounds, gfx::Rect(700, 500, 100, 100));
348 } 342 }
349 343
350 } // namespace test 344 } // namespace test
351 } // namespace ash 345 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/shelf_layout_manager_unittest.cc ('k') | ash/wm/window_animations_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698