- add sources.
[platform/framework/web/crosswalk.git] / src / chromeos / ime / mock_ime_candidate_window_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 CHROMEOS_IME_MOCK_IME_CANDIDATE_WINDOW_HANDLER_H_
6 #define CHROMEOS_IME_MOCK_IME_CANDIDATE_WINDOW_HANDLER_H_
7
8 #include "chromeos/ime/candidate_window.h"
9 #include "chromeos/ime/ibus_bridge.h"
10
11 namespace chromeos {
12
13 class MockIMECandidateWindowHandler
14     : public IBusPanelCandidateWindowHandlerInterface {
15  public:
16   struct UpdateLookupTableArg {
17     input_method::CandidateWindow lookup_table;
18     bool is_visible;
19   };
20
21   struct UpdateAuxiliaryTextArg {
22     std::string text;
23     bool is_visible;
24   };
25
26   MockIMECandidateWindowHandler();
27   virtual ~MockIMECandidateWindowHandler();
28
29   // IBusPanelCandidateWindowHandlerInterface override.
30   virtual void UpdateLookupTable(
31       const input_method::CandidateWindow& candidate_window,
32       bool visible) OVERRIDE;
33   virtual void HideLookupTable() OVERRIDE;
34   virtual void UpdateAuxiliaryText(const std::string& text,
35                                    bool visible) OVERRIDE;
36   virtual void HideAuxiliaryText() OVERRIDE;
37   virtual void UpdatePreeditText(const std::string& text, uint32 cursor_pos,
38                                  bool visible) OVERRIDE;
39   virtual void HidePreeditText() OVERRIDE;
40   virtual void SetCursorLocation(const ibus::Rect& cursor_location,
41                                  const ibus::Rect& composition_head) OVERRIDE;
42
43   int set_cursor_location_call_count() const {
44     return set_cursor_location_call_count_;
45   }
46
47   int update_lookup_table_call_count() const {
48     return update_lookup_table_call_count_;
49   }
50
51   int update_auxiliary_text_call_count() const {
52     return update_auxiliary_text_call_count_;
53   }
54
55   const UpdateLookupTableArg& last_update_lookup_table_arg() {
56     return last_update_lookup_table_arg_;
57   }
58
59   const UpdateAuxiliaryTextArg& last_update_auxiliary_text_arg() {
60     return last_update_auxiliary_text_arg_;
61   }
62
63   // Resets all call count.
64   void Reset();
65
66  private:
67   int set_cursor_location_call_count_;
68   int update_lookup_table_call_count_;
69   int update_auxiliary_text_call_count_;
70   UpdateLookupTableArg last_update_lookup_table_arg_;
71   UpdateAuxiliaryTextArg last_update_auxiliary_text_arg_;
72 };
73
74 }  // namespace chromeos
75
76 #endif  // CHROMEOS_IME_MOCK_IME_CANDIDATE_WINDOW_HANDLER_H_