| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 root_window()->AddChild(keyboard_container); | 560 root_window()->AddChild(keyboard_container); |
| 561 keyboard_container->Show(); | 561 keyboard_container->Show(); |
| 562 | 562 |
| 563 ShowKeyboard(); | 563 ShowKeyboard(); |
| 564 EXPECT_TRUE(keyboard_container->IsVisible()); | 564 EXPECT_TRUE(keyboard_container->IsVisible()); |
| 565 EXPECT_FALSE(IsKeyboardClosed()); | 565 EXPECT_FALSE(IsKeyboardClosed()); |
| 566 | 566 |
| 567 root_window()->RemoveChild(keyboard_container); | 567 root_window()->RemoveChild(keyboard_container); |
| 568 ResetController(); | 568 ResetController(); |
| 569 EXPECT_TRUE(IsKeyboardClosed()); | 569 EXPECT_TRUE(IsKeyboardClosed()); |
| 570 keyboard::SetAccessibilityKeyboardEnabled(false); |
| 570 } | 571 } |
| 571 | 572 |
| 572 class KeyboardControllerAnimationTest : public KeyboardControllerTest { | 573 class KeyboardControllerAnimationTest : public KeyboardControllerTest { |
| 573 public: | 574 public: |
| 574 KeyboardControllerAnimationTest() {} | 575 KeyboardControllerAnimationTest() {} |
| 575 ~KeyboardControllerAnimationTest() override {} | 576 ~KeyboardControllerAnimationTest() override {} |
| 576 | 577 |
| 577 void SetUp() override { | 578 void SetUp() override { |
| 578 // We cannot short-circuit animations for this test. | 579 // We cannot short-circuit animations for this test. |
| 579 ui::ScopedAnimationDurationScaleMode test_duration_mode( | 580 ui::ScopedAnimationDurationScaleMode test_duration_mode( |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 EXPECT_EQ(1.0, layer->opacity()); | 669 EXPECT_EQ(1.0, layer->opacity()); |
| 669 EXPECT_EQ(gfx::Transform(), layer->transform()); | 670 EXPECT_EQ(gfx::Transform(), layer->transform()); |
| 670 keyboard::SetAccessibilityKeyboardEnabled(false); | 671 keyboard::SetAccessibilityKeyboardEnabled(false); |
| 671 } | 672 } |
| 672 | 673 |
| 673 // Test for crbug.com/568274. | 674 // Test for crbug.com/568274. |
| 674 TEST_F(KeyboardControllerTest, FloatingKeyboardShowOnFirstTap) { | 675 TEST_F(KeyboardControllerTest, FloatingKeyboardShowOnFirstTap) { |
| 675 aura::Window* container(controller()->GetContainerWindow()); | 676 aura::Window* container(controller()->GetContainerWindow()); |
| 676 aura::Window* keyboard(ui()->GetKeyboardWindow()); | 677 aura::Window* keyboard(ui()->GetKeyboardWindow()); |
| 677 root_window()->AddChild(container); | 678 root_window()->AddChild(container); |
| 679 |
| 680 keyboard::SetTouchKeyboardEnabled(true); |
| 678 controller()->SetKeyboardMode(FLOATING); | 681 controller()->SetKeyboardMode(FLOATING); |
| 679 container->AddChild(keyboard); | 682 container->AddChild(keyboard); |
| 680 // Mock focus on an input field. | 683 // Mock focus on an input field. |
| 681 ui()->GetInputMethod()->ShowImeIfNeeded(); | 684 ui()->GetInputMethod()->ShowImeIfNeeded(); |
| 682 // Mock set keyboard size from javascript side. In floating mode, virtual | 685 // Mock set keyboard size from javascript side. In floating mode, virtual |
| 683 // keyboard's size is decided by client. | 686 // keyboard's size is decided by client. |
| 684 gfx::Rect new_bounds(0, 50, 50, 50); | 687 gfx::Rect new_bounds(0, 50, 50, 50); |
| 685 keyboard->SetBounds(new_bounds); | 688 keyboard->SetBounds(new_bounds); |
| 686 ASSERT_EQ(new_bounds, container->bounds()); | 689 ASSERT_EQ(new_bounds, container->bounds()); |
| 687 EXPECT_TRUE(keyboard->IsVisible()); | 690 EXPECT_TRUE(keyboard->IsVisible()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 700 gfx::Rect new_bounds(0, 0, 1280, 800); | 703 gfx::Rect new_bounds(0, 0, 1280, 800); |
| 701 ASSERT_NE(new_bounds, root_window()->bounds()); | 704 ASSERT_NE(new_bounds, root_window()->bounds()); |
| 702 EXPECT_EQ(1, number_of_calls()); | 705 EXPECT_EQ(1, number_of_calls()); |
| 703 root_window()->SetBounds(new_bounds); | 706 root_window()->SetBounds(new_bounds); |
| 704 EXPECT_EQ(2, number_of_calls()); | 707 EXPECT_EQ(2, number_of_calls()); |
| 705 MockRotateScreen(); | 708 MockRotateScreen(); |
| 706 EXPECT_EQ(3, number_of_calls()); | 709 EXPECT_EQ(3, number_of_calls()); |
| 707 } | 710 } |
| 708 | 711 |
| 709 } // namespace keyboard | 712 } // namespace keyboard |
| OLD | NEW |