Add include.
[chromium-blink-merge.git] / ui / views / ime / input_method_bridge_unittest.cc
blob64144cf450d0d827509fbb433ce70c3b465a2584
1 // Copyright 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.
5 #include "ui/aura/client/aura_constants.h"
6 #include "ui/aura/window.h"
7 #include "ui/base/ime/dummy_input_method_delegate.h"
8 #include "ui/base/ime/input_method_minimal.h"
9 #include "ui/base/ime/text_input_client.h"
10 #include "ui/views/ime/input_method.h"
11 #include "ui/views/test/views_test_base.h"
12 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
13 #include "ui/views/widget/native_widget_aura.h"
14 #include "ui/views/widget/widget.h"
16 namespace views {
18 typedef ViewsTestBase InputMethodBridgeTest;
20 TEST_F(InputMethodBridgeTest, DestructTest) {
21 ui::internal::DummyInputMethodDelegate input_method_delegate;
22 ui::InputMethodMinimal input_method(&input_method_delegate);
24 GetContext()->SetProperty(aura::client::kRootWindowInputMethodKey,
25 static_cast<ui::InputMethod*>(&input_method));
27 Widget* toplevel = new Widget;
28 Widget::InitParams toplevel_params =
29 CreateParams(Widget::InitParams::TYPE_WINDOW);
30 // |child| owns |native_widget|.
31 toplevel_params.native_widget = new DesktopNativeWidgetAura(toplevel);
32 toplevel->Init(toplevel_params);
34 Widget* child = new Widget;
35 Widget::InitParams child_params =
36 CreateParams(Widget::InitParams::TYPE_POPUP);
37 child_params.parent = toplevel->GetNativeView();
38 // |child| owns |native_widget|.
39 child_params.native_widget = new NativeWidgetAura(child);
40 child->Init(child_params);
42 child->GetInputMethod()->OnFocus();
44 toplevel->CloseNow();
46 GetContext()->SetProperty(aura::client::kRootWindowInputMethodKey,
47 static_cast<ui::InputMethod*>(NULL));
50 } // namespace views