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

Unified Diff: ui/keyboard/keyboard_controller_unittest.cc

Issue 2101023002: Fire OnKeyboardBoundsChanging event when Display metrics changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/keyboard/keyboard_layout_manager.cc » ('j') | ui/keyboard/keyboard_layout_manager.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/keyboard_controller_unittest.cc
diff --git a/ui/keyboard/keyboard_controller_unittest.cc b/ui/keyboard/keyboard_controller_unittest.cc
index aebc161ff5e1fe2e2d45f1897ffdceb39f078ee2..9b8f8b7822f83982d9ee7f7f7876909be533e540 100644
--- a/ui/keyboard/keyboard_controller_unittest.cc
+++ b/ui/keyboard/keyboard_controller_unittest.cc
@@ -206,11 +206,8 @@ class KeyboardControllerTest : public testing::Test,
void MockRotateScreen() {
const gfx::Rect root_bounds = root_window()->bounds();
- controller_->OnWindowBoundsChanged(root_window(), gfx::Rect(),
- gfx::Rect(0,
- 0,
- root_bounds.height(),
- root_bounds.width()));
+ root_window()->SetBounds(
+ gfx::Rect(0, 0, root_bounds.height(), root_bounds.width()));
}
protected:
@@ -275,7 +272,6 @@ TEST_F(KeyboardControllerTest, KeyboardSize) {
ASSERT_EQ(gfx::Rect(), initial_bounds);
VerifyKeyboardWindowSize(container, keyboard);
-
// In FULL_WIDTH mode, attempt to change window width or move window up from
// the bottom are ignored. Changing window height is supported.
gfx::Rect expected_bounds(0,
@@ -643,4 +639,22 @@ TEST_F(KeyboardControllerTest, FloatingKeyboardShowOnFirstTap) {
EXPECT_TRUE(container->IsVisible());
}
+TEST_F(KeyboardControllerTest, DisplayChangeShouldNotifyBoundsChange) {
+ ui::DummyTextInputClient input_client(ui::TEXT_INPUT_TYPE_TEXT);
+
+ aura::Window* container(controller()->GetContainerWindow());
+ root_window()->AddChild(container);
+
+ keyboard::SetTouchKeyboardEnabled(true);
+ controller()->SetKeyboardMode(FULL_WIDTH);
+ SetFocus(&input_client);
+ gfx::Rect new_bounds(0, 0, 1280, 800);
+ ASSERT_NE(new_bounds, root_window()->bounds());
+ EXPECT_EQ(1, number_of_calls());
+ root_window()->SetBounds(new_bounds);
+ EXPECT_EQ(2, number_of_calls());
+ MockRotateScreen();
+ EXPECT_EQ(3, number_of_calls());
+}
+
} // namespace keyboard
« no previous file with comments | « no previous file | ui/keyboard/keyboard_layout_manager.cc » ('j') | ui/keyboard/keyboard_layout_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698