Chromium Code Reviews| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/aura/client/focus_client.h" | 10 #include "ui/aura/client/focus_client.h" |
| 11 #include "ui/aura/layout_manager.h" | |
| 11 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
| 12 #include "ui/aura/test/aura_test_helper.h" | 13 #include "ui/aura/test/aura_test_helper.h" |
| 13 #include "ui/aura/test/event_generator.h" | 14 #include "ui/aura/test/event_generator.h" |
| 14 #include "ui/aura/test/test_window_delegate.h" | 15 #include "ui/aura/test/test_window_delegate.h" |
| 15 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 16 #include "ui/base/ime/input_method.h" | 17 #include "ui/base/ime/input_method.h" |
| 17 #include "ui/base/ime/input_method_factory.h" | 18 #include "ui/base/ime/input_method_factory.h" |
| 18 #include "ui/base/ime/text_input_client.h" | 19 #include "ui/base/ime/text_input_client.h" |
| 19 #include "ui/compositor/layer_type.h" | 20 #include "ui/compositor/layer_type.h" |
| 20 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 327 // Schedule to hide keyboard. | 328 // Schedule to hide keyboard. |
| 328 input_method->SetFocusedTextInputClient(&no_input_client_1); | 329 input_method->SetFocusedTextInputClient(&no_input_client_1); |
| 329 EXPECT_TRUE(WillHideKeyboard()); | 330 EXPECT_TRUE(WillHideKeyboard()); |
| 330 // Cancel keyboard hide. | 331 // Cancel keyboard hide. |
| 331 input_method->SetFocusedTextInputClient(&input_client_2); | 332 input_method->SetFocusedTextInputClient(&input_client_2); |
| 332 | 333 |
| 333 EXPECT_FALSE(WillHideKeyboard()); | 334 EXPECT_FALSE(WillHideKeyboard()); |
| 334 EXPECT_TRUE(keyboard_container->IsVisible()); | 335 EXPECT_TRUE(keyboard_container->IsVisible()); |
| 335 } | 336 } |
| 336 | 337 |
| 338 TEST_F(KeyboardControllerTest, KeyboardResizingFromContents) { | |
| 339 aura::Window* keyboard_container(controller()->GetContainerWindow()); | |
| 340 aura::Window* keyboard_window(proxy()->GetKeyboardWindow()); | |
| 341 keyboard_container->SetBounds(gfx::Rect(800, 600)); | |
| 342 keyboard_container->AddChild(keyboard_window); | |
| 343 | |
| 344 EXPECT_EQ(180, keyboard_window->bounds().height()); | |
|
sadrul
2013/12/05 07:54:55
Add some code here to verify that calling keyboard
Shu Chen
2013/12/05 08:21:04
Done.
| |
| 345 proxy()->set_resizing_from_contents(true); | |
| 346 keyboard_window->SetBounds(gfx::Rect(100, 80)); | |
| 347 EXPECT_EQ(80, keyboard_window->bounds().height()); | |
| 348 } | |
| 349 | |
| 337 class KeyboardControllerUsabilityTest : public KeyboardControllerTest { | 350 class KeyboardControllerUsabilityTest : public KeyboardControllerTest { |
| 338 public: | 351 public: |
| 339 KeyboardControllerUsabilityTest() {} | 352 KeyboardControllerUsabilityTest() {} |
| 340 virtual ~KeyboardControllerUsabilityTest() {} | 353 virtual ~KeyboardControllerUsabilityTest() {} |
| 341 | 354 |
| 342 virtual void SetUp() OVERRIDE { | 355 virtual void SetUp() OVERRIDE { |
| 343 CommandLine::ForCurrentProcess()->AppendSwitch( | 356 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 344 switches::kKeyboardUsabilityExperiment); | 357 switches::kKeyboardUsabilityExperiment); |
| 345 KeyboardControllerTest::SetUp(); | 358 KeyboardControllerTest::SetUp(); |
| 346 } | 359 } |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 363 | 376 |
| 364 EXPECT_TRUE(keyboard_container->IsVisible()); | 377 EXPECT_TRUE(keyboard_container->IsVisible()); |
| 365 | 378 |
| 366 input_method->SetFocusedTextInputClient(&no_input_client); | 379 input_method->SetFocusedTextInputClient(&no_input_client); |
| 367 // Keyboard should not hide itself after lost focus. | 380 // Keyboard should not hide itself after lost focus. |
| 368 EXPECT_TRUE(keyboard_container->IsVisible()); | 381 EXPECT_TRUE(keyboard_container->IsVisible()); |
| 369 EXPECT_FALSE(WillHideKeyboard()); | 382 EXPECT_FALSE(WillHideKeyboard()); |
| 370 } | 383 } |
| 371 | 384 |
| 372 } // namespace keyboard | 385 } // namespace keyboard |
| OLD | NEW |