diff options
author | nona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-04 08:13:01 +0000 |
---|---|---|
committer | nona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-04 08:13:01 +0000 |
commit | 246879a95bc7273e14b080e0b51dde935c432548 (patch) | |
tree | 3a02f2622037a2fd529d06af2ba33cf0413f802e /ui/base/ime/fake_input_method.h | |
parent | 81e361f411a6e7e434ab2f35515087744b912340 (diff) | |
download | chromium_src-246879a95bc7273e14b080e0b51dde935c432548.zip chromium_src-246879a95bc7273e14b080e0b51dde935c432548.tar.gz chromium_src-246879a95bc7273e14b080e0b51dde935c432548.tar.bz2 |
Introduce TextInputBrowsertest.
This test verifies that the TextInputType should change expected value when the focused node is changed by JavaScript.
This CL is a pilot change to check interactive_ui_tests can perform text input related testing.
We can't use browser_tests because text input related tests require unique focus and UI interaction.
If this patch works fine, I will introduce more tests to increase test coverage.
BUG=173951
TEST=try bots
Review URL: https://chromiumcodereview.appspot.com/12093105
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180360 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/ime/fake_input_method.h')
-rw-r--r-- | ui/base/ime/fake_input_method.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/ui/base/ime/fake_input_method.h b/ui/base/ime/fake_input_method.h new file mode 100644 index 0000000..596c4af --- /dev/null +++ b/ui/base/ime/fake_input_method.h @@ -0,0 +1,54 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_BASE_IME_FAKE_INPUT_METHOD_H_ +#define UI_BASE_IME_FAKE_INPUT_METHOD_H_ + +#include <string> + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "ui/base/ime/input_method.h" +#include "ui/base/ui_export.h" + +namespace ui { + +class KeyEvent; +class TextInputClient; + +// A fake ui::InputMethod implementation for minimum input support. +class UI_EXPORT FakeInputMethod : NON_EXPORTED_BASE(public InputMethod) { + public: + explicit FakeInputMethod(internal::InputMethodDelegate* delegate); + virtual ~FakeInputMethod(); + + // Overriden from InputMethod. + virtual void SetDelegate(internal::InputMethodDelegate* delegate) OVERRIDE; + virtual void Init(bool focused) OVERRIDE; + virtual void OnFocus() OVERRIDE; + virtual void OnBlur() OVERRIDE; + virtual void SetFocusedTextInputClient(TextInputClient* client) OVERRIDE; + virtual TextInputClient* GetTextInputClient() const OVERRIDE; + virtual void DispatchKeyEvent(const base::NativeEvent& native_event) OVERRIDE; + virtual void DispatchFabricatedKeyEvent(const ui::KeyEvent& event) OVERRIDE { + } + virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; + virtual void OnCaretBoundsChanged(const TextInputClient* client) OVERRIDE; + virtual void CancelComposition(const TextInputClient* client) OVERRIDE; + virtual std::string GetInputLocale() OVERRIDE; + virtual base::i18n::TextDirection GetInputTextDirection() OVERRIDE; + virtual bool IsActive() OVERRIDE; + virtual ui::TextInputType GetTextInputType() const OVERRIDE; + virtual bool CanComposeInline() const OVERRIDE; + + private: + internal::InputMethodDelegate* delegate_; + TextInputClient* text_input_client_; + + DISALLOW_COPY_AND_ASSIGN(FakeInputMethod); +}; + +} // namespace ui + +#endif // UI_BASE_IME_FAKE_INPUT_METHOD_H_ |