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

Side by Side Diff: ui/base/ime/mock_ime_input_context_handler.cc

Issue 1780523006: Add tests for input.ime.* APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/base/ime/chromeos/mock_ime_input_context_handler.h" 5 #include "ui/base/ime/mock_ime_input_context_handler.h"
6 6
7 #include "ui/base/ime/composition_text.h" 7 #include "ui/base/ime/composition_text.h"
8 8
9 namespace chromeos { 9 namespace ui {
10 10
11 MockIMEInputContextHandler::MockIMEInputContextHandler() 11 MockIMEInputContextHandler::MockIMEInputContextHandler()
12 : commit_text_call_count_(0), 12 : commit_text_call_count_(0),
13 update_preedit_text_call_count_(0), 13 update_preedit_text_call_count_(0),
14 delete_surrounding_text_call_count_(0) { 14 delete_surrounding_text_call_count_(0) {}
15 }
16 15
17 MockIMEInputContextHandler::~MockIMEInputContextHandler() { 16 MockIMEInputContextHandler::~MockIMEInputContextHandler() {}
18 }
19 17
20 void MockIMEInputContextHandler::CommitText(const std::string& text) { 18 void MockIMEInputContextHandler::CommitText(const std::string& text) {
21 ++commit_text_call_count_; 19 ++commit_text_call_count_;
22 last_commit_text_ = text; 20 last_commit_text_ = text;
23 } 21 }
24 22
25 void MockIMEInputContextHandler::UpdateCompositionText( 23 void MockIMEInputContextHandler::UpdateCompositionText(
26 const ui::CompositionText& text, 24 const CompositionText& text,
27 uint32_t cursor_pos, 25 uint32_t cursor_pos,
28 bool visible) { 26 bool visible) {
29 ++update_preedit_text_call_count_; 27 ++update_preedit_text_call_count_;
30 last_update_composition_arg_.composition_text.CopyFrom(text); 28 last_update_composition_arg_.composition_text.CopyFrom(text);
31 last_update_composition_arg_.cursor_pos = cursor_pos; 29 last_update_composition_arg_.cursor_pos = cursor_pos;
32 last_update_composition_arg_.is_visible = visible; 30 last_update_composition_arg_.is_visible = visible;
33 } 31 }
34 32
35 void MockIMEInputContextHandler::DeleteSurroundingText(int32_t offset, 33 void MockIMEInputContextHandler::DeleteSurroundingText(int32_t offset,
36 uint32_t length) { 34 uint32_t length) {
37 ++delete_surrounding_text_call_count_; 35 ++delete_surrounding_text_call_count_;
38 last_delete_surrounding_text_arg_.offset = offset; 36 last_delete_surrounding_text_arg_.offset = offset;
39 last_delete_surrounding_text_arg_.length = length; 37 last_delete_surrounding_text_arg_.length = length;
40 } 38 }
41 39
42 void MockIMEInputContextHandler::Reset() { 40 void MockIMEInputContextHandler::Reset() {
43 commit_text_call_count_ = 0; 41 commit_text_call_count_ = 0;
44 update_preedit_text_call_count_ = 0; 42 update_preedit_text_call_count_ = 0;
45 delete_surrounding_text_call_count_ = 0; 43 delete_surrounding_text_call_count_ = 0;
46 last_commit_text_.clear(); 44 last_commit_text_.clear();
47 } 45 }
48 46
49 } // namespace chromeos 47 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698