[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()); |
| 122 | #if !defined(OS_WIN) |
| 123 | // TODO(oshima): Window reports smaller screen size. Investigate why. |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 124 | EXPECT_EQ("600,0 500x500", maximized->GetWindowBoundsInScreen().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 125 | EXPECT_EQ("0,0 500x500", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 126 | maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 127 | #endif |
| 128 | |
| 129 | views::Widget* minimized = CreateTestWidget(gfx::Rect(800, 10, 100, 100)); |
| 130 | minimized->Minimize(); |
| 131 | EXPECT_EQ(root_windows[1], minimized->GetNativeView()->GetRootWindow()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 132 | EXPECT_EQ("800,10 100x100", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 133 | minimized->GetWindowBoundsInScreen().ToString()); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 134 | |
| 135 | views::Widget* fullscreen = CreateTestWidget(gfx::Rect(900, 10, 100, 100)); |
| 136 | fullscreen->SetFullscreen(true); |
| 137 | EXPECT_EQ(root_windows[1], fullscreen->GetNativeView()->GetRootWindow()); |
| 138 | #if !defined(OS_WIN) |
| 139 | // TODO(oshima): Window reports smaller screen size. Investigate why. |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 140 | EXPECT_EQ("600,0 500x500", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 141 | fullscreen->GetWindowBoundsInScreen().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 142 | EXPECT_EQ("0,0 500x500", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 143 | fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 144 | #endif |
| 145 | |
[email protected] | dbf835d8 | 2012-09-11 18:23:09 | [diff] [blame] | 146 | // Make sure a window that will delete itself when losing focus |
| 147 | // will not crash. |
| 148 | aura::WindowTracker tracker; |
| 149 | DeleteOnBlurDelegate delete_on_blur_delegate; |
| 150 | aura::Window* d2 = aura::test::CreateTestWindowWithDelegate( |
| 151 | &delete_on_blur_delegate, 0, gfx::Rect(50, 50, 100, 100), NULL); |
| 152 | delete_on_blur_delegate.set_window(d2); |
[email protected] | 8cfb672 | 2012-11-28 03:28:46 | [diff] [blame^] | 153 | aura::client::GetFocusClient(root_windows[0])->FocusWindow(d2, NULL); |
[email protected] | dbf835d8 | 2012-09-11 18:23:09 | [diff] [blame] | 154 | tracker.Add(d2); |
| 155 | |
[email protected] | f634dd3 | 2012-07-23 22:49:07 | [diff] [blame] | 156 | UpdateDisplay("600x600"); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 157 | |
[email protected] | dbf835d8 | 2012-09-11 18:23:09 | [diff] [blame] | 158 | // d2 must have been deleted. |
| 159 | EXPECT_FALSE(tracker.Contains(d2)); |
| 160 | |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 161 | EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 162 | EXPECT_EQ("50,10 100x100", normal->GetWindowBoundsInScreen().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 163 | EXPECT_EQ("50,10 100x100", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 164 | normal->GetNativeView()->GetBoundsInRootWindow().ToString()); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 165 | |
[email protected] | eefd51b2 | 2012-09-25 20:26:24 | [diff] [blame] | 166 | // Maximized area on primary display has 3px (given as |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 167 | // kAutoHideSize in shelf_layout_manager.cc) inset at the bottom. |
| 168 | EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow()); |
[email protected] | 7b675df61 | 2012-09-16 18:33:20 | [diff] [blame] | 169 | EXPECT_EQ("0,0 600x597", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 170 | maximized->GetWindowBoundsInScreen().ToString()); |
[email protected] | 7b675df61 | 2012-09-16 18:33:20 | [diff] [blame] | 171 | EXPECT_EQ("0,0 600x597", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 172 | maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 173 | |
| 174 | EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 175 | EXPECT_EQ("200,10 100x100", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 176 | minimized->GetWindowBoundsInScreen().ToString()); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 177 | |
| 178 | EXPECT_EQ(root_windows[0], fullscreen->GetNativeView()->GetRootWindow()); |
| 179 | EXPECT_TRUE(fullscreen->IsFullscreen()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 180 | EXPECT_EQ("0,0 600x600", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 181 | fullscreen->GetWindowBoundsInScreen().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 182 | EXPECT_EQ("0,0 600x600", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 183 | fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 184 | |
| 185 | // Test if the restore bounds are correctly updated. |
| 186 | wm::RestoreWindow(maximized->GetNativeView()); |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 187 | EXPECT_EQ("100,10 100x100", maximized->GetWindowBoundsInScreen().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 188 | EXPECT_EQ("100,10 100x100", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 189 | maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 190 | |
| 191 | fullscreen->SetFullscreen(false); |
| 192 | EXPECT_EQ("300,10 100x100", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 193 | fullscreen->GetWindowBoundsInScreen().ToString()); |
[email protected] | 8d625fb | 2012-07-18 16:40:06 | [diff] [blame] | 194 | EXPECT_EQ("300,10 100x100", |
[email protected] | e2f64d10 | 2012-07-19 19:17:04 | [diff] [blame] | 195 | fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 196 | } |
| 197 | |
| 198 | TEST_F(RootWindowControllerTest, MoveWindows_Modal) { |
[email protected] | f634dd3 | 2012-07-23 22:49:07 | [diff] [blame] | 199 | UpdateDisplay("500x500,500x500"); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 200 | |
| 201 | Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 202 | // Emulate virtual screen coordinate system. |
| 203 | root_windows[0]->SetBounds(gfx::Rect(0, 0, 500, 500)); |
| 204 | root_windows[1]->SetBounds(gfx::Rect(500, 0, 500, 500)); |
| 205 | |
| 206 | views::Widget* normal = CreateTestWidget(gfx::Rect(300, 10, 100, 100)); |
| 207 | EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); |
| 208 | EXPECT_TRUE(wm::IsActiveWindow(normal->GetNativeView())); |
| 209 | |
| 210 | views::Widget* modal = CreateModalWidget(gfx::Rect(650, 10, 100, 100)); |
| 211 | EXPECT_EQ(root_windows[1], modal->GetNativeView()->GetRootWindow()); |
| 212 | EXPECT_TRUE(GetModalContainer(root_windows[1])->Contains( |
| 213 | modal->GetNativeView())); |
| 214 | EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); |
| 215 | |
| 216 | aura::test::EventGenerator generator_1st(root_windows[0]); |
| 217 | generator_1st.ClickLeftButton(); |
| 218 | EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); |
| 219 | |
[email protected] | f634dd3 | 2012-07-23 22:49:07 | [diff] [blame] | 220 | UpdateDisplay("500x500"); |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 221 | EXPECT_EQ(root_windows[0], modal->GetNativeView()->GetRootWindow()); |
| 222 | EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); |
| 223 | generator_1st.ClickLeftButton(); |
| 224 | EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); |
| 225 | } |
| 226 | |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 227 | TEST_F(RootWindowControllerTest, ModalContainer) { |
| 228 | UpdateDisplay("600x600"); |
| 229 | Shell* shell = Shell::GetInstance(); |
| 230 | internal::RootWindowController* controller = |
| 231 | shell->GetPrimaryRootWindowController(); |
| 232 | EXPECT_EQ(user::LOGGED_IN_USER, |
| 233 | shell->tray_delegate()->GetUserLoginStatus()); |
| 234 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 235 | internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
| 236 | controller->GetSystemModalLayoutManager(NULL)); |
| 237 | |
[email protected] | 3b162e1 | 2012-11-09 11:52:35 | [diff] [blame] | 238 | views::Widget* session_modal_widget = |
| 239 | CreateModalWidget(gfx::Rect(300, 10, 100, 100)); |
| 240 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 241 | internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
| 242 | controller->GetSystemModalLayoutManager( |
| 243 | session_modal_widget->GetNativeView())); |
| 244 | |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 245 | shell->delegate()->LockScreen(); |
| 246 | EXPECT_EQ(user::LOGGED_IN_LOCKED, |
| 247 | shell->tray_delegate()->GetUserLoginStatus()); |
| 248 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 249 | internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), |
| 250 | controller->GetSystemModalLayoutManager(NULL)); |
[email protected] | 3b162e1 | 2012-11-09 11:52:35 | [diff] [blame] | 251 | |
| 252 | aura::Window* lock_container = |
| 253 | Shell::GetContainer(controller->root_window(), |
| 254 | internal::kShellWindowId_LockScreenContainer); |
| 255 | views::Widget* lock_modal_widget = |
| 256 | CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); |
| 257 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 258 | internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), |
| 259 | controller->GetSystemModalLayoutManager( |
| 260 | lock_modal_widget->GetNativeView())); |
| 261 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 262 | internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
| 263 | controller->GetSystemModalLayoutManager( |
| 264 | session_modal_widget->GetNativeView())); |
| 265 | |
[email protected] | 8674b31 | 2012-10-12 19:02:44 | [diff] [blame] | 266 | shell->delegate()->UnlockScreen(); |
| 267 | } |
| 268 | |
[email protected] | 1b21992 | 2012-11-13 21:16:43 | [diff] [blame] | 269 | TEST_F(RootWindowControllerTest, ModalContainerNotLoggedInLoggedIn) { |
| 270 | UpdateDisplay("600x600"); |
| 271 | Shell* shell = Shell::GetInstance(); |
| 272 | |
| 273 | // Configure login screen environment. |
| 274 | SetUserLoggedIn(false); |
| 275 | EXPECT_EQ(user::LOGGED_IN_NONE, |
| 276 | shell->tray_delegate()->GetUserLoginStatus()); |
| 277 | EXPECT_FALSE(shell->delegate()->IsUserLoggedIn()); |
| 278 | EXPECT_FALSE(shell->delegate()->IsSessionStarted()); |
| 279 | |
| 280 | internal::RootWindowController* controller = |
| 281 | shell->GetPrimaryRootWindowController(); |
| 282 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 283 | internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), |
| 284 | controller->GetSystemModalLayoutManager(NULL)); |
| 285 | |
| 286 | aura::Window* lock_container = |
| 287 | Shell::GetContainer(controller->root_window(), |
| 288 | internal::kShellWindowId_LockScreenContainer); |
| 289 | views::Widget* login_modal_widget = |
| 290 | CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); |
| 291 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 292 | internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), |
| 293 | controller->GetSystemModalLayoutManager( |
| 294 | login_modal_widget->GetNativeView())); |
| 295 | login_modal_widget->Close(); |
| 296 | |
| 297 | // Configure user session environment. |
| 298 | SetUserLoggedIn(true); |
| 299 | SetSessionStarted(true); |
| 300 | EXPECT_EQ(user::LOGGED_IN_USER, |
| 301 | shell->tray_delegate()->GetUserLoginStatus()); |
| 302 | EXPECT_TRUE(shell->delegate()->IsUserLoggedIn()); |
| 303 | EXPECT_TRUE(shell->delegate()->IsSessionStarted()); |
| 304 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 305 | internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
| 306 | controller->GetSystemModalLayoutManager(NULL)); |
| 307 | |
| 308 | views::Widget* session_modal_widget = |
| 309 | CreateModalWidget(gfx::Rect(300, 10, 100, 100)); |
| 310 | EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 311 | internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
| 312 | controller->GetSystemModalLayoutManager( |
| 313 | session_modal_widget->GetNativeView())); |
| 314 | } |
| 315 | |
[email protected] | f185312 | 2012-06-27 16:21:26 | [diff] [blame] | 316 | } // namespace test |
| 317 | } // namespace ash |