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

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

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 #include "chromeos/ime/mock_ime_input_context_handler.h"
6
7 #include "chromeos/dbus/ibus/ibus_text.h"
8
9 namespace chromeos {
10
11 MockIMEInputContextHandler::MockIMEInputContextHandler()
12 : commit_text_call_count_(0),
13 forward_key_event_call_count_(0),
14 update_preedit_text_call_count_(0),
15 show_preedit_text_call_count_(0),
16 hide_preedit_text_call_count_(0),
17 delete_surrounding_text_call_count_(0) {
18 }
19
20 MockIMEInputContextHandler::~MockIMEInputContextHandler() {
21 }
22
23 void MockIMEInputContextHandler::CommitText(const IBusText& text) {
24 ++commit_text_call_count_;
25 last_commit_text_ = text.text();
26 }
27
28 void MockIMEInputContextHandler::ForwardKeyEvent(uint32 keyval,
29 uint32 keycode,
30 uint32 state) {
31 ++forward_key_event_call_count_;
32 }
33
34 void MockIMEInputContextHandler::UpdatePreeditText(const IBusText& text,
35 uint32 cursor_pos,
36 bool visible) {
37 ++update_preedit_text_call_count_;
38 last_update_preedit_arg_.ibus_text.CopyFrom(text);
39 last_update_preedit_arg_.cursor_pos = cursor_pos;
40 last_update_preedit_arg_.is_visible = visible;
41 }
42
43 void MockIMEInputContextHandler::ShowPreeditText() {
44 ++show_preedit_text_call_count_;
45 }
46
47 void MockIMEInputContextHandler::HidePreeditText() {
48 ++hide_preedit_text_call_count_;
49 }
50
51 void MockIMEInputContextHandler::DeleteSurroundingText(int32 offset,
52 uint32 length) {
53 ++delete_surrounding_text_call_count_;
54 last_delete_surrounding_text_arg_.offset = offset;
55 last_delete_surrounding_text_arg_.length = length;
56 }
57
58 void MockIMEInputContextHandler::Reset() {
59 commit_text_call_count_ = 0;
60 forward_key_event_call_count_ = 0;
61 update_preedit_text_call_count_ = 0;
62 show_preedit_text_call_count_ = 0;
63 hide_preedit_text_call_count_ = 0;
64 delete_surrounding_text_call_count_ = 0;
65 last_commit_text_.clear();
66 }
67
68 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698