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

Side by Side Diff: chromeos/ime/mock_ime_input_context_handler.h

Issue 23822002: Adding new mock classes for input method handlers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
OLDNEW
(Empty)
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.
4
5 #ifndef CHROMEOS_IME_MOCK_IME_INPUT_CONTEXT_HANDLER_H_
6 #define CHROMEOS_IME_MOCK_IME_INPUT_CONTEXT_HANDLER_H_
7
8 #include "chromeos/dbus/ibus/ibus_text.h"
9 #include "chromeos/ime/ibus_bridge.h"
10
11 namespace chromeos {
12
13 class CHROMEOS_EXPORT MockIMEInputContextHandler
14 : public IBusInputContextHandlerInterface {
15 public:
16 struct UpdatePreeditTextArg {
17 IBusText ibus_text;
18 uint32 cursor_pos;
19 bool is_visible;
20 };
21
22 struct DeleteSurroundingTextArg {
23 int32 offset;
24 uint32 length;
25 };
26
27 MockIMEInputContextHandler();
28 virtual ~MockIMEInputContextHandler();
29
30 virtual void CommitText(const IBusText& text) OVERRIDE;
31 virtual void ForwardKeyEvent(uint32 keyval, uint32 keycode,
32 uint32 state) OVERRIDE;
33 virtual void UpdatePreeditText(const IBusText& text,
34 uint32 cursor_pos,
35 bool visible) OVERRIDE;
36 virtual void ShowPreeditText() OVERRIDE;
37 virtual void HidePreeditText() OVERRIDE;
38 virtual void DeleteSurroundingText(int32 offset, uint32 length) OVERRIDE;
39
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_;
43 }
44
45 int update_preedit_text_call_count() const {
46 return update_preedit_text_call_count_;
47 }
48
49 int show_preedit_text_call_count() const {
50 return show_preedit_text_call_count_;
51 }
52
53 int hide_preedit_text_call_count() const {
54 return hide_preedit_text_call_count_;
55 }
56
57 int delete_surrounding_text_call_count() const {
58 return delete_surrounding_text_call_count_;
59 }
60
61 const std::string& last_commit_text() const {
62 return last_commit_text_;
63 };
64
65 const UpdatePreeditTextArg& last_update_preedit_arg() const {
66 return last_update_preedit_arg_;
67 }
68
69 const DeleteSurroundingTextArg& last_delete_surrounding_text_arg() const {
70 return last_delete_surrounding_text_arg_;
71 }
72
73 // Resets all call count.
74 void Reset();
75
76 private:
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_;
86 };
87
88 } // namespace chromeos
89
90 #endif // CHROMEOS_IME_MOCK_IME_INPUT_CONTEXT_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698