OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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_WIN_MOCK_TSF_BRIDGE_H_ |
| 6 #define UI_BASE_WIN_MOCK_TSF_BRIDGE_H_ |
| 7 |
| 8 #include "base/compiler_specific.h" |
| 9 #include "ui/base/ime/text_input_type.h" |
| 10 #include "ui/base/win/tsf_bridge.h" |
| 11 |
| 12 namespace ui { |
| 13 |
| 14 class MockTsfBridge : public TsfBridge { |
| 15 public: |
| 16 MockTsfBridge(); |
| 17 virtual ~MockTsfBridge(); |
| 18 |
| 19 // TsfBridge override. |
| 20 virtual void Shutdown() OVERRIDE; |
| 21 |
| 22 // TsfBridge override. |
| 23 virtual bool CancelComposition() OVERRIDE; |
| 24 |
| 25 // TsfBridge override. |
| 26 virtual void OnTextInputTypeChanged(TextInputClient* client) OVERRIDE; |
| 27 |
| 28 // TsfBridge override. |
| 29 virtual void SetFocusedClient(HWND focused_window, |
| 30 TextInputClient* client) OVERRIDE; |
| 31 |
| 32 // TsfBridge override. |
| 33 virtual void RemoveFocusedClient(TextInputClient* client) OVERRIDE; |
| 34 |
| 35 // Resets MockTsfBridge state including function call counter. |
| 36 void Reset(); |
| 37 |
| 38 // Call count of Shutdown(). |
| 39 int shutdown_call_count() const { return shutdown_call_count_; } |
| 40 |
| 41 // Call count of EnableIME(). |
| 42 int enable_ime_call_count() const { return enable_ime_call_count_; } |
| 43 |
| 44 // Call count of DisableIME(). |
| 45 int disalbe_ime_call_count() const { return disalbe_ime_call_count_; } |
| 46 |
| 47 // Call count of CancelComposition(). |
| 48 int cancel_composition_call_count() const { |
| 49 return cancel_composition_call_count_; |
| 50 } |
| 51 |
| 52 // Call count of AssociateFocus(). |
| 53 int associate_focus_call_count() const { return associate_focus_call_count_; } |
| 54 |
| 55 // Call count of SetFocusClient(). |
| 56 int set_focused_client_call_count() const { |
| 57 return set_focused_client_call_count_; |
| 58 } |
| 59 |
| 60 // Call count of Shutdown(). |
| 61 int remove_focused_client_call_count() const { |
| 62 return remove_focused_client_call_count_; |
| 63 } |
| 64 |
| 65 // Returns current TextInputClient. |
| 66 TextInputClient* text_input_clinet() const { return text_input_client_; } |
| 67 |
| 68 // Returns currently focused window handle. |
| 69 HWND focused_window() const { return focused_window_; } |
| 70 |
| 71 // Returns latest text input type. |
| 72 TextInputType latest_text_iput_type() const { |
| 73 return latest_text_input_type_; |
| 74 } |
| 75 |
| 76 private: |
| 77 int shutdown_call_count_; |
| 78 int enable_ime_call_count_; |
| 79 int disalbe_ime_call_count_; |
| 80 int cancel_composition_call_count_; |
| 81 int associate_focus_call_count_; |
| 82 int set_focused_client_call_count_; |
| 83 int remove_focused_client_call_count_; |
| 84 TextInputClient* text_input_client_; |
| 85 HWND focused_window_; |
| 86 TextInputType latest_text_input_type_; |
| 87 |
| 88 DISALLOW_COPY_AND_ASSIGN(MockTsfBridge); |
| 89 }; |
| 90 |
| 91 } // namespace ui |
| 92 |
| 93 #endif // UI_BASE_WIN_MOCK_TSF_BRIDGE_H_ |
OLD | NEW |