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

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 2553603002: New accessibility virtual keyboard behavior in non-sticky mode. (Closed)
Patch Set: rebase Created 3 years, 7 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_window.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 <memory> 7 #include <memory>
8 8
9 #include "ash/public/cpp/config.h" 9 #include "ash/public/cpp/config.h"
10 #include "ash/public/cpp/shell_window_ids.h" 10 #include "ash/public/cpp/shell_window_ids.h"
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); 1057 Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer);
1058 ASSERT_TRUE(keyboard_container); 1058 ASSERT_TRUE(keyboard_container);
1059 keyboard_container->Show(); 1059 keyboard_container->Show();
1060 1060
1061 const int keyboard_height = 100; 1061 const int keyboard_height = 100;
1062 aura::Window* keyboard_window = ui->GetKeyboardWindow(); 1062 aura::Window* keyboard_window = ui->GetKeyboardWindow();
1063 keyboard_container->AddChild(keyboard_window); 1063 keyboard_container->AddChild(keyboard_window);
1064 keyboard_window->set_owned_by_parent(false); 1064 keyboard_window->set_owned_by_parent(false);
1065 keyboard_window->SetBounds(keyboard::FullWidthKeyboardBoundsFromRootBounds( 1065 keyboard_window->SetBounds(keyboard::FullWidthKeyboardBoundsFromRootBounds(
1066 root_window->bounds(), keyboard_height)); 1066 root_window->bounds(), keyboard_height));
1067 keyboard_window->Show();
1067 1068
1068 ui->EnsureCaretInWorkArea(); 1069 ui->EnsureCaretInWorkArea();
1069 ASSERT_EQ(root_window->bounds().width(), 1070 ASSERT_EQ(root_window->bounds().width(),
1070 text_input_client.caret_exclude_rect().width()); 1071 text_input_client.caret_exclude_rect().width());
1071 ASSERT_EQ(keyboard_height, text_input_client.caret_exclude_rect().height()); 1072 ASSERT_EQ(keyboard_height, text_input_client.caret_exclude_rect().height());
1072 1073
1073 input_method->SetFocusedTextInputClient(NULL); 1074 input_method->SetFocusedTextInputClient(nullptr);
1074 } 1075 }
1075 1076
1076 TEST_F(VirtualKeyboardRootWindowControllerTest, 1077 TEST_F(VirtualKeyboardRootWindowControllerTest,
1077 EnsureCaretInWorkAreaWithMultipleDisplays) { 1078 EnsureCaretInWorkAreaWithMultipleDisplays) {
1078 // TODO: fails in mash. http://crbug.com/695640. 1079 // TODO: fails in mash. http://crbug.com/695640.
1079 if (Shell::GetAshConfig() == Config::MASH) 1080 if (Shell::GetAshConfig() == Config::MASH)
1080 return; 1081 return;
1081 1082
1082 UpdateDisplay("500x500,600x600"); 1083 UpdateDisplay("500x500,600x600");
1083 const int64_t primary_display_id = 1084 const int64_t primary_display_id =
(...skipping 20 matching lines...) Expand all
1104 // the secondary screen. 1105 // the secondary screen.
1105 aura::Window* keyboard_container = Shell::GetContainer( 1106 aura::Window* keyboard_container = Shell::GetContainer(
1106 primary_root_window, kShellWindowId_VirtualKeyboardContainer); 1107 primary_root_window, kShellWindowId_VirtualKeyboardContainer);
1107 ASSERT_TRUE(keyboard_container); 1108 ASSERT_TRUE(keyboard_container);
1108 keyboard_container->Show(); 1109 keyboard_container->Show();
1109 aura::Window* keyboard_window = ui->GetKeyboardWindow(); 1110 aura::Window* keyboard_window = ui->GetKeyboardWindow();
1110 keyboard_container->AddChild(keyboard_window); 1111 keyboard_container->AddChild(keyboard_window);
1111 keyboard_window->set_owned_by_parent(false); 1112 keyboard_window->set_owned_by_parent(false);
1112 keyboard_window->SetBounds(keyboard::FullWidthKeyboardBoundsFromRootBounds( 1113 keyboard_window->SetBounds(keyboard::FullWidthKeyboardBoundsFromRootBounds(
1113 primary_root_window->bounds(), keyboard_height)); 1114 primary_root_window->bounds(), keyboard_height));
1115 keyboard_window->Show();
1114 1116
1117 ui->EnsureCaretInWorkArea();
1115 EXPECT_TRUE(primary_root_window->GetBoundsInScreen().Contains( 1118 EXPECT_TRUE(primary_root_window->GetBoundsInScreen().Contains(
1116 text_input_client.caret_exclude_rect())); 1119 text_input_client.caret_exclude_rect()));
1120 EXPECT_EQ(primary_root_window->GetBoundsInScreen().width(),
1121 text_input_client.caret_exclude_rect().width());
1117 EXPECT_FALSE(secondary_root_window->GetBoundsInScreen().Contains( 1122 EXPECT_FALSE(secondary_root_window->GetBoundsInScreen().Contains(
1118 text_input_client.caret_exclude_rect())); 1123 text_input_client.caret_exclude_rect()));
1119 1124
1120 // Move the keyboard into the secondary display and check that the keyboard 1125 // Move the keyboard into the secondary display and check that the keyboard
1121 // doesn't cover the window on the primary screen. 1126 // doesn't cover the window on the primary screen.
1122 keyboard_controller->ShowKeyboardInDisplay(secondary_display_id); 1127 keyboard_controller->ShowKeyboardInDisplay(secondary_display_id);
1123 keyboard_window->SetBounds(keyboard::FullWidthKeyboardBoundsFromRootBounds( 1128 keyboard_window->SetBounds(keyboard::FullWidthKeyboardBoundsFromRootBounds(
1124 secondary_root_window->bounds(), keyboard_height)); 1129 secondary_root_window->bounds(), keyboard_height));
1125 1130
1126 ui->EnsureCaretInWorkArea(); 1131 ui->EnsureCaretInWorkArea();
1127 EXPECT_FALSE(primary_root_window->GetBoundsInScreen().Contains( 1132 EXPECT_FALSE(primary_root_window->GetBoundsInScreen().Contains(
1128 text_input_client.caret_exclude_rect())); 1133 text_input_client.caret_exclude_rect()));
1129 EXPECT_TRUE(secondary_root_window->GetBoundsInScreen().Contains( 1134 EXPECT_TRUE(secondary_root_window->GetBoundsInScreen().Contains(
1130 text_input_client.caret_exclude_rect())); 1135 text_input_client.caret_exclude_rect()));
1136 EXPECT_EQ(secondary_root_window->GetBoundsInScreen().width(),
1137 text_input_client.caret_exclude_rect().width());
1131 1138
1132 input_method->SetFocusedTextInputClient(nullptr); 1139 input_method->SetFocusedTextInputClient(nullptr);
1133 } 1140 }
1134 1141
1135 // Tests that the virtual keyboard does not block context menus. The virtual 1142 // Tests that the virtual keyboard does not block context menus. The virtual
1136 // keyboard should appear in front of most content, but not context menus. See 1143 // keyboard should appear in front of most content, but not context menus. See
1137 // crbug/377180. 1144 // crbug/377180.
1138 TEST_F(VirtualKeyboardRootWindowControllerTest, ZOrderTest) { 1145 TEST_F(VirtualKeyboardRootWindowControllerTest, ZOrderTest) {
1139 UpdateDisplay("800x600"); 1146 UpdateDisplay("800x600");
1140 keyboard::KeyboardController* keyboard_controller = 1147 keyboard::KeyboardController* keyboard_controller =
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( 1237 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds(
1231 gfx::Rect(0, 400, 800, 200)); 1238 gfx::Rect(0, 400, 800, 200));
1232 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); 1239 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString());
1233 1240
1234 UpdateDisplay("600x800"); 1241 UpdateDisplay("600x800");
1235 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); 1242 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString());
1236 } 1243 }
1237 1244
1238 } // namespace test 1245 } // namespace test
1239 } // namespace ash 1246 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698