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

Side by Side Diff: ui/views/test/views_test_base.cc

Issue 8576005: IME (input method editor) support for Aura, part 3 of 3: Use ui::InputMethod in ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move to ash/ime/ Created 8 years, 12 months 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
« no previous file with comments | « ui/views/test/views_test_base.h ('k') | ui/views/widget/native_widget_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/views/test/views_test_base.h" 5 #include "ui/views/test/views_test_base.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <ole2.h> 8 #include <ole2.h>
9 #endif 9 #endif
10 10
11 #if defined(USE_AURA) 11 #if defined(USE_AURA)
12 #include "base/compiler_specific.h"
13 #include "ui/aura/client/aura_constants.h"
12 #include "ui/aura/root_window.h" 14 #include "ui/aura/root_window.h"
13 #include "ui/aura/test/test_activation_client.h" 15 #include "ui/aura/test/test_activation_client.h"
16 #include "ui/base/ime/input_method.h"
17
18 namespace {
19
20 class DummyInputMethod : public ui::InputMethod {
21 public:
22 DummyInputMethod() {}
23 virtual ~DummyInputMethod() {}
24
25 // ui::InputMethod overrides:
26 virtual void SetDelegate(
27 ui::internal::InputMethodDelegate* delegate) OVERRIDE {}
28 virtual void Init(bool focused) OVERRIDE {}
29 virtual void OnFocus() OVERRIDE {}
30 virtual void OnBlur() OVERRIDE {}
31 virtual void SetFocusedTextInputClient(
32 ui::TextInputClient* client) OVERRIDE {}
33 virtual ui::TextInputClient* GetTextInputClient() const OVERRIDE {
34 return NULL;
35 }
36 virtual void DispatchKeyEvent(
37 const base::NativeEvent& native_key_event) OVERRIDE {}
38 virtual void OnTextInputTypeChanged(
39 const ui::TextInputClient* client) OVERRIDE {}
40 virtual void OnCaretBoundsChanged(
41 const ui::TextInputClient* client) OVERRIDE {}
42 virtual void CancelComposition(const ui::TextInputClient* client) OVERRIDE {}
43 virtual std::string GetInputLocale() OVERRIDE { return ""; }
44 virtual base::i18n::TextDirection GetInputTextDirection() OVERRIDE {
45 return base::i18n::UNKNOWN_DIRECTION;
46 }
47 virtual bool IsActive() OVERRIDE { return true; }
48 virtual ui::TextInputType GetTextInputType() const OVERRIDE {
49 return ui::TEXT_INPUT_TYPE_NONE;
50 }
51 };
52
53 } // namespace
14 #endif 54 #endif
15 55
16 namespace views { 56 namespace views {
17 57
18 ViewsTestBase::ViewsTestBase() 58 ViewsTestBase::ViewsTestBase()
19 : setup_called_(false), 59 : setup_called_(false),
20 teardown_called_(false) { 60 teardown_called_(false) {
21 #if defined(OS_WIN) 61 #if defined(OS_WIN)
22 OleInitialize(NULL); 62 OleInitialize(NULL);
23 #endif 63 #endif
24 #if defined(USE_AURA) 64 #if defined(USE_AURA)
25 test_activation_client_.reset(new aura::test::TestActivationClient); 65 test_activation_client_.reset(new aura::test::TestActivationClient);
66 test_input_method_.reset(new DummyInputMethod);
67 aura::RootWindow::GetInstance()->SetProperty(
68 aura::client::kRootWindowInputMethod,
69 test_input_method_.get());
26 #endif 70 #endif
27 } 71 }
28 72
29 ViewsTestBase::~ViewsTestBase() { 73 ViewsTestBase::~ViewsTestBase() {
30 #if defined(OS_WIN) 74 #if defined(OS_WIN)
31 OleUninitialize(); 75 OleUninitialize();
32 #endif 76 #endif
33 CHECK(setup_called_) 77 CHECK(setup_called_)
34 << "You have overridden SetUp but never called super class's SetUp"; 78 << "You have overridden SetUp but never called super class's SetUp";
35 CHECK(teardown_called_) 79 CHECK(teardown_called_)
(...skipping 19 matching lines...) Expand all
55 void ViewsTestBase::RunPendingMessages() { 99 void ViewsTestBase::RunPendingMessages() {
56 #if defined(USE_AURA) 100 #if defined(USE_AURA)
57 message_loop_.RunAllPendingWithDispatcher( 101 message_loop_.RunAllPendingWithDispatcher(
58 aura::RootWindow::GetInstance()->GetDispatcher()); 102 aura::RootWindow::GetInstance()->GetDispatcher());
59 #else 103 #else
60 message_loop_.RunAllPending(); 104 message_loop_.RunAllPending();
61 #endif 105 #endif
62 } 106 }
63 107
64 } // namespace views 108 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/test/views_test_base.h ('k') | ui/views/widget/native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698