OLD | NEW |
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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/session_state_delegate.h" |
8 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
9 #include "ash/shell.h" | 10 #include "ash/shell.h" |
10 #include "ash/shell_delegate.h" | |
11 #include "ash/shell_window_ids.h" | 11 #include "ash/shell_window_ids.h" |
12 #include "ash/system/tray/system_tray_delegate.h" | 12 #include "ash/system/tray/system_tray_delegate.h" |
13 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
14 #include "ash/wm/system_modal_container_layout_manager.h" | 14 #include "ash/wm/system_modal_container_layout_manager.h" |
15 #include "ash/wm/window_properties.h" | 15 #include "ash/wm/window_properties.h" |
16 #include "ash/wm/window_util.h" | 16 #include "ash/wm/window_util.h" |
17 #include "ui/aura/client/focus_change_observer.h" | 17 #include "ui/aura/client/focus_change_observer.h" |
18 #include "ui/aura/client/focus_client.h" | 18 #include "ui/aura/client/focus_client.h" |
19 #include "ui/aura/env.h" | 19 #include "ui/aura/env.h" |
20 #include "ui/aura/root_window.h" | 20 #include "ui/aura/root_window.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 internal::kShellWindowId_SystemModalContainer)->layout_manager(), | 294 internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
295 controller->GetSystemModalLayoutManager(NULL)); | 295 controller->GetSystemModalLayoutManager(NULL)); |
296 | 296 |
297 views::Widget* session_modal_widget = | 297 views::Widget* session_modal_widget = |
298 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); | 298 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); |
299 EXPECT_EQ(Shell::GetContainer(controller->root_window(), | 299 EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
300 internal::kShellWindowId_SystemModalContainer)->layout_manager(), | 300 internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
301 controller->GetSystemModalLayoutManager( | 301 controller->GetSystemModalLayoutManager( |
302 session_modal_widget->GetNativeView())); | 302 session_modal_widget->GetNativeView())); |
303 | 303 |
304 shell->delegate()->LockScreen(); | 304 shell->session_state_delegate()->LockScreen(); |
305 EXPECT_EQ(user::LOGGED_IN_LOCKED, | 305 EXPECT_EQ(user::LOGGED_IN_LOCKED, |
306 shell->system_tray_delegate()->GetUserLoginStatus()); | 306 shell->system_tray_delegate()->GetUserLoginStatus()); |
307 EXPECT_EQ(Shell::GetContainer(controller->root_window(), | 307 EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
308 internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), | 308 internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), |
309 controller->GetSystemModalLayoutManager(NULL)); | 309 controller->GetSystemModalLayoutManager(NULL)); |
310 | 310 |
311 aura::Window* lock_container = | 311 aura::Window* lock_container = |
312 Shell::GetContainer(controller->root_window(), | 312 Shell::GetContainer(controller->root_window(), |
313 internal::kShellWindowId_LockScreenContainer); | 313 internal::kShellWindowId_LockScreenContainer); |
314 views::Widget* lock_modal_widget = | 314 views::Widget* lock_modal_widget = |
315 CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); | 315 CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); |
316 EXPECT_EQ(Shell::GetContainer(controller->root_window(), | 316 EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
317 internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), | 317 internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), |
318 controller->GetSystemModalLayoutManager( | 318 controller->GetSystemModalLayoutManager( |
319 lock_modal_widget->GetNativeView())); | 319 lock_modal_widget->GetNativeView())); |
320 EXPECT_EQ(Shell::GetContainer(controller->root_window(), | 320 EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
321 internal::kShellWindowId_SystemModalContainer)->layout_manager(), | 321 internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
322 controller->GetSystemModalLayoutManager( | 322 controller->GetSystemModalLayoutManager( |
323 session_modal_widget->GetNativeView())); | 323 session_modal_widget->GetNativeView())); |
324 | 324 |
325 shell->delegate()->UnlockScreen(); | 325 shell->session_state_delegate()->UnlockScreen(); |
326 } | 326 } |
327 | 327 |
328 TEST_F(RootWindowControllerTest, ModalContainerNotLoggedInLoggedIn) { | 328 TEST_F(RootWindowControllerTest, ModalContainerNotLoggedInLoggedIn) { |
329 UpdateDisplay("600x600"); | 329 UpdateDisplay("600x600"); |
330 Shell* shell = Shell::GetInstance(); | 330 Shell* shell = Shell::GetInstance(); |
331 | 331 |
332 // Configure login screen environment. | 332 // Configure login screen environment. |
333 SetUserLoggedIn(false); | 333 SetUserLoggedIn(false); |
334 EXPECT_EQ(user::LOGGED_IN_NONE, | 334 EXPECT_EQ(user::LOGGED_IN_NONE, |
335 shell->system_tray_delegate()->GetUserLoginStatus()); | 335 shell->system_tray_delegate()->GetUserLoginStatus()); |
336 EXPECT_FALSE(shell->delegate()->IsUserLoggedIn()); | 336 EXPECT_FALSE(shell->session_state_delegate()->HasActiveUser()); |
337 EXPECT_FALSE(shell->delegate()->IsSessionStarted()); | 337 EXPECT_FALSE(shell->session_state_delegate()->IsActiveUserSessionStarted()); |
338 | 338 |
339 internal::RootWindowController* controller = | 339 internal::RootWindowController* controller = |
340 shell->GetPrimaryRootWindowController(); | 340 shell->GetPrimaryRootWindowController(); |
341 EXPECT_EQ(Shell::GetContainer(controller->root_window(), | 341 EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
342 internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), | 342 internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), |
343 controller->GetSystemModalLayoutManager(NULL)); | 343 controller->GetSystemModalLayoutManager(NULL)); |
344 | 344 |
345 aura::Window* lock_container = | 345 aura::Window* lock_container = |
346 Shell::GetContainer(controller->root_window(), | 346 Shell::GetContainer(controller->root_window(), |
347 internal::kShellWindowId_LockScreenContainer); | 347 internal::kShellWindowId_LockScreenContainer); |
348 views::Widget* login_modal_widget = | 348 views::Widget* login_modal_widget = |
349 CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); | 349 CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); |
350 EXPECT_EQ(Shell::GetContainer(controller->root_window(), | 350 EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
351 internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), | 351 internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), |
352 controller->GetSystemModalLayoutManager( | 352 controller->GetSystemModalLayoutManager( |
353 login_modal_widget->GetNativeView())); | 353 login_modal_widget->GetNativeView())); |
354 login_modal_widget->Close(); | 354 login_modal_widget->Close(); |
355 | 355 |
356 // Configure user session environment. | 356 // Configure user session environment. |
357 SetUserLoggedIn(true); | 357 SetUserLoggedIn(true); |
358 SetSessionStarted(true); | 358 SetSessionStarted(true); |
359 EXPECT_EQ(user::LOGGED_IN_USER, | 359 EXPECT_EQ(user::LOGGED_IN_USER, |
360 shell->system_tray_delegate()->GetUserLoginStatus()); | 360 shell->system_tray_delegate()->GetUserLoginStatus()); |
361 EXPECT_TRUE(shell->delegate()->IsUserLoggedIn()); | 361 EXPECT_TRUE(shell->session_state_delegate()->HasActiveUser()); |
362 EXPECT_TRUE(shell->delegate()->IsSessionStarted()); | 362 EXPECT_TRUE(shell->session_state_delegate()->IsActiveUserSessionStarted()); |
363 EXPECT_EQ(Shell::GetContainer(controller->root_window(), | 363 EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
364 internal::kShellWindowId_SystemModalContainer)->layout_manager(), | 364 internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
365 controller->GetSystemModalLayoutManager(NULL)); | 365 controller->GetSystemModalLayoutManager(NULL)); |
366 | 366 |
367 views::Widget* session_modal_widget = | 367 views::Widget* session_modal_widget = |
368 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); | 368 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); |
369 EXPECT_EQ(Shell::GetContainer(controller->root_window(), | 369 EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
370 internal::kShellWindowId_SystemModalContainer)->layout_manager(), | 370 internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
371 controller->GetSystemModalLayoutManager( | 371 controller->GetSystemModalLayoutManager( |
372 session_modal_widget->GetNativeView())); | 372 session_modal_widget->GetNativeView())); |
(...skipping 21 matching lines...) Expand all Loading... |
394 Widget* w2 = | 394 Widget* w2 = |
395 Widget::CreateWindowWithParentAndBounds(NULL, | 395 Widget::CreateWindowWithParentAndBounds(NULL, |
396 w1->GetNativeWindow(), | 396 w1->GetNativeWindow(), |
397 gfx::Rect(0, 1, 150, 151)); | 397 gfx::Rect(0, 1, 150, 151)); |
398 w2->Show(); | 398 w2->Show(); |
399 EXPECT_TRUE(controller->IsImmersiveMode()); | 399 EXPECT_TRUE(controller->IsImmersiveMode()); |
400 } | 400 } |
401 | 401 |
402 } // namespace test | 402 } // namespace test |
403 } // namespace ash | 403 } // namespace ash |
OLD | NEW |