Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ui / base / ime / chromeos / mock_ime_engine_handler.h
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.
4
5 #ifndef UI_BASE_IME_CHROMEOS_MOCK_IME_ENGINE_HANDLER_H_
6 #define UI_BASE_IME_CHROMEOS_MOCK_IME_ENGINE_HANDLER_H_
7
8 #include "ui/base/ime/chromeos/ime_bridge.h"
9 #include "ui/base/ui_base_export.h"
10 #include "ui/events/event.h"
11
12 namespace chromeos {
13
14 class UI_BASE_EXPORT MockIMEEngineHandler : public IMEEngineHandlerInterface {
15  public:
16   MockIMEEngineHandler();
17   virtual ~MockIMEEngineHandler();
18
19   virtual void FocusIn(const InputContext& input_context) override;
20   virtual void FocusOut() override;
21   virtual void Enable(const std::string& component_id) override;
22   virtual void Disable() override;
23   virtual void PropertyActivate(const std::string& property_name) override;
24   virtual void Reset() override;
25   virtual void ProcessKeyEvent(const ui::KeyEvent& key_event,
26                                const KeyEventDoneCallback& callback) override;
27   virtual void CandidateClicked(uint32 index) override;
28   virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos,
29                                   uint32 anchor_pos) override;
30   virtual void SetCompositionBounds(const gfx::Rect& bounds) override;
31
32   int focus_in_call_count() const { return focus_in_call_count_; }
33   int focus_out_call_count() const { return focus_out_call_count_; }
34   int reset_call_count() const { return reset_call_count_; }
35   int set_surrounding_text_call_count() const {
36     return set_surrounding_text_call_count_;
37   }
38   int process_key_event_call_count() const {
39     return process_key_event_call_count_;
40   }
41
42   const InputContext& last_text_input_context() const {
43     return last_text_input_context_;
44   }
45
46   std::string last_activated_property() const {
47     return last_activated_property_;
48   }
49
50   std::string last_set_surrounding_text() const {
51     return last_set_surrounding_text_;
52   }
53
54   uint32 last_set_surrounding_cursor_pos() const {
55     return last_set_surrounding_cursor_pos_;
56   }
57
58   uint32 last_set_surrounding_anchor_pos() const {
59     return last_set_surrounding_anchor_pos_;
60   }
61
62   const ui::KeyEvent* last_processed_key_event() const {
63     return last_processed_key_event_.get();
64   }
65
66   const KeyEventDoneCallback& last_passed_callback() const {
67     return last_passed_callback_;
68   }
69
70  private:
71   int focus_in_call_count_;
72   int focus_out_call_count_;
73   int set_surrounding_text_call_count_;
74   int process_key_event_call_count_;
75   int reset_call_count_;
76   InputContext last_text_input_context_;
77   std::string last_activated_property_;
78   std::string last_set_surrounding_text_;
79   uint32 last_set_surrounding_cursor_pos_;
80   uint32 last_set_surrounding_anchor_pos_;
81   scoped_ptr<ui::KeyEvent> last_processed_key_event_;
82   KeyEventDoneCallback last_passed_callback_;
83 };
84
85 }  // namespace chromeos
86
87 #endif  // UI_BASE_IME_CHROMEOS_MOCK_IME_ENGINE_HANDLER_H_