forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmock_input_method_engine.h
78 lines (63 loc) · 2.61 KB
/
mock_input_method_engine.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_
#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_
#include <stddef.h>
#include <stdint.h>
#include <string>
#include <vector>
#include "ui/base/ime/chromeos/input_method_descriptor.h"
#include "ui/base/ime/ime_engine_handler_interface.h"
namespace ui {
class IMEEngineHandlerInterface;
class KeyEvent;
} // namespace ui
namespace chromeos {
class CompositionText;
class MockInputMethodEngine : public ui::IMEEngineHandlerInterface {
public:
MockInputMethodEngine();
~MockInputMethodEngine() override;
// IMEEngineHandlerInterface overrides.
const std::string& GetActiveComponentId() const override;
bool ClearComposition(int context_id, std::string* error) override;
bool CommitText(int context_id,
const char* text,
std::string* error) override;
bool SetCandidateWindowVisible(bool visible, std::string* error) override;
bool SetCursorPosition(int context_id,
int candidate_id,
std::string* error) override;
bool IsActive() const override;
bool DeleteSurroundingText(int context_id,
int offset,
size_t number_of_chars,
std::string* error) override;
// IMEEngineHandlerInterface overrides.
void FocusIn(
const IMEEngineHandlerInterface::InputContext& input_context) override;
void FocusOut() override;
void Enable(const std::string& component_id) override;
void Disable() override;
void PropertyActivate(const std::string& property_name) override;
void Reset() override;
bool IsInterestedInKeyEvent() const override;
void ProcessKeyEvent(const ui::KeyEvent& key_event,
KeyEventDoneCallback& callback) override;
void CandidateClicked(uint32_t index) override;
void SetSurroundingText(const std::string& text,
uint32_t cursor_pos,
uint32_t anchor_pos,
uint32_t offset_pos) override;
void SetCompositionBounds(const std::vector<gfx::Rect>& bounds) override;
void HideInputView() override;
std::string last_activated_property() const {
return last_activated_property_;
}
private:
std::string active_component_id_;
std::string last_activated_property_;
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_