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

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

Issue 2801333002: mash: Run pre-unlock animation via SessionController (Closed)
Patch Set: rebase Created 3 years, 8 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
« no previous file with comments | « ash/wm/lock_state_controller.cc ('k') | chrome/browser/chromeos/login/lock/screen_locker.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 <memory> 7 #include <memory>
8 8
9 #include "ash/public/cpp/shell_window_ids.h" 9 #include "ash/public/cpp/shell_window_ids.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 transient_delegate->OpenTestWindowWithParent(main.get()); 351 transient_delegate->OpenTestWindowWithParent(main.get());
352 EXPECT_TRUE(wm::IsActiveWindow(transient)); 352 EXPECT_TRUE(wm::IsActiveWindow(transient));
353 e1.ClickLeftButton(); 353 e1.ClickLeftButton();
354 EXPECT_EQ(1, transient_delegate->mouse_presses()); 354 EXPECT_EQ(1, transient_delegate->mouse_presses());
355 355
356 for (int block_reason = FIRST_BLOCK_REASON; 356 for (int block_reason = FIRST_BLOCK_REASON;
357 block_reason < NUMBER_OF_BLOCK_REASONS; ++block_reason) { 357 block_reason < NUMBER_OF_BLOCK_REASONS; ++block_reason) {
358 // Create a window in the lock screen container and ensure that it receives 358 // Create a window in the lock screen container and ensure that it receives
359 // the mouse event instead of the modal window (crbug.com/110920). 359 // the mouse event instead of the modal window (crbug.com/110920).
360 BlockUserSession(static_cast<UserSessionBlockReason>(block_reason)); 360 BlockUserSession(static_cast<UserSessionBlockReason>(block_reason));
361
361 EventTestWindow* lock_delegate = new EventTestWindow(false); 362 EventTestWindow* lock_delegate = new EventTestWindow(false);
362 std::unique_ptr<aura::Window> lock(lock_delegate->OpenTestWindowWithParent( 363 std::unique_ptr<aura::Window> lock(lock_delegate->OpenTestWindowWithParent(
363 Shell::GetPrimaryRootWindowController()->GetContainer( 364 Shell::GetPrimaryRootWindowController()->GetContainer(
364 ash::kShellWindowId_LockScreenContainer))); 365 ash::kShellWindowId_LockScreenContainer)));
366 // BlockUserSession could change the workspace size. Make sure |lock| has
367 // the same bounds as |main| so that |lock| gets the generated mouse events.
368 lock->SetBounds(main->bounds());
365 EXPECT_TRUE(wm::IsActiveWindow(lock.get())); 369 EXPECT_TRUE(wm::IsActiveWindow(lock.get()));
366 e1.ClickLeftButton(); 370 e1.ClickLeftButton();
367 EXPECT_EQ(1, lock_delegate->mouse_presses()); 371 EXPECT_EQ(1, lock_delegate->mouse_presses());
368 372
369 // Make sure that a modal container created by the lock screen can still 373 // Make sure that a modal container created by the lock screen can still
370 // receive mouse events. 374 // receive mouse events.
371 EventTestWindow* lock_modal_delegate = new EventTestWindow(true); 375 EventTestWindow* lock_modal_delegate = new EventTestWindow(true);
372 aura::Window* lock_modal = 376 aura::Window* lock_modal =
373 lock_modal_delegate->OpenTestWindowWithParent(lock.get()); 377 lock_modal_delegate->OpenTestWindowWithParent(lock.get());
374 EXPECT_TRUE(wm::IsActiveWindow(lock_modal)); 378 EXPECT_TRUE(wm::IsActiveWindow(lock_modal));
375 e1.ClickLeftButton(); 379 e1.ClickLeftButton();
376 // Verify that none of the other containers received any more mouse presses. 380 // Verify that none of the other containers received any more mouse presses.
377 EXPECT_EQ(1, lock_modal_delegate->mouse_presses()); 381 EXPECT_EQ(1, lock_modal_delegate->mouse_presses());
378 EXPECT_EQ(1, lock_delegate->mouse_presses()); 382 EXPECT_EQ(1, lock_delegate->mouse_presses());
379 EXPECT_EQ(1, main_delegate->mouse_presses()); 383 EXPECT_EQ(1, main_delegate->mouse_presses());
380 EXPECT_EQ(1, transient_delegate->mouse_presses()); 384 EXPECT_EQ(1, transient_delegate->mouse_presses());
385
386 // Close |lock| before unlocking so that Shell::OnLockStateChanged does
387 // not DCHECK on finding a system modal in Lock layer when unlocked.
388 lock.reset();
389
381 UnblockUserSession(); 390 UnblockUserSession();
382 } 391 }
383 } 392 }
384 393
385 TEST_F(SystemModalContainerLayoutManagerTest, ModalTransientChildEvents) { 394 TEST_F(SystemModalContainerLayoutManagerTest, ModalTransientChildEvents) {
386 // Create a normal window and attempt to receive a click event. 395 // Create a normal window and attempt to receive a click event.
387 EventTestWindow* main_delegate = new EventTestWindow(false); 396 EventTestWindow* main_delegate = new EventTestWindow(false);
388 std::unique_ptr<aura::Window> main( 397 std::unique_ptr<aura::Window> main(
389 main_delegate->OpenTestWindowWithContext(CurrentContext())); 398 main_delegate->OpenTestWindowWithContext(CurrentContext()));
390 EXPECT_TRUE(wm::IsActiveWindow(main.get())); 399 EXPECT_TRUE(wm::IsActiveWindow(main.get()));
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 TestWindow::CloseTestWindow(lock_modal_window.release()); 583 TestWindow::CloseTestWindow(lock_modal_window.release());
575 584
576 // Normal system modal window while blocked, but it belongs to the normal 585 // Normal system modal window while blocked, but it belongs to the normal
577 // window. Shouldn't show blocked system modal background, but normal. 586 // window. Shouldn't show blocked system modal background, but normal.
578 std::unique_ptr<aura::Window> modal_window( 587 std::unique_ptr<aura::Window> modal_window(
579 OpenTestWindowWithParent(parent.get(), true)); 588 OpenTestWindowWithParent(parent.get(), true));
580 modal_window->Show(); 589 modal_window->Show();
581 EXPECT_TRUE(AllRootWindowsHaveModalBackgrounds()); 590 EXPECT_TRUE(AllRootWindowsHaveModalBackgrounds());
582 EXPECT_FALSE(AllRootWindowsHaveLockedModalBackgrounds()); 591 EXPECT_FALSE(AllRootWindowsHaveLockedModalBackgrounds());
583 TestWindow::CloseTestWindow(modal_window.release()); 592 TestWindow::CloseTestWindow(modal_window.release());
593
594 // Close |lock_parent| before unlocking so that Shell::OnLockStateChanged
595 // does not DCHECK on finding a system modal in Lock layer when unlocked.
596 lock_parent.reset();
597
584 UnblockUserSession(); 598 UnblockUserSession();
585 // Here we should check the behavior of the locked system modal dialog when 599 // Here we should check the behavior of the locked system modal dialog when
586 // unlocked, but such case isn't handled very well right now. 600 // unlocked, but such case isn't handled very well right now.
587 // See crbug.com/157660 601 // See crbug.com/157660
588 // TODO(mukai): add the test case when the bug is fixed. 602 // TODO(mukai): add the test case when the bug is fixed.
589 } 603 }
590 } 604 }
591 605
592 TEST_F(SystemModalContainerLayoutManagerTest, MultiDisplays) { 606 TEST_F(SystemModalContainerLayoutManagerTest, MultiDisplays) {
593 UpdateDisplay("500x500,500x500"); 607 UpdateDisplay("500x500,500x500");
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 922
909 // Make sure that events are properly blocked in multi displays environment. 923 // Make sure that events are properly blocked in multi displays environment.
910 TEST_F(SystemModalContainerLayoutManagerTest, BlockEventsInMultiDisplays) { 924 TEST_F(SystemModalContainerLayoutManagerTest, BlockEventsInMultiDisplays) {
911 UpdateDisplay("500x500, 500x500"); 925 UpdateDisplay("500x500, 500x500");
912 InputTestDelegate delegate; 926 InputTestDelegate delegate;
913 delegate.RunTest(this); 927 delegate.RunTest(this);
914 } 928 }
915 929
916 } // namespace test 930 } // namespace test
917 } // namespace ash 931 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/lock_state_controller.cc ('k') | chrome/browser/chromeos/login/lock/screen_locker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698