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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
// 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 <string>
#include <vector>
#include "chrome/browser/chromeos/input_method/input_method_engine_interface.h"
#include "ui/base/ime/chromeos/input_method_descriptor.h"
namespace ui {
class KeyEvent;
namespace ime {
struct InputMethodMenuItem;
}
}
namespace chromeos {
class CompositionText;
namespace input_method {
class CandidateWindow;
struct KeyEventHandle;
}
class MockInputMethodEngine : public InputMethodEngineInterface {
public:
MockInputMethodEngine();
virtual ~MockInputMethodEngine();
// InputMethodEngineInterface overrides.
virtual const std::string& GetActiveComponentId() const override;
virtual bool SetComposition(int context_id,
const char* text,
int selection_start,
int selection_end,
int cursor,
const std::vector<SegmentInfo>& segments,
std::string* error) override;
virtual bool ClearComposition(int context_id, std::string* error) override;
virtual bool CommitText(int context_id, const char* text,
std::string* error) override;
virtual bool SendKeyEvents(int context_id,
const std::vector<KeyboardEvent>& events) override;
virtual const CandidateWindowProperty&
GetCandidateWindowProperty() const override;
virtual void SetCandidateWindowProperty(
const CandidateWindowProperty& property) override;
virtual bool SetCandidateWindowVisible(bool visible,
std::string* error) override;
virtual bool SetCandidates(int context_id,
const std::vector<Candidate>& candidates,
std::string* error) override;
virtual bool SetCursorPosition(int context_id, int candidate_id,
std::string* error) override;
virtual bool SetMenuItems(const std::vector<MenuItem>& items) override;
virtual bool UpdateMenuItems(const std::vector<MenuItem>& items) override;
virtual bool IsActive() const override;
virtual bool DeleteSurroundingText(int context_id,
int offset,
size_t number_of_chars,
std::string* error) override;
// IMEEngineHandlerInterface overrides.
virtual void FocusIn(
const IMEEngineHandlerInterface::InputContext& input_context) override;
virtual void FocusOut() override;
virtual void Enable(const std::string& component_id) override;
virtual void Disable() override;
virtual void PropertyActivate(const std::string& property_name) override;
virtual void Reset() override;
virtual void ProcessKeyEvent(const ui::KeyEvent& key_event,
const KeyEventDoneCallback& callback) override;
virtual void CandidateClicked(uint32 index) override;
virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos,
uint32 anchor_pos) override;
virtual void SetCompositionBounds(const gfx::Rect& bounds) override;
virtual void HideInputView() override;
std::string last_activated_property() const {
return last_activated_property_;
}
private:
std::string active_component_id_;
// The current candidate window property.
CandidateWindowProperty candidate_window_property_;
std::string last_activated_property_;
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_ENGINE_H_
|