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
3 // found in the LICENSE file.
6 #include "base/command_line.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/aura/client/focus_client.h"
11 #include "ui/aura/layout_manager.h"
12 #include "ui/aura/root_window.h"
13 #include "ui/aura/test/aura_test_helper.h"
14 #include "ui/aura/test/event_generator.h"
15 #include "ui/aura/test/test_window_delegate.h"
16 #include "ui/aura/window.h"
17 #include "ui/base/ime/input_method.h"
18 #include "ui/base/ime/input_method_factory.h"
19 #include "ui/base/ime/text_input_client.h"
20 #include "ui/compositor/layer_type.h"
21 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
22 #include "ui/compositor/test/layer_animator_test_controller.h"
23 #include "ui/gfx/rect.h"
24 #include "ui/keyboard/keyboard_controller.h"
25 #include "ui/keyboard/keyboard_controller_observer.h"
26 #include "ui/keyboard/keyboard_controller_proxy.h"
27 #include "ui/keyboard/keyboard_switches.h"
32 // Steps a layer animation until it is completed. Animations must be enabled.
33 void RunAnimationForLayer(ui::Layer* layer) {
34 // Animations must be enabled for stepping to work.
35 ASSERT_NE(ui::ScopedAnimationDurationScaleMode::duration_scale_mode(),
36 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION);
38 ui::LayerAnimatorTestController controller(layer->GetAnimator());
39 gfx::AnimationContainerElement* element = layer->GetAnimator();
40 // Multiple steps are required to complete complex animations.
41 // TODO(vollick): This should not be necessary. crbug.com/154017
42 while (controller.animator()->is_animating()) {
43 controller.StartThreadedAnimationsIfNeeded();
44 base::TimeTicks step_time = controller.animator()->last_step_time();
45 element->Step(step_time + base::TimeDelta::FromMilliseconds(1000));
49 // An event handler that focuses a window when it is clicked/touched on. This is
50 // used to match the focus manger behaviour in ash and views.
51 class TestFocusController : public ui::EventHandler {
53 explicit TestFocusController(aura::Window* root)
55 root_->AddPreTargetHandler(this);
58 virtual ~TestFocusController() {
59 root_->RemovePreTargetHandler(this);
63 // Overridden from ui::EventHandler:
64 virtual void OnEvent(ui::Event* event) OVERRIDE {
65 aura::Window* target = static_cast<aura::Window*>(event->target());
66 if (event->type() == ui::ET_MOUSE_PRESSED ||
67 event->type() == ui::ET_TOUCH_PRESSED) {
68 aura::client::GetFocusClient(target)->FocusWindow(target);
73 DISALLOW_COPY_AND_ASSIGN(TestFocusController);
76 class TestKeyboardControllerProxy : public KeyboardControllerProxy {
78 TestKeyboardControllerProxy()
79 : window_(new aura::Window(&delegate_)),
80 input_method_(ui::CreateInputMethod(NULL,
81 gfx::kNullAcceleratedWidget)) {
82 window_->Init(aura::WINDOW_LAYER_NOT_DRAWN);
83 window_->set_owned_by_parent(false);
86 virtual ~TestKeyboardControllerProxy() {
87 // Destroy the window before the delegate.
91 // Overridden from KeyboardControllerProxy:
92 virtual bool HasKeyboardWindow() const OVERRIDE { return true; }
93 virtual aura::Window* GetKeyboardWindow() OVERRIDE { return window_.get(); }
94 virtual content::BrowserContext* GetBrowserContext() OVERRIDE { return NULL; }
95 virtual ui::InputMethod* GetInputMethod() OVERRIDE {
96 return input_method_.get();
98 virtual void RequestAudioInput(content::WebContents* web_contents,
99 const content::MediaStreamRequest& request,
100 const content::MediaResponseCallback& callback) OVERRIDE { return; }
103 scoped_ptr<aura::Window> window_;
104 aura::test::TestWindowDelegate delegate_;
105 scoped_ptr<ui::InputMethod> input_method_;
107 DISALLOW_COPY_AND_ASSIGN(TestKeyboardControllerProxy);
110 // Keeps a count of all the events a window receives.
111 class EventObserver : public ui::EventHandler {
114 virtual ~EventObserver() {}
116 int GetEventCount(ui::EventType type) {
117 return event_counts_[type];
121 // Overridden from ui::EventHandler:
122 virtual void OnEvent(ui::Event* event) OVERRIDE {
123 ui::EventHandler::OnEvent(event);
124 event_counts_[event->type()]++;
127 std::map<ui::EventType, int> event_counts_;
128 DISALLOW_COPY_AND_ASSIGN(EventObserver);
131 class TestTextInputClient : public ui::TextInputClient {
133 explicit TestTextInputClient(ui::TextInputType type)
135 virtual ~TestTextInputClient() {}
138 // Overridden from ui::TextInputClient:
139 virtual void SetCompositionText(
140 const ui::CompositionText& composition) OVERRIDE {}
141 virtual void ConfirmCompositionText() OVERRIDE {}
142 virtual void ClearCompositionText() OVERRIDE {}
143 virtual void InsertText(const base::string16& text) OVERRIDE {}
144 virtual void InsertChar(base::char16 ch, int flags) OVERRIDE {}
145 virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE {
146 return static_cast<gfx::NativeWindow>(NULL);
148 virtual ui::TextInputType GetTextInputType() const OVERRIDE {
151 virtual ui::TextInputMode GetTextInputMode() const OVERRIDE {
152 return ui::TEXT_INPUT_MODE_DEFAULT;
154 virtual bool CanComposeInline() const OVERRIDE { return false; }
155 virtual gfx::Rect GetCaretBounds() const OVERRIDE { return gfx::Rect(); }
157 virtual bool GetCompositionCharacterBounds(
159 gfx::Rect* rect) const OVERRIDE {
162 virtual bool HasCompositionText() const OVERRIDE { return false; }
163 virtual bool GetTextRange(gfx::Range* range) const OVERRIDE { return false; }
164 virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE {
167 virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE {
170 virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE {
173 virtual bool DeleteRange(const gfx::Range& range) OVERRIDE { return false; }
174 virtual bool GetTextFromRange(const gfx::Range& range,
175 base::string16* text) const OVERRIDE {
178 virtual void OnInputMethodChanged() OVERRIDE {}
179 virtual bool ChangeTextDirectionAndLayoutAlignment(
180 base::i18n::TextDirection direction) OVERRIDE { return false; }
181 virtual void ExtendSelectionAndDelete(size_t before, size_t after) OVERRIDE {}
182 virtual void EnsureCaretInRect(const gfx::Rect& rect) OVERRIDE {}
183 virtual void OnCandidateWindowShown() OVERRIDE {}
184 virtual void OnCandidateWindowUpdated() OVERRIDE {}
185 virtual void OnCandidateWindowHidden() OVERRIDE {}
187 ui::TextInputType type_;
189 DISALLOW_COPY_AND_ASSIGN(TestTextInputClient);
192 class KeyboardContainerObserver : public aura::WindowObserver {
194 explicit KeyboardContainerObserver(aura::Window* window) : window_(window) {
195 window_->AddObserver(this);
197 virtual ~KeyboardContainerObserver() {
198 window_->RemoveObserver(this);
202 virtual void OnWindowVisibilityChanged(aura::Window* window,
203 bool visible) OVERRIDE {
205 base::MessageLoop::current()->Quit();
208 aura::Window* window_;
210 DISALLOW_COPY_AND_ASSIGN(KeyboardContainerObserver);
215 class KeyboardControllerTest : public testing::Test {
217 KeyboardControllerTest() {}
218 virtual ~KeyboardControllerTest() {}
220 virtual void SetUp() OVERRIDE {
221 aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
222 bool allow_test_contexts = true;
223 aura_test_helper_->SetUp(allow_test_contexts);
224 ui::SetUpInputMethodFactoryForTesting();
225 focus_controller_.reset(new TestFocusController(root_window()));
226 proxy_ = new TestKeyboardControllerProxy();
227 controller_.reset(new KeyboardController(proxy_));
230 virtual void TearDown() OVERRIDE {
232 focus_controller_.reset();
233 aura_test_helper_->TearDown();
236 aura::Window* root_window() { return aura_test_helper_->root_window(); }
237 KeyboardControllerProxy* proxy() { return proxy_; }
238 KeyboardController* controller() { return controller_.get(); }
240 void ShowKeyboard() {
241 TestTextInputClient test_text_input_client(ui::TEXT_INPUT_TYPE_TEXT);
242 SetFocus(&test_text_input_client);
246 void SetFocus(ui::TextInputClient* client) {
247 ui::InputMethod* input_method = proxy()->GetInputMethod();
248 input_method->SetFocusedTextInputClient(client);
249 if (client && client->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE)
250 input_method->ShowImeIfNeeded();
253 bool WillHideKeyboard() {
254 return controller_->WillHideKeyboard();
257 base::MessageLoopForUI message_loop_;
258 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_;
259 scoped_ptr<TestFocusController> focus_controller_;
262 KeyboardControllerProxy* proxy_;
263 scoped_ptr<KeyboardController> controller_;
265 DISALLOW_COPY_AND_ASSIGN(KeyboardControllerTest);
268 TEST_F(KeyboardControllerTest, KeyboardSize) {
269 aura::Window* container(controller()->GetContainerWindow());
270 gfx::Rect bounds(0, 0, 100, 100);
271 container->SetBounds(bounds);
273 const gfx::Rect& before_bounds = proxy()->GetKeyboardWindow()->bounds();
274 gfx::Rect new_bounds(
275 before_bounds.x(), before_bounds.y(),
276 before_bounds.width() / 2, before_bounds.height() / 2);
278 // The KeyboardController's LayoutManager shouldn't let this happen
279 proxy()->GetKeyboardWindow()->SetBounds(new_bounds);
280 ASSERT_EQ(before_bounds, proxy()->GetKeyboardWindow()->bounds());
283 // Tests that tapping/clicking inside the keyboard does not give it focus.
284 TEST_F(KeyboardControllerTest, ClickDoesNotFocusKeyboard) {
285 const gfx::Rect& root_bounds = root_window()->bounds();
286 aura::test::EventCountDelegate delegate;
287 scoped_ptr<aura::Window> window(new aura::Window(&delegate));
288 window->Init(aura::WINDOW_LAYER_NOT_DRAWN);
289 window->SetBounds(root_bounds);
290 root_window()->AddChild(window.get());
294 aura::Window* keyboard_container(controller()->GetContainerWindow());
295 keyboard_container->SetBounds(root_bounds);
297 root_window()->AddChild(keyboard_container);
298 keyboard_container->Show();
302 EXPECT_TRUE(window->IsVisible());
303 EXPECT_TRUE(keyboard_container->IsVisible());
304 EXPECT_TRUE(window->HasFocus());
305 EXPECT_FALSE(keyboard_container->HasFocus());
307 // Click on the keyboard. Make sure the keyboard receives the event, but does
309 EventObserver observer;
310 keyboard_container->AddPreTargetHandler(&observer);
312 aura::test::EventGenerator generator(root_window());
313 generator.MoveMouseTo(proxy()->GetKeyboardWindow()->bounds().CenterPoint());
314 generator.ClickLeftButton();
315 EXPECT_TRUE(window->HasFocus());
316 EXPECT_FALSE(keyboard_container->HasFocus());
317 EXPECT_EQ("0 0", delegate.GetMouseButtonCountsAndReset());
318 EXPECT_EQ(1, observer.GetEventCount(ui::ET_MOUSE_PRESSED));
319 EXPECT_EQ(1, observer.GetEventCount(ui::ET_MOUSE_RELEASED));
321 // Click outside of the keyboard. It should reach the window behind.
322 generator.MoveMouseTo(gfx::Point());
323 generator.ClickLeftButton();
324 EXPECT_EQ("1 1", delegate.GetMouseButtonCountsAndReset());
325 keyboard_container->RemovePreTargetHandler(&observer);
328 TEST_F(KeyboardControllerTest, EventHitTestingInContainer) {
329 const gfx::Rect& root_bounds = root_window()->bounds();
330 aura::test::EventCountDelegate delegate;
331 scoped_ptr<aura::Window> window(new aura::Window(&delegate));
332 window->Init(aura::WINDOW_LAYER_NOT_DRAWN);
333 window->SetBounds(root_bounds);
334 root_window()->AddChild(window.get());
338 aura::Window* keyboard_container(controller()->GetContainerWindow());
339 keyboard_container->SetBounds(root_bounds);
341 root_window()->AddChild(keyboard_container);
342 keyboard_container->Show();
346 EXPECT_TRUE(window->IsVisible());
347 EXPECT_TRUE(keyboard_container->IsVisible());
348 EXPECT_TRUE(window->HasFocus());
349 EXPECT_FALSE(keyboard_container->HasFocus());
351 // Make sure hit testing works correctly while the keyboard is visible.
352 aura::Window* keyboard_window = proxy()->GetKeyboardWindow();
353 ui::EventTarget* root = root_window();
354 ui::EventTargeter* targeter = root->GetEventTargeter();
355 gfx::Point location = keyboard_window->bounds().CenterPoint();
356 ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, location, location, ui::EF_NONE,
358 EXPECT_EQ(keyboard_window, targeter->FindTargetForEvent(root, &mouse1));
361 location.set_y(keyboard_window->bounds().y() - 5);
362 ui::MouseEvent mouse2(ui::ET_MOUSE_MOVED, location, location, ui::EF_NONE,
364 EXPECT_EQ(window.get(), targeter->FindTargetForEvent(root, &mouse2));
367 TEST_F(KeyboardControllerTest, VisibilityChangeWithTextInputTypeChange) {
368 const gfx::Rect& root_bounds = root_window()->bounds();
370 TestTextInputClient input_client_0(ui::TEXT_INPUT_TYPE_TEXT);
371 TestTextInputClient input_client_1(ui::TEXT_INPUT_TYPE_TEXT);
372 TestTextInputClient input_client_2(ui::TEXT_INPUT_TYPE_TEXT);
373 TestTextInputClient no_input_client_0(ui::TEXT_INPUT_TYPE_NONE);
374 TestTextInputClient no_input_client_1(ui::TEXT_INPUT_TYPE_NONE);
376 aura::Window* keyboard_container(controller()->GetContainerWindow());
377 scoped_ptr<KeyboardContainerObserver> keyboard_container_observer(
378 new KeyboardContainerObserver(keyboard_container));
379 keyboard_container->SetBounds(root_bounds);
380 root_window()->AddChild(keyboard_container);
382 SetFocus(&input_client_0);
384 EXPECT_TRUE(keyboard_container->IsVisible());
386 SetFocus(&no_input_client_0);
387 // Keyboard should not immediately hide itself. It is delayed to avoid layout
388 // flicker when the focus of input field quickly change.
389 EXPECT_TRUE(keyboard_container->IsVisible());
390 EXPECT_TRUE(WillHideKeyboard());
391 // Wait for hide keyboard to finish.
392 base::MessageLoop::current()->Run();
393 EXPECT_FALSE(keyboard_container->IsVisible());
395 SetFocus(&input_client_1);
396 EXPECT_TRUE(keyboard_container->IsVisible());
398 // Schedule to hide keyboard.
399 SetFocus(&no_input_client_1);
400 EXPECT_TRUE(WillHideKeyboard());
401 // Cancel keyboard hide.
402 SetFocus(&input_client_2);
404 EXPECT_FALSE(WillHideKeyboard());
405 EXPECT_TRUE(keyboard_container->IsVisible());
408 TEST_F(KeyboardControllerTest, AlwaysVisibleWhenLocked) {
409 const gfx::Rect& root_bounds = root_window()->bounds();
411 TestTextInputClient input_client_0(ui::TEXT_INPUT_TYPE_TEXT);
412 TestTextInputClient input_client_1(ui::TEXT_INPUT_TYPE_TEXT);
413 TestTextInputClient no_input_client_0(ui::TEXT_INPUT_TYPE_NONE);
414 TestTextInputClient no_input_client_1(ui::TEXT_INPUT_TYPE_NONE);
416 aura::Window* keyboard_container(controller()->GetContainerWindow());
417 scoped_ptr<KeyboardContainerObserver> keyboard_container_observer(
418 new KeyboardContainerObserver(keyboard_container));
419 keyboard_container->SetBounds(root_bounds);
420 root_window()->AddChild(keyboard_container);
422 SetFocus(&input_client_0);
424 EXPECT_TRUE(keyboard_container->IsVisible());
427 controller()->set_lock_keyboard(true);
429 SetFocus(&no_input_client_0);
430 // Keyboard should not try to hide itself as it is locked.
431 EXPECT_TRUE(keyboard_container->IsVisible());
432 EXPECT_FALSE(WillHideKeyboard());
434 SetFocus(&input_client_1);
435 EXPECT_TRUE(keyboard_container->IsVisible());
438 controller()->set_lock_keyboard(false);
440 // Keyboard should hide when focus on no input client.
441 SetFocus(&no_input_client_1);
442 EXPECT_TRUE(WillHideKeyboard());
444 // Wait for hide keyboard to finish.
445 base::MessageLoop::current()->Run();
446 EXPECT_FALSE(keyboard_container->IsVisible());
449 TEST_F(KeyboardControllerTest, KeyboardResizingFromContents) {
450 aura::Window* keyboard_container = controller()->GetContainerWindow();
451 aura::Window* keyboard_window = proxy()->GetKeyboardWindow();
452 keyboard_container->SetBounds(gfx::Rect(800, 600));
453 keyboard_container->AddChild(keyboard_window);
455 // Default keyboard size.
456 EXPECT_EQ(180, keyboard_window->bounds().height());
458 // Resizes from contents when flag is unset.
459 keyboard_window->SetBounds(gfx::Rect(100, 80));
460 EXPECT_EQ(180, keyboard_window->bounds().height());
462 // Resizes from contents when flag is set.
463 proxy()->set_resizing_from_contents(true);
464 keyboard_window->SetBounds(gfx::Rect(100, 80));
465 EXPECT_EQ(80, keyboard_window->bounds().height());
467 // Resizes from container when flag is set.
468 keyboard_container->SetBounds(gfx::Rect(400, 300));
469 EXPECT_EQ(80, keyboard_window->bounds().height());
471 // Resizes from container when flag is unset.
472 proxy()->set_resizing_from_contents(false);
473 keyboard_container->SetBounds(gfx::Rect(800, 600));
474 EXPECT_EQ(180, keyboard_window->bounds().height());
477 class KeyboardControllerAnimationTest : public KeyboardControllerTest,
478 public KeyboardControllerObserver {
480 KeyboardControllerAnimationTest() {}
481 virtual ~KeyboardControllerAnimationTest() {}
483 virtual void SetUp() OVERRIDE {
484 // We cannot short-circuit animations for this test.
485 ui::ScopedAnimationDurationScaleMode normal_duration_mode(
486 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
488 KeyboardControllerTest::SetUp();
490 const gfx::Rect& root_bounds = root_window()->bounds();
491 keyboard_container()->SetBounds(root_bounds);
492 root_window()->AddChild(keyboard_container());
493 controller()->AddObserver(this);
496 virtual void TearDown() OVERRIDE {
497 controller()->RemoveObserver(this);
498 KeyboardControllerTest::TearDown();
502 // KeyboardControllerObserver overrides
503 virtual void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) OVERRIDE {
504 notified_bounds_ = new_bounds;
507 const gfx::Rect& notified_bounds() { return notified_bounds_; }
509 aura::Window* keyboard_container() {
510 return controller()->GetContainerWindow();
513 aura::Window* keyboard_window() {
514 return proxy()->GetKeyboardWindow();
518 gfx::Rect notified_bounds_;
520 DISALLOW_COPY_AND_ASSIGN(KeyboardControllerAnimationTest);
523 // Tests virtual keyboard has correct show and hide animation.
524 TEST_F(KeyboardControllerAnimationTest, ContainerAnimation) {
525 ui::Layer* layer = keyboard_container()->layer();
528 // Keyboard container and window should immediately become visible before
530 EXPECT_TRUE(keyboard_container()->IsVisible());
531 EXPECT_TRUE(keyboard_window()->IsVisible());
532 float show_start_opacity = layer->opacity();
533 gfx::Transform transform;
534 transform.Translate(0, keyboard_window()->bounds().height());
535 EXPECT_EQ(transform, layer->transform());
536 EXPECT_EQ(gfx::Rect(), notified_bounds());
538 RunAnimationForLayer(layer);
539 EXPECT_TRUE(keyboard_container()->IsVisible());
540 EXPECT_TRUE(keyboard_window()->IsVisible());
541 float show_end_opacity = layer->opacity();
542 EXPECT_LT(show_start_opacity, show_end_opacity);
543 EXPECT_EQ(gfx::Transform(), layer->transform());
544 // KeyboardController should notify the bounds of keyboard window to its
545 // observers after show animation finished.
546 EXPECT_EQ(keyboard_window()->bounds(), notified_bounds());
548 // Directly hide keyboard without delay.
549 controller()->HideKeyboard(KeyboardController::HIDE_REASON_AUTOMATIC);
550 EXPECT_TRUE(keyboard_container()->IsVisible());
551 EXPECT_TRUE(keyboard_container()->layer()->visible());
552 EXPECT_TRUE(keyboard_window()->IsVisible());
553 float hide_start_opacity = layer->opacity();
554 // KeyboardController should notify the bounds of keyboard window to its
555 // observers before hide animation starts.
556 EXPECT_EQ(gfx::Rect(), notified_bounds());
558 RunAnimationForLayer(layer);
559 EXPECT_FALSE(keyboard_container()->IsVisible());
560 EXPECT_FALSE(keyboard_container()->layer()->visible());
561 EXPECT_FALSE(keyboard_window()->IsVisible());
562 float hide_end_opacity = layer->opacity();
563 EXPECT_GT(hide_start_opacity, hide_end_opacity);
564 EXPECT_EQ(transform, layer->transform());
565 EXPECT_EQ(gfx::Rect(), notified_bounds());
568 // Show keyboard during keyboard hide animation should abort the hide animation
569 // and the keyboard should animate in.
570 // Test for crbug.com/333284.
571 TEST_F(KeyboardControllerAnimationTest, ContainerShowWhileHide) {
572 ui::Layer* layer = keyboard_container()->layer();
574 RunAnimationForLayer(layer);
576 controller()->HideKeyboard(KeyboardController::HIDE_REASON_AUTOMATIC);
577 // Before hide animation finishes, show keyboard again.
579 RunAnimationForLayer(layer);
580 EXPECT_TRUE(keyboard_container()->IsVisible());
581 EXPECT_TRUE(keyboard_window()->IsVisible());
582 EXPECT_EQ(1.0, layer->opacity());
583 EXPECT_EQ(gfx::Transform(), layer->transform());
586 class KeyboardControllerUsabilityTest : public KeyboardControllerTest {
588 KeyboardControllerUsabilityTest() {}
589 virtual ~KeyboardControllerUsabilityTest() {}
591 virtual void SetUp() OVERRIDE {
592 CommandLine::ForCurrentProcess()->AppendSwitch(
593 switches::kKeyboardUsabilityExperiment);
594 KeyboardControllerTest::SetUp();
598 DISALLOW_COPY_AND_ASSIGN(KeyboardControllerUsabilityTest);
601 TEST_F(KeyboardControllerUsabilityTest, KeyboardAlwaysVisibleInUsabilityTest) {
602 const gfx::Rect& root_bounds = root_window()->bounds();
604 TestTextInputClient input_client(ui::TEXT_INPUT_TYPE_TEXT);
605 TestTextInputClient no_input_client(ui::TEXT_INPUT_TYPE_NONE);
607 aura::Window* keyboard_container(controller()->GetContainerWindow());
608 keyboard_container->SetBounds(root_bounds);
609 root_window()->AddChild(keyboard_container);
611 SetFocus(&input_client);
612 EXPECT_TRUE(keyboard_container->IsVisible());
614 SetFocus(&no_input_client);
615 // Keyboard should not hide itself after lost focus.
616 EXPECT_TRUE(keyboard_container->IsVisible());
617 EXPECT_FALSE(WillHideKeyboard());
620 } // namespace keyboard