OLD | NEW |
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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 controller()->HideKeyboard(KeyboardController::HIDE_REASON_AUTOMATIC); | 605 controller()->HideKeyboard(KeyboardController::HIDE_REASON_AUTOMATIC); |
606 // Before hide animation finishes, show keyboard again. | 606 // Before hide animation finishes, show keyboard again. |
607 ShowKeyboard(); | 607 ShowKeyboard(); |
608 RunAnimationForLayer(layer); | 608 RunAnimationForLayer(layer); |
609 EXPECT_TRUE(keyboard_container()->IsVisible()); | 609 EXPECT_TRUE(keyboard_container()->IsVisible()); |
610 EXPECT_TRUE(keyboard_window()->IsVisible()); | 610 EXPECT_TRUE(keyboard_window()->IsVisible()); |
611 EXPECT_EQ(1.0, layer->opacity()); | 611 EXPECT_EQ(1.0, layer->opacity()); |
612 EXPECT_EQ(gfx::Transform(), layer->transform()); | 612 EXPECT_EQ(gfx::Transform(), layer->transform()); |
613 } | 613 } |
614 | 614 |
| 615 // Test for crbug.com/568274. |
| 616 TEST_F(KeyboardControllerTest, FloatingKeyboardShowOnFirstTap) { |
| 617 aura::Window* container(controller()->GetContainerWindow()); |
| 618 aura::Window* keyboard(ui()->GetKeyboardWindow()); |
| 619 root_window()->AddChild(container); |
| 620 controller()->SetKeyboardMode(FLOATING); |
| 621 container->AddChild(keyboard); |
| 622 // Mock focus on an input field. |
| 623 ui()->GetInputMethod()->ShowImeIfNeeded(); |
| 624 // Mock set keyboard size from javascript side. In floating mode, virtual |
| 625 // keyboard's size is decided by client. |
| 626 gfx::Rect new_bounds(0, 50, 50, 50); |
| 627 keyboard->SetBounds(new_bounds); |
| 628 ASSERT_EQ(new_bounds, container->bounds()); |
| 629 EXPECT_TRUE(keyboard->IsVisible()); |
| 630 EXPECT_TRUE(container->IsVisible()); |
| 631 } |
| 632 |
615 } // namespace keyboard | 633 } // namespace keyboard |
OLD | NEW |