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

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: 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
« no previous file with comments | « no previous file | ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.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/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 10 matching lines...) Expand all
21 #include "ui/aura/env.h" 21 #include "ui/aura/env.h"
22 #include "ui/aura/test/event_generator.h" 22 #include "ui/aura/test/event_generator.h"
23 #include "ui/aura/test/test_window_delegate.h" 23 #include "ui/aura/test/test_window_delegate.h"
24 #include "ui/aura/test/test_windows.h" 24 #include "ui/aura/test/test_windows.h"
25 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
26 #include "ui/aura/window_event_dispatcher.h" 26 #include "ui/aura/window_event_dispatcher.h"
27 #include "ui/aura/window_tracker.h" 27 #include "ui/aura/window_tracker.h"
28 #include "ui/events/test/test_event_handler.h" 28 #include "ui/events/test/test_event_handler.h"
29 #include "ui/keyboard/keyboard_controller_proxy.h" 29 #include "ui/keyboard/keyboard_controller_proxy.h"
30 #include "ui/keyboard/keyboard_switches.h" 30 #include "ui/keyboard/keyboard_switches.h"
31 #include "ui/keyboard/keyboard_util.h"
31 #include "ui/views/controls/menu/menu_controller.h" 32 #include "ui/views/controls/menu/menu_controller.h"
32 #include "ui/views/widget/widget.h" 33 #include "ui/views/widget/widget.h"
33 #include "ui/views/widget/widget_delegate.h" 34 #include "ui/views/widget/widget_delegate.h"
34 35
35 using aura::Window; 36 using aura::Window;
36 using views::Widget; 37 using views::Widget;
37 38
38 namespace ash { 39 namespace ash {
39 namespace { 40 namespace {
40 41
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) { 696 TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) {
696 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 697 aura::Window* root_window = Shell::GetPrimaryRootWindow();
697 aura::Window* keyboard_container = 698 aura::Window* keyboard_container =
698 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); 699 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer);
699 keyboard_container->Show(); 700 keyboard_container->Show();
700 keyboard::KeyboardController* controller = 701 keyboard::KeyboardController* controller =
701 keyboard::KeyboardController::GetInstance(); 702 keyboard::KeyboardController::GetInstance();
702 aura::Window* keyboard_window = controller->proxy()->GetKeyboardWindow(); 703 aura::Window* keyboard_window = controller->proxy()->GetKeyboardWindow();
703 keyboard_container->AddChild(keyboard_window); 704 keyboard_container->AddChild(keyboard_window);
704 keyboard_window->set_owned_by_parent(false); 705 keyboard_window->set_owned_by_parent(false);
706 keyboard_window->SetBounds(keyboard::KeyboardBoundsFromWindowBounds(
707 keyboard_container->bounds(), 100));
705 keyboard_window->Show(); 708 keyboard_window->Show();
706 709
707 gfx::Rect before = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); 710 gfx::Rect before = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area();
708 711
709 // Notify keyboard bounds changing. 712 // Notify keyboard bounds changing.
710 controller->NotifyKeyboardBoundsChanging( 713 controller->NotifyKeyboardBoundsChanging(
711 controller->proxy()->GetKeyboardWindow()->bounds()); 714 controller->proxy()->GetKeyboardWindow()->bounds());
712 715
713 gfx::Rect after = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); 716 gfx::Rect after = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area();
714 EXPECT_LT(after, before); 717 EXPECT_LT(after, before);
715 718
716 // Mock a login user profile change to reinitialize the keyboard. 719 // Mock a login user profile change to reinitialize the keyboard.
717 ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); 720 ash::Shell::GetInstance()->OnLoginUserProfilePrepared();
718 EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(), before); 721 EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(), before);
719 } 722 }
720 723
721 // Ensure that system modal dialogs do not block events targeted at the virtual 724 // Ensure that system modal dialogs do not block events targeted at the virtual
722 // keyboard. 725 // keyboard.
723 TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) { 726 TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) {
724 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 727 aura::Window* root_window = Shell::GetPrimaryRootWindow();
725 aura::Window* keyboard_container = 728 aura::Window* keyboard_container =
726 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); 729 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer);
727 ASSERT_TRUE(keyboard_container); 730 ASSERT_TRUE(keyboard_container);
728 keyboard_container->Show(); 731 keyboard_container->Show();
729 732
730 aura::Window* keyboard_window = keyboard::KeyboardController::GetInstance()-> 733 aura::Window* keyboard_window = keyboard::KeyboardController::GetInstance()->
731 proxy()->GetKeyboardWindow(); 734 proxy()->GetKeyboardWindow();
732 keyboard_container->AddChild(keyboard_window); 735 keyboard_container->AddChild(keyboard_window);
733 keyboard_window->set_owned_by_parent(false); 736 keyboard_window->set_owned_by_parent(false);
734 keyboard_window->SetBounds(gfx::Rect()); 737 keyboard_window->SetBounds(keyboard::KeyboardBoundsFromWindowBounds(
735 keyboard_window->Show(); 738 keyboard_container->bounds(), 100));
736
737 ui::test::TestEventHandler* handler = new ui::test::TestEventHandler; 739 ui::test::TestEventHandler* handler = new ui::test::TestEventHandler;
738 root_window->SetEventFilter(handler); 740 root_window->SetEventFilter(handler);
739 aura::test::EventGenerator root_window_event_generator(root_window); 741 aura::test::EventGenerator root_window_event_generator(root_window);
740 aura::test::EventGenerator keyboard_event_generator(root_window, 742 aura::test::EventGenerator keyboard_event_generator(root_window,
741 keyboard_window); 743 keyboard_window);
742 744
743 views::Widget* modal_widget = 745 views::Widget* modal_widget =
744 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); 746 CreateModalWidget(gfx::Rect(300, 10, 100, 100));
745 747
746 // Verify that mouse events to the root window are block with a visble modal 748 // Verify that mouse events to the root window are block with a visble modal
747 // dialog. 749 // dialog.
748 root_window_event_generator.ClickLeftButton(); 750 root_window_event_generator.ClickLeftButton();
749 EXPECT_EQ(0, handler->num_mouse_events()); 751 EXPECT_EQ(0, handler->num_mouse_events());
750 752
751 // Verify that event dispatch to the virtual keyboard is unblocked. 753 // Verify that event dispatch to the virtual keyboard is unblocked.
752 keyboard_event_generator.ClickLeftButton(); 754 keyboard_event_generator.ClickLeftButton();
753 EXPECT_EQ(1, handler->num_mouse_events() / 2); 755 EXPECT_EQ(1, handler->num_mouse_events() / 2);
754 756
755 modal_widget->Close(); 757 modal_widget->Close();
756 758
757 // Verify that mouse events are now unblocked to the root window. 759 // Verify that mouse events are now unblocked to the root window.
758 root_window_event_generator.ClickLeftButton(); 760 root_window_event_generator.ClickLeftButton();
759 EXPECT_EQ(2, handler->num_mouse_events() / 2); 761 EXPECT_EQ(2, handler->num_mouse_events() / 2);
760 } 762 }
761 763
762 } // namespace test 764 } // namespace test
763 } // namespace ash 765 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698