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_
10 #include "chrome/browser/chromeos/input_method/input_method_engine_interface.h"
11 #include "chromeos/ime/input_method_descriptor.h"
22 namespace input_method
{
23 class CandidateWindow
;
24 struct InputMethodProperty
;
25 struct KeyEventHandle
;
26 } // namespace input_method
28 class MockInputMethodEngine
: public InputMethodEngineInterface
{
30 explicit MockInputMethodEngine(
31 const input_method::InputMethodDescriptor
& descriptor
);
32 virtual ~MockInputMethodEngine();
34 // InputMethodEngineInterface overrides.
35 virtual const input_method::InputMethodDescriptor
& GetDescriptor()
37 virtual void StartIme() OVERRIDE
;
38 virtual bool SetComposition(int context_id
,
43 const std::vector
<SegmentInfo
>& segments
,
44 std::string
* error
) OVERRIDE
;
45 virtual bool ClearComposition(int context_id
, std::string
* error
) OVERRIDE
;
46 virtual bool CommitText(int context_id
, const char* text
,
47 std::string
* error
) OVERRIDE
;
48 virtual bool SendKeyEvents(int context_id
,
49 const std::vector
<KeyboardEvent
>& events
) OVERRIDE
;
50 virtual const CandidateWindowProperty
&
51 GetCandidateWindowProperty() const OVERRIDE
;
52 virtual void SetCandidateWindowProperty(
53 const CandidateWindowProperty
& property
) OVERRIDE
;
54 virtual bool SetCandidateWindowVisible(bool visible
,
55 std::string
* error
) OVERRIDE
;
56 virtual bool SetCandidates(int context_id
,
57 const std::vector
<Candidate
>& candidates
,
58 std::string
* error
) OVERRIDE
;
59 virtual bool SetCursorPosition(int context_id
, int candidate_id
,
60 std::string
* error
) OVERRIDE
;
61 virtual bool SetMenuItems(const std::vector
<MenuItem
>& items
) OVERRIDE
;
62 virtual bool UpdateMenuItems(const std::vector
<MenuItem
>& items
) OVERRIDE
;
63 virtual bool IsActive() const OVERRIDE
;
64 virtual void KeyEventDone(input_method::KeyEventHandle
* key_data
,
65 bool handled
) OVERRIDE
;
66 virtual bool DeleteSurroundingText(int context_id
,
68 size_t number_of_chars
,
69 std::string
* error
) OVERRIDE
;
71 // IBusEngineHandlerInterface overrides.
73 const IBusEngineHandlerInterface::InputContext
& input_context
) OVERRIDE
;
74 virtual void FocusOut() OVERRIDE
;
75 virtual void Enable() OVERRIDE
;
76 virtual void Disable() OVERRIDE
;
77 virtual void PropertyActivate(const std::string
& property_name
) OVERRIDE
;
78 virtual void Reset() OVERRIDE
;
79 virtual void ProcessKeyEvent(const ui::KeyEvent
& key_event
,
80 const KeyEventDoneCallback
& callback
) OVERRIDE
;
81 virtual void CandidateClicked(uint32 index
) OVERRIDE
;
82 virtual void SetSurroundingText(const std::string
& text
, uint32 cursor_pos
,
83 uint32 anchor_pos
) OVERRIDE
;
84 virtual void HideInputView() OVERRIDE
;
87 // Descriptor of this input method.
88 input_method::InputMethodDescriptor descriptor_
;
90 // The current candidate window property.
91 CandidateWindowProperty candidate_window_property_
;
94 } // namespace chromeos
96 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_