OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_BASE_IME_WIN_MOCK_TSF_BRIDGE_H_ | 5 #ifndef UI_BASE_IME_WIN_MOCK_TSF_BRIDGE_H_ |
6 #define UI_BASE_IME_WIN_MOCK_TSF_BRIDGE_H_ | 6 #define UI_BASE_IME_WIN_MOCK_TSF_BRIDGE_H_ |
7 | 7 |
8 #include <msctf.h> | 8 #include <msctf.h> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/win/scoped_comptr.h" | 11 #include "base/win/scoped_comptr.h" |
12 #include "ui/base/ime/text_input_type.h" | 12 #include "ui/base/ime/text_input_type.h" |
13 #include "ui/base/ime/win/tsf_bridge.h" | 13 #include "ui/base/ime/win/tsf_bridge.h" |
14 | 14 |
15 namespace ui { | 15 namespace ui { |
16 | 16 |
17 class MockTSFBridge : public TSFBridge { | 17 class MockTSFBridge : public TSFBridge { |
18 public: | 18 public: |
19 MockTSFBridge(); | 19 MockTSFBridge(); |
20 virtual ~MockTSFBridge(); | 20 virtual ~MockTSFBridge(); |
21 | 21 |
22 // TSFBridge: | 22 // TSFBridge: |
23 virtual void Shutdown() OVERRIDE; | |
24 virtual bool CancelComposition() OVERRIDE; | 23 virtual bool CancelComposition() OVERRIDE; |
25 virtual void OnTextInputTypeChanged(TextInputClient* client) OVERRIDE; | 24 virtual void OnTextInputTypeChanged(TextInputClient* client) OVERRIDE; |
26 virtual void OnTextLayoutChanged() OVERRIDE; | 25 virtual void OnTextLayoutChanged() OVERRIDE; |
27 virtual void SetFocusedClient(HWND focused_window, | 26 virtual void SetFocusedClient(HWND focused_window, |
28 TextInputClient* client) OVERRIDE; | 27 TextInputClient* client) OVERRIDE; |
29 virtual void RemoveFocusedClient(TextInputClient* client) OVERRIDE; | 28 virtual void RemoveFocusedClient(TextInputClient* client) OVERRIDE; |
30 virtual base::win::ScopedComPtr<ITfThreadMgr> GetThreadManager() OVERRIDE; | 29 virtual base::win::ScopedComPtr<ITfThreadMgr> GetThreadManager() OVERRIDE; |
31 virtual TextInputClient* GetFocusedTextInputClient() const OVERRIDE; | 30 virtual TextInputClient* GetFocusedTextInputClient() const OVERRIDE; |
32 | 31 |
33 // Resets MockTSFBridge state including function call counter. | 32 // Resets MockTSFBridge state including function call counter. |
34 void Reset(); | 33 void Reset(); |
35 | 34 |
36 // Call count of Shutdown(). | |
37 int shutdown_call_count() const { return shutdown_call_count_; } | |
38 | |
39 // Call count of EnableIME(). | 35 // Call count of EnableIME(). |
40 int enable_ime_call_count() const { return enable_ime_call_count_; } | 36 int enable_ime_call_count() const { return enable_ime_call_count_; } |
41 | 37 |
42 // Call count of DisableIME(). | 38 // Call count of DisableIME(). |
43 int disalbe_ime_call_count() const { return disalbe_ime_call_count_; } | 39 int disalbe_ime_call_count() const { return disalbe_ime_call_count_; } |
44 | 40 |
45 // Call count of CancelComposition(). | 41 // Call count of CancelComposition(). |
46 int cancel_composition_call_count() const { | 42 int cancel_composition_call_count() const { |
47 return cancel_composition_call_count_; | 43 return cancel_composition_call_count_; |
48 } | 44 } |
(...skipping 21 matching lines...) Expand all Loading... |
70 | 66 |
71 // Returns currently focused window handle. | 67 // Returns currently focused window handle. |
72 HWND focused_window() const { return focused_window_; } | 68 HWND focused_window() const { return focused_window_; } |
73 | 69 |
74 // Returns latest text input type. | 70 // Returns latest text input type. |
75 TextInputType latest_text_iput_type() const { | 71 TextInputType latest_text_iput_type() const { |
76 return latest_text_input_type_; | 72 return latest_text_input_type_; |
77 } | 73 } |
78 | 74 |
79 private: | 75 private: |
80 int shutdown_call_count_; | |
81 int enable_ime_call_count_; | 76 int enable_ime_call_count_; |
82 int disalbe_ime_call_count_; | 77 int disalbe_ime_call_count_; |
83 int cancel_composition_call_count_; | 78 int cancel_composition_call_count_; |
84 int on_text_layout_changed_; | 79 int on_text_layout_changed_; |
85 int associate_focus_call_count_; | 80 int associate_focus_call_count_; |
86 int set_focused_client_call_count_; | 81 int set_focused_client_call_count_; |
87 int remove_focused_client_call_count_; | 82 int remove_focused_client_call_count_; |
88 TextInputClient* text_input_client_; | 83 TextInputClient* text_input_client_; |
89 HWND focused_window_; | 84 HWND focused_window_; |
90 TextInputType latest_text_input_type_; | 85 TextInputType latest_text_input_type_; |
91 base::win::ScopedComPtr<ITfThreadMgr> thread_manager_; | 86 base::win::ScopedComPtr<ITfThreadMgr> thread_manager_; |
92 | 87 |
93 DISALLOW_COPY_AND_ASSIGN(MockTSFBridge); | 88 DISALLOW_COPY_AND_ASSIGN(MockTSFBridge); |
94 }; | 89 }; |
95 | 90 |
96 } // namespace ui | 91 } // namespace ui |
97 | 92 |
98 #endif // UI_BASE_IME_WIN_MOCK_TSF_BRIDGE_H_ | 93 #endif // UI_BASE_IME_WIN_MOCK_TSF_BRIDGE_H_ |
OLD | NEW |