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

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 240443006: Remove native VK window height logic and wait for resizeTo to setup VK window height (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 6 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 | Annotate | Revision Log
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/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include "ash/session_state_delegate.h" 7 #include "ash/session_state_delegate.h"
8 #include "ash/shelf/shelf_layout_manager.h" 8 #include "ash/shelf/shelf_layout_manager.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) { 695 TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) {
696 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 696 aura::Window* root_window = Shell::GetPrimaryRootWindow();
697 aura::Window* keyboard_container = 697 aura::Window* keyboard_container =
698 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); 698 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer);
699 keyboard_container->Show(); 699 keyboard_container->Show();
700 keyboard::KeyboardController* controller = 700 keyboard::KeyboardController* controller =
701 keyboard::KeyboardController::GetInstance(); 701 keyboard::KeyboardController::GetInstance();
702 aura::Window* keyboard_window = controller->proxy()->GetKeyboardWindow(); 702 aura::Window* keyboard_window = controller->proxy()->GetKeyboardWindow();
703 keyboard_container->AddChild(keyboard_window); 703 keyboard_container->AddChild(keyboard_window);
704 keyboard_window->set_owned_by_parent(false); 704 keyboard_window->set_owned_by_parent(false);
705 gfx::Rect window_bounds = keyboard_container->bounds();
706 keyboard_window->SetBounds(gfx::Rect(
707 window_bounds.x(),
708 window_bounds.y() + window_bounds.height() - 100,
709 window_bounds.width(),
710 100));
705 keyboard_window->Show(); 711 keyboard_window->Show();
706 712
707 gfx::Rect before = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); 713 gfx::Rect before = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area();
708 714
709 // Notify keyboard bounds changing. 715 // Notify keyboard bounds changing.
710 controller->NotifyKeyboardBoundsChanging( 716 controller->NotifyKeyboardBoundsChanging(
711 controller->proxy()->GetKeyboardWindow()->bounds()); 717 controller->proxy()->GetKeyboardWindow()->bounds());
712 718
713 gfx::Rect after = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); 719 gfx::Rect after = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area();
714 EXPECT_LT(after, before); 720 EXPECT_LT(after, before);
715 721
716 // Mock a login user profile change to reinitialize the keyboard. 722 // Mock a login user profile change to reinitialize the keyboard.
717 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); 723 ash::Shell::GetInstance()->OnLoginUserProfilePrepared();
718 EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(), before); 724 EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(), before);
719 } 725 }
720 726
721 // Ensure that system modal dialogs do not block events targeted at the virtual 727 // Ensure that system modal dialogs do not block events targeted at the virtual
722 // keyboard. 728 // keyboard.
723 TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) { 729 TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) {
724 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 730 aura::Window* root_window = Shell::GetPrimaryRootWindow();
725 aura::Window* keyboard_container = 731 aura::Window* keyboard_container =
726 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); 732 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer);
727 ASSERT_TRUE(keyboard_container); 733 ASSERT_TRUE(keyboard_container);
728 keyboard_container->Show(); 734 keyboard_container->Show();
729 735
730 aura::Window* keyboard_window = keyboard::KeyboardController::GetInstance()-> 736 aura::Window* keyboard_window = keyboard::KeyboardController::GetInstance()->
731 proxy()->GetKeyboardWindow(); 737 proxy()->GetKeyboardWindow();
732 keyboard_container->AddChild(keyboard_window); 738 keyboard_container->AddChild(keyboard_window);
733 keyboard_window->set_owned_by_parent(false); 739 keyboard_window->set_owned_by_parent(false);
734 keyboard_window->SetBounds(gfx::Rect()); 740 gfx::Rect window_bounds = keyboard_container->bounds();
741 keyboard_window->SetBounds(gfx::Rect(
742 window_bounds.x(),
743 window_bounds.y() + window_bounds.height() - 100,
744 window_bounds.width(),
745 100));
735 keyboard_window->Show(); 746 keyboard_window->Show();
736 747
737 ui::test::TestEventHandler* handler = new ui::test::TestEventHandler; 748 ui::test::TestEventHandler* handler = new ui::test::TestEventHandler;
738 root_window->SetEventFilter(handler); 749 root_window->SetEventFilter(handler);
739 aura::test::EventGenerator root_window_event_generator(root_window); 750 aura::test::EventGenerator root_window_event_generator(root_window);
740 aura::test::EventGenerator keyboard_event_generator(root_window, 751 aura::test::EventGenerator keyboard_event_generator(root_window,
741 keyboard_window); 752 keyboard_window);
742 753
743 views::Widget* modal_widget = 754 views::Widget* modal_widget =
744 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); 755 CreateModalWidget(gfx::Rect(300, 10, 100, 100));
745 756
746 // Verify that mouse events to the root window are block with a visble modal 757 // Verify that mouse events to the root window are block with a visble modal
747 // dialog. 758 // dialog.
748 root_window_event_generator.ClickLeftButton(); 759 root_window_event_generator.ClickLeftButton();
749 EXPECT_EQ(0, handler->num_mouse_events()); 760 EXPECT_EQ(0, handler->num_mouse_events());
750 761
751 // Verify that event dispatch to the virtual keyboard is unblocked. 762 // Verify that event dispatch to the virtual keyboard is unblocked.
752 keyboard_event_generator.ClickLeftButton(); 763 keyboard_event_generator.ClickLeftButton();
753 EXPECT_EQ(1, handler->num_mouse_events() / 2); 764 EXPECT_EQ(1, handler->num_mouse_events() / 2);
754 765
755 modal_widget->Close(); 766 modal_widget->Close();
756 767
757 // Verify that mouse events are now unblocked to the root window. 768 // Verify that mouse events are now unblocked to the root window.
758 root_window_event_generator.ClickLeftButton(); 769 root_window_event_generator.ClickLeftButton();
759 EXPECT_EQ(2, handler->num_mouse_events() / 2); 770 EXPECT_EQ(2, handler->num_mouse_events() / 2);
760 } 771 }
761 772
762 } // namespace test 773 } // namespace test
763 } // namespace ash 774 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698