Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / base / ime / chromeos / mock_ime_input_context_handler.h
blob690f7a094fd69101b5ca8d4134e2fad0bbe4acc5
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 #ifndef UI_BASE_IME_CHROMEOS_MOCK_IME_INPUT_CONTEXT_HANDLER_H_
6 #define UI_BASE_IME_CHROMEOS_MOCK_IME_INPUT_CONTEXT_HANDLER_H_
8 #include "ui/base/ime/chromeos/composition_text_chromeos.h"
9 #include "ui/base/ime/chromeos/ime_bridge.h"
10 #include "ui/base/ime/ui_base_ime_export.h"
12 namespace chromeos {
14 class UI_BASE_IME_EXPORT MockIMEInputContextHandler
15 : public IMEInputContextHandlerInterface {
16 public:
17 struct UpdateCompositionTextArg {
18 CompositionText composition_text;
19 uint32 cursor_pos;
20 bool is_visible;
23 struct DeleteSurroundingTextArg {
24 int32 offset;
25 uint32 length;
28 MockIMEInputContextHandler();
29 virtual ~MockIMEInputContextHandler();
31 void CommitText(const std::string& text) override;
32 void UpdateCompositionText(const CompositionText& text,
33 uint32 cursor_pos,
34 bool visible) override;
35 void DeleteSurroundingText(int32 offset, uint32 length) override;
37 int commit_text_call_count() const { return commit_text_call_count_; }
39 int update_preedit_text_call_count() const {
40 return update_preedit_text_call_count_;
43 int delete_surrounding_text_call_count() const {
44 return delete_surrounding_text_call_count_;
47 const std::string& last_commit_text() const {
48 return last_commit_text_;
51 const UpdateCompositionTextArg& last_update_composition_arg() const {
52 return last_update_composition_arg_;
55 const DeleteSurroundingTextArg& last_delete_surrounding_text_arg() const {
56 return last_delete_surrounding_text_arg_;
59 // Resets all call count.
60 void Reset();
62 private:
63 int commit_text_call_count_;
64 int update_preedit_text_call_count_;
65 int delete_surrounding_text_call_count_;
66 std::string last_commit_text_;
67 UpdateCompositionTextArg last_update_composition_arg_;
68 DeleteSurroundingTextArg last_delete_surrounding_text_arg_;
71 } // namespace chromeos
73 #endif // UI_BASE_IME_CHROMEOS_MOCK_IME_INPUT_CONTEXT_HANDLER_H_