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