Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / base / ime / chromeos / mock_ime_input_context_handler.cc
blob936caf22bf2e970aad3a96ecf9b246cf2abc4079
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 "ui/base/ime/chromeos/mock_ime_input_context_handler.h"
7 #include "ui/base/ime/chromeos/composition_text_chromeos.h"
9 namespace chromeos {
11 MockIMEInputContextHandler::MockIMEInputContextHandler()
12 : commit_text_call_count_(0),
13 update_preedit_text_call_count_(0),
14 delete_surrounding_text_call_count_(0) {
17 MockIMEInputContextHandler::~MockIMEInputContextHandler() {
20 void MockIMEInputContextHandler::CommitText(const std::string& text) {
21 ++commit_text_call_count_;
22 last_commit_text_ = text;
25 void MockIMEInputContextHandler::UpdateCompositionText(
26 const CompositionText& text,
27 uint32 cursor_pos,
28 bool visible) {
29 ++update_preedit_text_call_count_;
30 last_update_composition_arg_.composition_text.CopyFrom(text);
31 last_update_composition_arg_.cursor_pos = cursor_pos;
32 last_update_composition_arg_.is_visible = visible;
35 void MockIMEInputContextHandler::DeleteSurroundingText(int32 offset,
36 uint32 length) {
37 ++delete_surrounding_text_call_count_;
38 last_delete_surrounding_text_arg_.offset = offset;
39 last_delete_surrounding_text_arg_.length = length;
42 void MockIMEInputContextHandler::Reset() {
43 commit_text_call_count_ = 0;
44 update_preedit_text_call_count_ = 0;
45 delete_surrounding_text_call_count_ = 0;
46 last_commit_text_.clear();
49 } // namespace chromeos