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 #ifndef CHROMEOS_IME_MOCK_IME_INPUT_CONTEXT_HANDLER_H_
6 #define CHROMEOS_IME_MOCK_IME_INPUT_CONTEXT_HANDLER_H_
8 #include "chromeos/dbus/ibus/ibus_text.h"
9 #include "chromeos/ime/ibus_bridge.h"
13 class CHROMEOS_EXPORT MockIMEInputContextHandler
14 : public IBusInputContextHandlerInterface {
16 struct UpdatePreeditTextArg {
22 struct DeleteSurroundingTextArg {
27 MockIMEInputContextHandler();
28 virtual ~MockIMEInputContextHandler();
30 virtual void CommitText(const std::string& text) OVERRIDE;
31 virtual void ForwardKeyEvent(uint32 keyval, uint32 keycode,
32 uint32 state) OVERRIDE;
33 virtual void UpdatePreeditText(const IBusText& text,
35 bool visible) OVERRIDE;
36 virtual void ShowPreeditText() OVERRIDE;
37 virtual void HidePreeditText() OVERRIDE;
38 virtual void DeleteSurroundingText(int32 offset, uint32 length) OVERRIDE;
40 int commit_text_call_count() const { return commit_text_call_count_; }
41 int forward_key_event_call_count() const {
42 return forward_key_event_call_count_;
45 int update_preedit_text_call_count() const {
46 return update_preedit_text_call_count_;
49 int show_preedit_text_call_count() const {
50 return show_preedit_text_call_count_;
53 int hide_preedit_text_call_count() const {
54 return hide_preedit_text_call_count_;
57 int delete_surrounding_text_call_count() const {
58 return delete_surrounding_text_call_count_;
61 const std::string& last_commit_text() const {
62 return last_commit_text_;
65 const UpdatePreeditTextArg& last_update_preedit_arg() const {
66 return last_update_preedit_arg_;
69 const DeleteSurroundingTextArg& last_delete_surrounding_text_arg() const {
70 return last_delete_surrounding_text_arg_;
73 // Resets all call count.
77 int commit_text_call_count_;
78 int forward_key_event_call_count_;
79 int update_preedit_text_call_count_;
80 int show_preedit_text_call_count_;
81 int hide_preedit_text_call_count_;
82 int delete_surrounding_text_call_count_;
83 std::string last_commit_text_;
84 UpdatePreeditTextArg last_update_preedit_arg_;
85 DeleteSurroundingTextArg last_delete_surrounding_text_arg_;
88 } // namespace chromeos
90 #endif // CHROMEOS_IME_MOCK_IME_INPUT_CONTEXT_HANDLER_H_