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

Side by Side Diff: ui/keyboard/keyboard_controller_unittest.cc

Issue 1138873003: Restore virtual keyboard after switch back to FULL_WIDTH mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test Created 5 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 | « ui/keyboard/keyboard_controller.cc ('k') | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ui/keyboard/keyboard_controller.h" 5 #include "ui/keyboard/keyboard_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 SetFocus(&no_input_client); 456 SetFocus(&no_input_client);
457 base::MessageLoop::current()->Run(); 457 base::MessageLoop::current()->Run();
458 EXPECT_EQ(gfx::Rect(), notified_bounds()); 458 EXPECT_EQ(gfx::Rect(), notified_bounds());
459 EXPECT_EQ(3, number_of_calls()); 459 EXPECT_EQ(3, number_of_calls());
460 SetFocus(&input_client); 460 SetFocus(&input_client);
461 // In FLOATING mode, no overscroll or resize should be triggered. 461 // In FLOATING mode, no overscroll or resize should be triggered.
462 EXPECT_EQ(3, number_of_calls()); 462 EXPECT_EQ(3, number_of_calls());
463 EXPECT_EQ(gfx::Rect(), controller()->current_keyboard_bounds()); 463 EXPECT_EQ(gfx::Rect(), controller()->current_keyboard_bounds());
464 } 464 }
465 465
466 // Verify switch to FULL_WIDTH mode will move virtual keyboard to the right
467 // place and sets the correct overscroll.
468 TEST_F(KeyboardControllerTest, SwitchToFullWidthVirtualKeyboard) {
469 ui::DummyTextInputClient input_client(ui::TEXT_INPUT_TYPE_TEXT);
470
471 aura::Window* container(controller()->GetContainerWindow());
472 root_window()->AddChild(container);
473 gfx::Rect screen_bounds = root_window()->bounds();
474 keyboard::SetTouchKeyboardEnabled(true);
475 SetFocus(&input_client);
476
477 controller()->SetKeyboardMode(FLOATING);
478 EXPECT_EQ(gfx::Rect(), notified_bounds());
479 EXPECT_EQ(gfx::Rect(), controller()->current_keyboard_bounds());
480
481 controller()->SetKeyboardMode(FULL_WIDTH);
482 gfx::Rect expected_bounds(
483 0, screen_bounds.height() - kDefaultVirtualKeyboardHeight,
484 screen_bounds.width(), kDefaultVirtualKeyboardHeight);
485 EXPECT_EQ(expected_bounds, notified_bounds());
486 EXPECT_EQ(expected_bounds, controller()->current_keyboard_bounds());
487 }
488
466 TEST_F(KeyboardControllerTest, AlwaysVisibleWhenLocked) { 489 TEST_F(KeyboardControllerTest, AlwaysVisibleWhenLocked) {
467 ui::DummyTextInputClient input_client_0(ui::TEXT_INPUT_TYPE_TEXT); 490 ui::DummyTextInputClient input_client_0(ui::TEXT_INPUT_TYPE_TEXT);
468 ui::DummyTextInputClient input_client_1(ui::TEXT_INPUT_TYPE_TEXT); 491 ui::DummyTextInputClient input_client_1(ui::TEXT_INPUT_TYPE_TEXT);
469 ui::DummyTextInputClient no_input_client_0(ui::TEXT_INPUT_TYPE_NONE); 492 ui::DummyTextInputClient no_input_client_0(ui::TEXT_INPUT_TYPE_NONE);
470 ui::DummyTextInputClient no_input_client_1(ui::TEXT_INPUT_TYPE_NONE); 493 ui::DummyTextInputClient no_input_client_1(ui::TEXT_INPUT_TYPE_NONE);
471 494
472 aura::Window* keyboard_container(controller()->GetContainerWindow()); 495 aura::Window* keyboard_container(controller()->GetContainerWindow());
473 scoped_ptr<KeyboardContainerObserver> keyboard_container_observer( 496 scoped_ptr<KeyboardContainerObserver> keyboard_container_observer(
474 new KeyboardContainerObserver(keyboard_container)); 497 new KeyboardContainerObserver(keyboard_container));
475 root_window()->AddChild(keyboard_container); 498 root_window()->AddChild(keyboard_container);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 // Before hide animation finishes, show keyboard again. 615 // Before hide animation finishes, show keyboard again.
593 ShowKeyboard(); 616 ShowKeyboard();
594 RunAnimationForLayer(layer); 617 RunAnimationForLayer(layer);
595 EXPECT_TRUE(keyboard_container()->IsVisible()); 618 EXPECT_TRUE(keyboard_container()->IsVisible());
596 EXPECT_TRUE(keyboard_window()->IsVisible()); 619 EXPECT_TRUE(keyboard_window()->IsVisible());
597 EXPECT_EQ(1.0, layer->opacity()); 620 EXPECT_EQ(1.0, layer->opacity());
598 EXPECT_EQ(gfx::Transform(), layer->transform()); 621 EXPECT_EQ(gfx::Transform(), layer->transform());
599 } 622 }
600 623
601 } // namespace keyboard 624 } // namespace keyboard
OLDNEW
« no previous file with comments | « ui/keyboard/keyboard_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698