Home | History | Annotate | Download | only in chromeos
      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 
     31   int focus_in_call_count() const { return focus_in_call_count_; }
     32   int focus_out_call_count() const { return focus_out_call_count_; }
     33   int reset_call_count() const { return reset_call_count_; }
     34   int set_surrounding_text_call_count() const {
     35     return set_surrounding_text_call_count_;
     36   }
     37   int process_key_event_call_count() const {
     38     return process_key_event_call_count_;
     39   }
     40 
     41   const InputContext& last_text_input_context() const {
     42     return last_text_input_context_;
     43   }
     44 
     45   std::string last_activated_property() const {
     46     return last_activated_property_;
     47   }
     48 
     49   std::string last_set_surrounding_text() const {
     50     return last_set_surrounding_text_;
     51   }
     52 
     53   uint32 last_set_surrounding_cursor_pos() const {
     54     return last_set_surrounding_cursor_pos_;
     55   }
     56 
     57   uint32 last_set_surrounding_anchor_pos() const {
     58     return last_set_surrounding_anchor_pos_;
     59   }
     60 
     61   const ui::KeyEvent* last_processed_key_event() const {
     62     return last_processed_key_event_.get();
     63   }
     64 
     65   const KeyEventDoneCallback& last_passed_callback() const {
     66     return last_passed_callback_;
     67   }
     68 
     69  private:
     70   int focus_in_call_count_;
     71   int focus_out_call_count_;
     72   int set_surrounding_text_call_count_;
     73   int process_key_event_call_count_;
     74   int reset_call_count_;
     75   InputContext last_text_input_context_;
     76   std::string last_activated_property_;
     77   std::string last_set_surrounding_text_;
     78   uint32 last_set_surrounding_cursor_pos_;
     79   uint32 last_set_surrounding_anchor_pos_;
     80   scoped_ptr<ui::KeyEvent> last_processed_key_event_;
     81   KeyEventDoneCallback last_passed_callback_;
     82 };
     83 
     84 }  // namespace chromeos
     85 
     86 #endif  // UI_BASE_IME_CHROMEOS_MOCK_IME_ENGINE_HANDLER_H_
     87