Upstream version 5.34.92.0
[platform/framework/web/crosswalk.git] / src / ui / base / ime / chromeos / mock_ime_input_context_handler.cc
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 "ui/base/ime/chromeos/mock_ime_input_context_handler.h"
6
7 #include "chromeos/ime/ibus_text.h"
8
9 namespace chromeos {
10
11 MockIMEInputContextHandler::MockIMEInputContextHandler()
12     : commit_text_call_count_(0),
13       update_preedit_text_call_count_(0),
14       delete_surrounding_text_call_count_(0) {
15 }
16
17 MockIMEInputContextHandler::~MockIMEInputContextHandler() {
18 }
19
20 void MockIMEInputContextHandler::CommitText(const std::string& text) {
21   ++commit_text_call_count_;
22   last_commit_text_ = text;
23 }
24
25 void MockIMEInputContextHandler::UpdatePreeditText(const IBusText& text,
26                                                    uint32 cursor_pos,
27                                                    bool visible) {
28   ++update_preedit_text_call_count_;
29   last_update_preedit_arg_.ibus_text.CopyFrom(text);
30   last_update_preedit_arg_.cursor_pos = cursor_pos;
31   last_update_preedit_arg_.is_visible = visible;
32 }
33
34 void MockIMEInputContextHandler::DeleteSurroundingText(int32 offset,
35                                                        uint32 length) {
36   ++delete_surrounding_text_call_count_;
37   last_delete_surrounding_text_arg_.offset = offset;
38   last_delete_surrounding_text_arg_.length = length;
39 }
40
41 void MockIMEInputContextHandler::Reset() {
42   commit_text_call_count_ = 0;
43   update_preedit_text_call_count_ = 0;
44   delete_surrounding_text_call_count_ = 0;
45   last_commit_text_.clear();
46 }
47
48 }  // namespace chromeos