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

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

Issue 97013002: [Input View] Makes the input view window support window.resizeTo() and w3c visibility API its web c… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years 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 | Annotate | Revision Log
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 "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
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());
345
346 keyboard_window->SetBounds(gfx::Rect(100, 80));
347 EXPECT_EQ(180, keyboard_window->bounds().height());
348
349 proxy()->set_resizing_from_contents(true);
350 keyboard_window->SetBounds(gfx::Rect(100, 80));
351 EXPECT_EQ(80, keyboard_window->bounds().height());
352 }
353
337 class KeyboardControllerUsabilityTest : public KeyboardControllerTest { 354 class KeyboardControllerUsabilityTest : public KeyboardControllerTest {
338 public: 355 public:
339 KeyboardControllerUsabilityTest() {} 356 KeyboardControllerUsabilityTest() {}
340 virtual ~KeyboardControllerUsabilityTest() {} 357 virtual ~KeyboardControllerUsabilityTest() {}
341 358
342 virtual void SetUp() OVERRIDE { 359 virtual void SetUp() OVERRIDE {
343 CommandLine::ForCurrentProcess()->AppendSwitch( 360 CommandLine::ForCurrentProcess()->AppendSwitch(
344 switches::kKeyboardUsabilityExperiment); 361 switches::kKeyboardUsabilityExperiment);
345 KeyboardControllerTest::SetUp(); 362 KeyboardControllerTest::SetUp();
346 } 363 }
(...skipping 16 matching lines...) Expand all
363 380
364 EXPECT_TRUE(keyboard_container->IsVisible()); 381 EXPECT_TRUE(keyboard_container->IsVisible());
365 382
366 input_method->SetFocusedTextInputClient(&no_input_client); 383 input_method->SetFocusedTextInputClient(&no_input_client);
367 // Keyboard should not hide itself after lost focus. 384 // Keyboard should not hide itself after lost focus.
368 EXPECT_TRUE(keyboard_container->IsVisible()); 385 EXPECT_TRUE(keyboard_container->IsVisible());
369 EXPECT_FALSE(WillHideKeyboard()); 386 EXPECT_FALSE(WillHideKeyboard());
370 } 387 }
371 388
372 } // namespace keyboard 389 } // namespace keyboard
OLDNEW
« ui/keyboard/keyboard_controller.cc ('K') | « ui/keyboard/keyboard_controller_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698