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 bool CancelComposition() OVERRIDE; | 23 virtual bool CancelComposition() OVERRIDE; |
| 24 virtual bool ConfirmComposition() OVERRIDE; |
24 virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; | 25 virtual void OnTextInputTypeChanged(const TextInputClient* client) OVERRIDE; |
25 virtual void OnTextLayoutChanged() OVERRIDE; | 26 virtual void OnTextLayoutChanged() OVERRIDE; |
26 virtual void SetFocusedClient(HWND focused_window, | 27 virtual void SetFocusedClient(HWND focused_window, |
27 TextInputClient* client) OVERRIDE; | 28 TextInputClient* client) OVERRIDE; |
28 virtual void RemoveFocusedClient(TextInputClient* client) OVERRIDE; | 29 virtual void RemoveFocusedClient(TextInputClient* client) OVERRIDE; |
29 virtual base::win::ScopedComPtr<ITfThreadMgr> GetThreadManager() OVERRIDE; | 30 virtual base::win::ScopedComPtr<ITfThreadMgr> GetThreadManager() OVERRIDE; |
30 virtual TextInputClient* GetFocusedTextInputClient() const OVERRIDE; | 31 virtual TextInputClient* GetFocusedTextInputClient() const OVERRIDE; |
31 | 32 |
32 // Resets MockTSFBridge state including function call counter. | 33 // Resets MockTSFBridge state including function call counter. |
33 void Reset(); | 34 void Reset(); |
34 | 35 |
35 // Call count of EnableIME(). | 36 // Call count of EnableIME(). |
36 int enable_ime_call_count() const { return enable_ime_call_count_; } | 37 int enable_ime_call_count() const { return enable_ime_call_count_; } |
37 | 38 |
38 // Call count of DisableIME(). | 39 // Call count of DisableIME(). |
39 int disalbe_ime_call_count() const { return disalbe_ime_call_count_; } | 40 int disalbe_ime_call_count() const { return disalbe_ime_call_count_; } |
40 | 41 |
41 // Call count of CancelComposition(). | 42 // Call count of CancelComposition(). |
42 int cancel_composition_call_count() const { | 43 int cancel_composition_call_count() const { |
43 return cancel_composition_call_count_; | 44 return cancel_composition_call_count_; |
44 } | 45 } |
45 | 46 |
| 47 // Call count of ConfirmComposition(). |
| 48 int confirm_composition_call_count() const { |
| 49 return confirm_composition_call_count_; |
| 50 } |
| 51 |
46 // Call count of OnTextLayoutChanged(). | 52 // Call count of OnTextLayoutChanged(). |
47 int on_text_layout_changed() const { | 53 int on_text_layout_changed() const { |
48 return on_text_layout_changed_; | 54 return on_text_layout_changed_; |
49 } | 55 } |
50 | 56 |
51 // Call count of AssociateFocus(). | 57 // Call count of AssociateFocus(). |
52 int associate_focus_call_count() const { return associate_focus_call_count_; } | 58 int associate_focus_call_count() const { return associate_focus_call_count_; } |
53 | 59 |
54 // Call count of SetFocusClient(). | 60 // Call count of SetFocusClient(). |
55 int set_focused_client_call_count() const { | 61 int set_focused_client_call_count() const { |
(...skipping 13 matching lines...) Expand all Loading... |
69 | 75 |
70 // Returns latest text input type. | 76 // Returns latest text input type. |
71 TextInputType latest_text_iput_type() const { | 77 TextInputType latest_text_iput_type() const { |
72 return latest_text_input_type_; | 78 return latest_text_input_type_; |
73 } | 79 } |
74 | 80 |
75 private: | 81 private: |
76 int enable_ime_call_count_; | 82 int enable_ime_call_count_; |
77 int disalbe_ime_call_count_; | 83 int disalbe_ime_call_count_; |
78 int cancel_composition_call_count_; | 84 int cancel_composition_call_count_; |
| 85 int confirm_composition_call_count_; |
79 int on_text_layout_changed_; | 86 int on_text_layout_changed_; |
80 int associate_focus_call_count_; | 87 int associate_focus_call_count_; |
81 int set_focused_client_call_count_; | 88 int set_focused_client_call_count_; |
82 int remove_focused_client_call_count_; | 89 int remove_focused_client_call_count_; |
83 TextInputClient* text_input_client_; | 90 TextInputClient* text_input_client_; |
84 HWND focused_window_; | 91 HWND focused_window_; |
85 TextInputType latest_text_input_type_; | 92 TextInputType latest_text_input_type_; |
86 base::win::ScopedComPtr<ITfThreadMgr> thread_manager_; | 93 base::win::ScopedComPtr<ITfThreadMgr> thread_manager_; |
87 | 94 |
88 DISALLOW_COPY_AND_ASSIGN(MockTSFBridge); | 95 DISALLOW_COPY_AND_ASSIGN(MockTSFBridge); |
89 }; | 96 }; |
90 | 97 |
91 } // namespace ui | 98 } // namespace ui |
92 | 99 |
93 #endif // UI_BASE_IME_WIN_MOCK_TSF_BRIDGE_H_ | 100 #endif // UI_BASE_IME_WIN_MOCK_TSF_BRIDGE_H_ |
OLD | NEW |