1 // Copyright 2014 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 CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_
11 #include "chrome/browser/chromeos/input_method/input_method_engine_interface.h"
12 #include "ui/base/ime/chromeos/input_method_descriptor.h"
18 struct InputMethodMenuItem
;
24 class CompositionText
;
26 namespace input_method
{
27 class CandidateWindow
;
28 struct KeyEventHandle
;
31 class MockInputMethodEngine
: public InputMethodEngineInterface
{
33 MockInputMethodEngine();
34 ~MockInputMethodEngine() override
;
36 // InputMethodEngineInterface overrides.
37 const std::string
& GetActiveComponentId() const override
;
38 bool SetComposition(int context_id
,
43 const std::vector
<SegmentInfo
>& segments
,
44 std::string
* error
) override
;
45 bool ClearComposition(int context_id
, std::string
* error
) override
;
46 bool CommitText(int context_id
,
48 std::string
* error
) override
;
49 bool SendKeyEvents(int context_id
,
50 const std::vector
<KeyboardEvent
>& events
) override
;
51 const CandidateWindowProperty
& GetCandidateWindowProperty() const override
;
52 void SetCandidateWindowProperty(
53 const CandidateWindowProperty
& property
) override
;
54 bool SetCandidateWindowVisible(bool visible
, std::string
* error
) override
;
55 bool SetCandidates(int context_id
,
56 const std::vector
<Candidate
>& candidates
,
57 std::string
* error
) override
;
58 bool SetCursorPosition(int context_id
,
60 std::string
* error
) override
;
61 bool SetMenuItems(const std::vector
<MenuItem
>& items
) override
;
62 bool UpdateMenuItems(const std::vector
<MenuItem
>& items
) override
;
63 bool IsActive() const override
;
64 bool DeleteSurroundingText(int context_id
,
66 size_t number_of_chars
,
67 std::string
* error
) override
;
69 // IMEEngineHandlerInterface overrides.
71 const IMEEngineHandlerInterface::InputContext
& input_context
) override
;
72 void FocusOut() override
;
73 void Enable(const std::string
& component_id
) override
;
74 void Disable() override
;
75 void PropertyActivate(const std::string
& property_name
) override
;
76 void Reset() override
;
77 void ProcessKeyEvent(const ui::KeyEvent
& key_event
,
78 const KeyEventDoneCallback
& callback
) override
;
79 void CandidateClicked(uint32 index
) override
;
80 void SetSurroundingText(const std::string
& text
,
82 uint32 anchor_pos
) override
;
83 void SetCompositionBounds(const std::vector
<gfx::Rect
>& bounds
) override
;
84 void HideInputView() override
;
86 std::string
last_activated_property() const {
87 return last_activated_property_
;
91 std::string active_component_id_
;
93 // The current candidate window property.
94 CandidateWindowProperty candidate_window_property_
;
96 std::string last_activated_property_
;
99 } // namespace chromeos
101 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_