[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 5 | #include "ash/root_window_controller.h" |
| 6 | |
[email protected] | 2e236a5 | 2012-06-27 22:21:47 | [diff] [blame] | 7 | #include "ash/display/display_controller.h" |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 8 | #include "ash/shell.h" |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 9 | #include "ash/shell_delegate.h" |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 10 | #include "ash/shell_window_ids.h" |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 11 | #include "ash/system/tray/system_tray_delegate.h" |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 12 | #include "ash/test/ash_test_base.h" |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 13 | #include "ash/wm/system_modal_container_layout_manager.h" |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 14 | #include "ash/wm/window_util.h" |
[email protected] | 8cfb672 | 2012-11-28 03:28:46 | [diff] [blame] | 15 | #include "ui/aura/client/focus_client.h" |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 16 | #include "ui/aura/env.h" |
| 17 | #include "ui/aura/root_window.h" |
| 18 | #include "ui/aura/test/event_generator.h" |
[email protected] | dbf835d8 | 2012-09-11 18:23:09 | [diff] [blame] | 19 | #include "ui/aura/test/test_window_delegate.h" |
| 20 | #include "ui/aura/test/test_windows.h" |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 21 | #include "ui/aura/window.h" |
[email protected] | dbf835d8 | 2012-09-11 18:23:09 | [diff] [blame] | 22 | #include "ui/aura/window_tracker.h" |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 23 | #include "ui/views/controls/menu/menu_controller.h" |
| 24 | #include "ui/views/widget/widget.h" |
| 25 | #include "ui/views/widget/widget_delegate.h" |
| 26 | |
| 27 | namespace ash { |
| 28 | namespace { |
| 29 | |
| 30 | class TestDelegate : public views::WidgetDelegateView { |
| 31 | public: |
| 32 | explicit TestDelegate(bool system_modal) : system_modal_(system_modal) {} |
| 33 | virtual ~TestDelegate() {} |
| 34 | |
| 35 | // Overridden from views::WidgetDelegate: |
| 36 | virtual views::View* GetContentsView() OVERRIDE { |
| 37 | return this; |
| 38 | } |
| 39 | |
| 40 | virtual ui::ModalType GetModalType() const OVERRIDE { |
| 41 | return system_modal_ ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE; |
| 42 | } |
| 43 | |
| 44 | private: |
| 45 | bool system_modal_; |
| 46 | DISALLOW_COPY_AND_ASSIGN(TestDelegate); |
| 47 | }; |
| 48 | |
[email protected] | dbf835d8 | 2012-09-11 18:23:09 | [diff] [blame] | 49 | class DeleteOnBlurDelegate : public aura::test::TestWindowDelegate { |
| 50 | public: |
| 51 | DeleteOnBlurDelegate() : window_(NULL) {} |
| 52 | virtual ~DeleteOnBlurDelegate() {} |
| 53 | |
| 54 | void set_window(aura::Window* window) { window_ = window; } |
| 55 | |
| 56 | // aura::test::TestWindowDelegate overrides: |
| 57 | virtual bool CanFocus() OVERRIDE { |
| 58 | return true; |
| 59 | } |
| 60 | virtual void OnBlur() OVERRIDE { |
| 61 | delete window_; |
| 62 | } |
| 63 | |
| 64 | private: |
| 65 | aura::Window* window_; |
| 66 | |
| 67 | DISALLOW_COPY_AND_ASSIGN(DeleteOnBlurDelegate); |
| 68 | }; |
| 69 | |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 70 | views::Widget* CreateTestWidget(const gfx::Rect& bounds) { |
| 71 | views::Widget* widget = |
| 72 | views::Widget::CreateWindowWithBounds(NULL, bounds); |
| 73 | widget->Show(); |
| 74 | return widget; |
| 75 | } |
| 76 | |
| 77 | views::Widget* CreateModalWidget(const gfx::Rect& bounds) { |
| 78 | views::Widget* widget = |
| 79 | views::Widget::CreateWindowWithBounds(new TestDelegate(true), bounds); |
| 80 | widget->Show(); |
| 81 | return widget; |
| 82 | } |
| 83 | |
[email protected] | 3b162e1 | 2012-11-09 11:52:35 | [diff] [blame] | 84 | views::Widget* CreateModalWidgetWithParent(const gfx::Rect& bounds, |
| 85 | gfx::NativeWindow parent) { |
| 86 | views::Widget* widget = |
| 87 | views::Widget::CreateWindowWithParentAndBounds(new TestDelegate(true), |
| 88 | parent, |
| 89 | bounds); |
| 90 | widget->Show(); |
| 91 | return widget; |
| 92 | } |
| 93 | |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 94 | aura::Window* GetModalContainer(aura::RootWindow* root_window) { |
| 95 | return Shell::GetContainer( |
| 96 | root_window, |
| 97 | ash::internal::kShellWindowId_SystemModalContainer); |
| 98 | } |
| 99 | |
| 100 | } // namespace |
| 101 | |
| 102 | namespace test { |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 103 | |
[email protected] | 3e4351b | 2012-08-09 04:04:16 | [diff] [blame] | 104 | typedef test::AshTestBase RootWindowControllerTest; |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 105 | |
| 106 | TEST_F(RootWindowControllerTest, MoveWindows_Basic) { |
[email protected] | f634dd3 | 2012-07-23 22:49:07 | [diff] [blame] | 107 | UpdateDisplay("600x600,500x500"); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 108 | Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 109 | internal::RootWindowController* controller = |
| 110 | Shell::GetPrimaryRootWindowController(); |
| 111 | controller->SetShelfAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 112 | |
| 113 | views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100)); |
| 114 | EXPECT_EQ(root_windows[1], normal->GetNativeView()->GetRootWindow()); |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 115 | EXPECT_EQ("650,10 100x100", normal->GetWindowBoundsInScreen().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 116 | EXPECT_EQ("50,10 100x100", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 117 | normal->GetNativeView()->GetBoundsInRootWindow().ToString()); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 118 | |
| 119 | views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); |
| 120 | maximized->Maximize(); |
| 121 | EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow()); |
[email protected] | 1a01538 | 2012-12-01 19:44:59 | [diff] [blame^] | 122 | |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 123 | EXPECT_EQ("600,0 500x500", maximized->GetWindowBoundsInScreen().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 124 | EXPECT_EQ("0,0 500x500", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 125 | maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 126 | |
| 127 | views::Widget* minimized = CreateTestWidget(gfx::Rect(800, 10, 100, 100)); |
| 128 | minimized->Minimize(); |
| 129 | EXPECT_EQ(root_windows[1], minimized->GetNativeView()->GetRootWindow()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 130 | EXPECT_EQ("800,10 100x100", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 131 | minimized->GetWindowBoundsInScreen().ToString()); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 132 | |
| 133 | views::Widget* fullscreen = CreateTestWidget(gfx::Rect(900, 10, 100, 100)); |
| 134 | fullscreen->SetFullscreen(true); |
| 135 | EXPECT_EQ(root_windows[1], fullscreen->GetNativeView()->GetRootWindow()); |
[email protected] | 1a01538 | 2012-12-01 19:44:59 | [diff] [blame^] | 136 | |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 137 | EXPECT_EQ("600,0 500x500", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 138 | fullscreen->GetWindowBoundsInScreen().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 139 | EXPECT_EQ("0,0 500x500", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 140 | fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 141 | |
[email protected] | dbf835d8 | 2012-09-11 18:23:09 | [diff] [blame] | 142 | // Make sure a window that will delete itself when losing focus |
| 143 | // will not crash. |
| 144 | aura::WindowTracker tracker; |
| 145 | DeleteOnBlurDelegate delete_on_blur_delegate; |
[email protected] | 5ebe610 | 2012-11-28 21:00:03 | [diff] [blame] | 146 | aura::Window* d2 = CreateTestWindowInShellWithDelegate( |
| 147 | &delete_on_blur_delegate, 0, gfx::Rect(50, 50, 100, 100)); |
[email protected] | dbf835d8 | 2012-09-11 18:23:09 | [diff] [blame] | 148 | delete_on_blur_delegate.set_window(d2); |
[email protected] | 8cfb672 | 2012-11-28 03:28:46 | [diff] [blame] | 149 | aura::client::GetFocusClient(root_windows[0])->FocusWindow(d2, NULL); |
[email protected] | dbf835d8 | 2012-09-11 18:23:09 | [diff] [blame] | 150 | tracker.Add(d2); |
| 151 | |
[email protected] | f634dd3 | 2012-07-23 22:49:07 | [diff] [blame] | 152 | UpdateDisplay("600x600"); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 153 | |
[email protected] | dbf835d8 | 2012-09-11 18:23:09 | [diff] [blame] | 154 | // d2 must have been deleted. |
| 155 | EXPECT_FALSE(tracker.Contains(d2)); |
| 156 | |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 157 | EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 158 | EXPECT_EQ("50,10 100x100", normal->GetWindowBoundsInScreen().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 159 | EXPECT_EQ("50,10 100x100", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 160 | normal->GetNativeView()->GetBoundsInRootWindow().ToString()); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 161 | |
[email protected] | eefd51b2 | 2012-09-25 20:26:24 | [diff] [blame] | 162 | // Maximized area on primary display has 3px (given as |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 163 | // kAutoHideSize in shelf_layout_manager.cc) inset at the bottom. |
| 164 | EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow()); |
[email protected] | 7b675df61 | 2012-09-16 18:33:20 | [diff] [blame] | 165 | EXPECT_EQ("0,0 600x597", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 166 | maximized->GetWindowBoundsInScreen().ToString()); |
[email protected] | 7b675df61 | 2012-09-16 18:33:20 | [diff] [blame] | 167 | EXPECT_EQ("0,0 600x597", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 168 | maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 169 | |
| 170 | EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 171 | EXPECT_EQ("200,10 100x100", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 172 | minimized->GetWindowBoundsInScreen().ToString()); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 173 | |
| 174 | EXPECT_EQ(root_windows[0], fullscreen->GetNativeView()->GetRootWindow()); |
| 175 | EXPECT_TRUE(fullscreen->IsFullscreen()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 176 | EXPECT_EQ("0,0 600x600", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 177 | fullscreen->GetWindowBoundsInScreen().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 178 | EXPECT_EQ("0,0 600x600", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 179 | fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 180 | |
| 181 | // Test if the restore bounds are correctly updated. |
| 182 | wm::RestoreWindow(maximized->GetNativeView()); |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 183 | EXPECT_EQ("100,10 100x100", maximized->GetWindowBoundsInScreen().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 184 | EXPECT_EQ("100,10 100x100", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 185 | maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 186 | |
| 187 | fullscreen->SetFullscreen(false); |
| 188 | EXPECT_EQ("300,10 100x100", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 189 | fullscreen->GetWindowBoundsInScreen().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 190 | EXPECT_EQ("300,10 100x100", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 191 | fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | TEST_F(RootWindowControllerTest, MoveWindows_Modal) { |
[email protected] | f634dd3 | 2012-07-23 22:49:07 | [diff] [blame] | 195 | UpdateDisplay("500x500,500x500"); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 196 | |
| 197 | Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 198 | // Emulate virtual screen coordinate system. |
| 199 | root_windows[0]->SetBounds(gfx::Rect(0, 0, 500, 500)); |
| 200 | root_windows[1]->SetBounds(gfx::Rect(500, 0, 500, 500)); |
| 201 | |
| 202 | views::Widget* normal = CreateTestWidget(gfx::Rect(300, 10, 100, 100)); |
| 203 | EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); |
| 204 | EXPECT_TRUE(wm::IsActiveWindow(normal->GetNativeView())); |
| 205 | |
| 206 | views::Widget* modal = CreateModalWidget(gfx::Rect(650, 10, 100, 100)); |
| 207 | EXPECT_EQ(root_windows[1], modal->GetNativeView()->GetRootWindow()); |
| 208 | EXPECT_TRUE(GetModalContainer(root_windows[1])->Contains( |
| 209 | modal->GetNativeView())); |
| 210 | EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); |
| 211 | |
| 212 | aura::test::EventGenerator generator_1st(root_windows[0]); |
| 213 | generator_1st.ClickLeftButton(); |
| 214 | EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); |
| 215 | |
[email protected] | f634dd3 | 2012-07-23 22:49:07 | [diff] [blame] | 216 | UpdateDisplay("500x500"); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 217 | EXPECT_EQ(root_windows[0], modal->GetNativeView()->GetRootWindow()); |
| 218 | EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); |
| 219 | generator_1st.ClickLeftButton(); |
| 220 | EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); |
| 221 | } |
| 222 | |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 223 | TEST_F(RootWindowControllerTest, ModalContainer) { |
| 224 | UpdateDisplay("600x600"); |
| 225 | Shell* shell = Shell::GetInstance(); |
| 226 | internal::RootWindowController* controller = |
| 227 | shell->GetPrimaryRootWindowController(); |
| 228 | EXPECT_EQ(user::LOGGED_IN_USER, |
| 229 | shell->tray_delegate()->GetUserLoginStatus()); |
| 230 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 231 | internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
| 232 | controller->GetSystemModalLayoutManager(NULL)); |
| 233 | |
[email protected] | 3b162e1 | 2012-11-09 11:52:35 | [diff] [blame] | 234 | views::Widget* session_modal_widget = |
| 235 | CreateModalWidget(gfx::Rect(300, 10, 100, 100)); |
| 236 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 237 | internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
| 238 | controller->GetSystemModalLayoutManager( |
| 239 | session_modal_widget->GetNativeView())); |
| 240 | |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 241 | shell->delegate()->LockScreen(); |
| 242 | EXPECT_EQ(user::LOGGED_IN_LOCKED, |
| 243 | shell->tray_delegate()->GetUserLoginStatus()); |
| 244 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 245 | internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), |
| 246 | controller->GetSystemModalLayoutManager(NULL)); |
[email protected] | 3b162e1 | 2012-11-09 11:52:35 | [diff] [blame] | 247 | |
| 248 | aura::Window* lock_container = |
| 249 | Shell::GetContainer(controller->root_window(), |
| 250 | internal::kShellWindowId_LockScreenContainer); |
| 251 | views::Widget* lock_modal_widget = |
| 252 | CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); |
| 253 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 254 | internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), |
| 255 | controller->GetSystemModalLayoutManager( |
| 256 | lock_modal_widget->GetNativeView())); |
| 257 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 258 | internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
| 259 | controller->GetSystemModalLayoutManager( |
| 260 | session_modal_widget->GetNativeView())); |
| 261 | |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 262 | shell->delegate()->UnlockScreen(); |
| 263 | } |
| 264 | |
[email protected] | 1b21992 | 2012-11-13 21:16:43 | [diff] [blame] | 265 | TEST_F(RootWindowControllerTest, ModalContainerNotLoggedInLoggedIn) { |
| 266 | UpdateDisplay("600x600"); |
| 267 | Shell* shell = Shell::GetInstance(); |
| 268 | |
| 269 | // Configure login screen environment. |
| 270 | SetUserLoggedIn(false); |
| 271 | EXPECT_EQ(user::LOGGED_IN_NONE, |
| 272 | shell->tray_delegate()->GetUserLoginStatus()); |
| 273 | EXPECT_FALSE(shell->delegate()->IsUserLoggedIn()); |
| 274 | EXPECT_FALSE(shell->delegate()->IsSessionStarted()); |
| 275 | |
| 276 | internal::RootWindowController* controller = |
| 277 | shell->GetPrimaryRootWindowController(); |
| 278 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 279 | internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), |
| 280 | controller->GetSystemModalLayoutManager(NULL)); |
| 281 | |
| 282 | aura::Window* lock_container = |
| 283 | Shell::GetContainer(controller->root_window(), |
| 284 | internal::kShellWindowId_LockScreenContainer); |
| 285 | views::Widget* login_modal_widget = |
| 286 | CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); |
| 287 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 288 | internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), |
| 289 | controller->GetSystemModalLayoutManager( |
| 290 | login_modal_widget->GetNativeView())); |
| 291 | login_modal_widget->Close(); |
| 292 | |
| 293 | // Configure user session environment. |
| 294 | SetUserLoggedIn(true); |
| 295 | SetSessionStarted(true); |
| 296 | EXPECT_EQ(user::LOGGED_IN_USER, |
| 297 | shell->tray_delegate()->GetUserLoginStatus()); |
| 298 | EXPECT_TRUE(shell->delegate()->IsUserLoggedIn()); |
| 299 | EXPECT_TRUE(shell->delegate()->IsSessionStarted()); |
| 300 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 301 | internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
| 302 | controller->GetSystemModalLayoutManager(NULL)); |
| 303 | |
| 304 | views::Widget* session_modal_widget = |
| 305 | CreateModalWidget(gfx::Rect(300, 10, 100, 100)); |
| 306 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 307 | internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
| 308 | controller->GetSystemModalLayoutManager( |
| 309 | session_modal_widget->GetNativeView())); |
| 310 | } |
| 311 | |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 312 | } // namespace test |
| 313 | } // namespace ash |