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

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 1182523003: Removes TextInputFocusManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit per comment. Created 5 years, 6 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 | « no previous file | ash/wm/workspace/workspace_layout_manager_unittest.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/display/display_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/session/session_state_delegate.h" 8 #include "ash/session/session_state_delegate.h"
9 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 12 matching lines...) Expand all
23 #include "ui/aura/client/window_tree_client.h" 23 #include "ui/aura/client/window_tree_client.h"
24 #include "ui/aura/env.h" 24 #include "ui/aura/env.h"
25 #include "ui/aura/test/test_window_delegate.h" 25 #include "ui/aura/test/test_window_delegate.h"
26 #include "ui/aura/test/test_windows.h" 26 #include "ui/aura/test/test_windows.h"
27 #include "ui/aura/window.h" 27 #include "ui/aura/window.h"
28 #include "ui/aura/window_event_dispatcher.h" 28 #include "ui/aura/window_event_dispatcher.h"
29 #include "ui/aura/window_tracker.h" 29 #include "ui/aura/window_tracker.h"
30 #include "ui/base/ime/dummy_text_input_client.h" 30 #include "ui/base/ime/dummy_text_input_client.h"
31 #include "ui/base/ime/input_method.h" 31 #include "ui/base/ime/input_method.h"
32 #include "ui/base/ime/text_input_client.h" 32 #include "ui/base/ime/text_input_client.h"
33 #include "ui/base/ime/text_input_focus_manager.h"
34 #include "ui/base/ui_base_switches_util.h"
35 #include "ui/events/test/event_generator.h" 33 #include "ui/events/test/event_generator.h"
36 #include "ui/events/test/test_event_handler.h" 34 #include "ui/events/test/test_event_handler.h"
37 #include "ui/keyboard/keyboard_controller_proxy.h" 35 #include "ui/keyboard/keyboard_controller_proxy.h"
38 #include "ui/keyboard/keyboard_switches.h" 36 #include "ui/keyboard/keyboard_switches.h"
39 #include "ui/keyboard/keyboard_util.h" 37 #include "ui/keyboard/keyboard_util.h"
40 #include "ui/views/controls/menu/menu_controller.h" 38 #include "ui/views/controls/menu/menu_controller.h"
41 #include "ui/views/widget/widget.h" 39 #include "ui/views/widget/widget.h"
42 #include "ui/views/widget/widget_delegate.h" 40 #include "ui/views/widget/widget_delegate.h"
43 41
44 using aura::Window; 42 using aura::Window;
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 // Ensure that the visible area for scrolling the text caret excludes the 893 // Ensure that the visible area for scrolling the text caret excludes the
896 // region occluded by the on-screen keyboard. 894 // region occluded by the on-screen keyboard.
897 TEST_F(VirtualKeyboardRootWindowControllerTest, EnsureCaretInWorkArea) { 895 TEST_F(VirtualKeyboardRootWindowControllerTest, EnsureCaretInWorkArea) {
898 keyboard::KeyboardController* keyboard_controller = 896 keyboard::KeyboardController* keyboard_controller =
899 keyboard::KeyboardController::GetInstance(); 897 keyboard::KeyboardController::GetInstance();
900 keyboard::KeyboardControllerProxy* proxy = keyboard_controller->proxy(); 898 keyboard::KeyboardControllerProxy* proxy = keyboard_controller->proxy();
901 899
902 MockTextInputClient text_input_client; 900 MockTextInputClient text_input_client;
903 ui::InputMethod* input_method = proxy->GetInputMethod(); 901 ui::InputMethod* input_method = proxy->GetInputMethod();
904 ASSERT_TRUE(input_method); 902 ASSERT_TRUE(input_method);
905 if (switches::IsTextInputFocusManagerEnabled()) { 903 input_method->SetFocusedTextInputClient(&text_input_client);
906 ui::TextInputFocusManager::GetInstance()->FocusTextInputClient(
907 &text_input_client);
908 } else {
909 input_method->SetFocusedTextInputClient(&text_input_client);
910 }
911 904
912 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 905 aura::Window* root_window = Shell::GetPrimaryRootWindow();
913 aura::Window* keyboard_container = 906 aura::Window* keyboard_container =
914 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); 907 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer);
915 ASSERT_TRUE(keyboard_container); 908 ASSERT_TRUE(keyboard_container);
916 keyboard_container->Show(); 909 keyboard_container->Show();
917 910
918 const int keyboard_height = 100; 911 const int keyboard_height = 100;
919 aura::Window* keyboard_window =proxy->GetKeyboardWindow(); 912 aura::Window* keyboard_window =proxy->GetKeyboardWindow();
920 keyboard_container->AddChild(keyboard_window); 913 keyboard_container->AddChild(keyboard_window);
921 keyboard_window->set_owned_by_parent(false); 914 keyboard_window->set_owned_by_parent(false);
922 keyboard_window->SetBounds(keyboard::FullWidthKeyboardBoundsFromRootBounds( 915 keyboard_window->SetBounds(keyboard::FullWidthKeyboardBoundsFromRootBounds(
923 root_window->bounds(), keyboard_height)); 916 root_window->bounds(), keyboard_height));
924 917
925 proxy->EnsureCaretInWorkArea(); 918 proxy->EnsureCaretInWorkArea();
926 ASSERT_EQ(root_window->bounds().width(), 919 ASSERT_EQ(root_window->bounds().width(),
927 text_input_client.visible_rect().width()); 920 text_input_client.visible_rect().width());
928 ASSERT_EQ(root_window->bounds().height() - keyboard_height, 921 ASSERT_EQ(root_window->bounds().height() - keyboard_height,
929 text_input_client.visible_rect().height()); 922 text_input_client.visible_rect().height());
930 923
931 if (switches::IsTextInputFocusManagerEnabled()) { 924 input_method->SetFocusedTextInputClient(NULL);
932 ui::TextInputFocusManager::GetInstance()->BlurTextInputClient(
933 &text_input_client);
934 } else {
935 input_method->SetFocusedTextInputClient(NULL);
936 }
937 } 925 }
938 926
939 // Tests that the virtual keyboard does not block context menus. The virtual 927 // Tests that the virtual keyboard does not block context menus. The virtual
940 // keyboard should appear in front of most content, but not context menus. See 928 // keyboard should appear in front of most content, but not context menus. See
941 // crbug/377180. 929 // crbug/377180.
942 TEST_F(VirtualKeyboardRootWindowControllerTest, ZOrderTest) { 930 TEST_F(VirtualKeyboardRootWindowControllerTest, ZOrderTest) {
943 UpdateDisplay("800x600"); 931 UpdateDisplay("800x600");
944 keyboard::KeyboardController* keyboard_controller = 932 keyboard::KeyboardController* keyboard_controller =
945 keyboard::KeyboardController::GetInstance(); 933 keyboard::KeyboardController::GetInstance();
946 keyboard::KeyboardControllerProxy* proxy = keyboard_controller->proxy(); 934 keyboard::KeyboardControllerProxy* proxy = keyboard_controller->proxy();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 keyboard_controller->proxy()->GetKeyboardWindow()->SetBounds( 1032 keyboard_controller->proxy()->GetKeyboardWindow()->SetBounds(
1045 gfx::Rect(0, 400, 800, 200)); 1033 gfx::Rect(0, 400, 800, 200));
1046 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); 1034 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString());
1047 1035
1048 UpdateDisplay("600x800"); 1036 UpdateDisplay("600x800");
1049 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); 1037 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString());
1050 } 1038 }
1051 1039
1052 } // namespace test 1040 } // namespace test
1053 } // namespace ash 1041 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698