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 #include "chromeos/ime/mock_ime_input_context_handler.h"
7 #include "chromeos/dbus/ibus/ibus_text.h"
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) {
20 MockIMEInputContextHandler::~MockIMEInputContextHandler() {
23 void MockIMEInputContextHandler::CommitText(const std::string& text) {
24 ++commit_text_call_count_;
25 last_commit_text_ = text;
28 void MockIMEInputContextHandler::ForwardKeyEvent(uint32 keyval,
31 ++forward_key_event_call_count_;
34 void MockIMEInputContextHandler::UpdatePreeditText(const IBusText& text,
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;
43 void MockIMEInputContextHandler::ShowPreeditText() {
44 ++show_preedit_text_call_count_;
47 void MockIMEInputContextHandler::HidePreeditText() {
48 ++hide_preedit_text_call_count_;
51 void MockIMEInputContextHandler::DeleteSurroundingText(int32 offset,
53 ++delete_surrounding_text_call_count_;
54 last_delete_surrounding_text_arg_.offset = offset;
55 last_delete_surrounding_text_arg_.length = length;
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();
68 } // namespace chromeos