OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #include "ui/base/ime/remote_input_method_win.h" | 5 #include "ui/base/ime/remote_input_method_win.h" |
6 | 6 |
7 #include <InputScope.h> | 7 #include <InputScope.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 virtual void InsertText(const base::string16& text) override { | 97 virtual void InsertText(const base::string16& text) override { |
98 inserted_text_.append(text); | 98 inserted_text_.append(text); |
99 ++call_count_insert_text_; | 99 ++call_count_insert_text_; |
100 } | 100 } |
101 virtual ui::TextInputType GetTextInputType() const override { | 101 virtual ui::TextInputType GetTextInputType() const override { |
102 return text_input_type_; | 102 return text_input_type_; |
103 } | 103 } |
104 virtual ui::TextInputMode GetTextInputMode() const override { | 104 virtual ui::TextInputMode GetTextInputMode() const override { |
105 return text_input_mode_; | 105 return text_input_mode_; |
106 } | 106 } |
107 virtual gfx::Rect GetCaretBounds() const { | 107 virtual gfx::Rect GetCaretBounds() const override { return caret_bounds_; } |
108 return caret_bounds_; | |
109 } | |
110 virtual bool GetCompositionCharacterBounds(uint32 index, | 108 virtual bool GetCompositionCharacterBounds(uint32 index, |
111 gfx::Rect* rect) const override { | 109 gfx::Rect* rect) const override { |
112 // Emulate the situation of crbug.com/328237. | 110 // Emulate the situation of crbug.com/328237. |
113 if (emulate_pepper_flash_) | 111 if (emulate_pepper_flash_) |
114 return false; | 112 return false; |
115 if (!rect || composition_character_bounds_.size() <= index) | 113 if (!rect || composition_character_bounds_.size() <= index) |
116 return false; | 114 return false; |
117 *rect = composition_character_bounds_[index]; | 115 *rect = composition_character_bounds_[index]; |
118 return true; | 116 return true; |
119 } | 117 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 virtual void OnBlur() override { | 242 virtual void OnBlur() override { |
245 } | 243 } |
246 virtual void OnCaretBoundsChanged(const TextInputClient* client) override { | 244 virtual void OnCaretBoundsChanged(const TextInputClient* client) override { |
247 } | 245 } |
248 virtual void OnTextInputStateChanged(const TextInputClient* client) override { | 246 virtual void OnTextInputStateChanged(const TextInputClient* client) override { |
249 ++on_text_input_state_changed_; | 247 ++on_text_input_state_changed_; |
250 } | 248 } |
251 virtual void OnInputMethodDestroyed(const InputMethod* client) override { | 249 virtual void OnInputMethodDestroyed(const InputMethod* client) override { |
252 ++on_input_method_destroyed_changed_; | 250 ++on_input_method_destroyed_changed_; |
253 } | 251 } |
254 virtual void OnShowImeIfNeeded() { | 252 virtual void OnShowImeIfNeeded() override {} |
255 } | |
256 | 253 |
257 size_t on_text_input_state_changed_; | 254 size_t on_text_input_state_changed_; |
258 size_t on_input_method_destroyed_changed_; | 255 size_t on_input_method_destroyed_changed_; |
259 DISALLOW_COPY_AND_ASSIGN(MockInputMethodObserver); | 256 DISALLOW_COPY_AND_ASSIGN(MockInputMethodObserver); |
260 }; | 257 }; |
261 | 258 |
262 typedef ScopedObserver<InputMethod, InputMethodObserver> | 259 typedef ScopedObserver<InputMethod, InputMethodObserver> |
263 InputMethodScopedObserver; | 260 InputMethodScopedObserver; |
264 | 261 |
265 TEST(RemoteInputMethodWinTest, RemoteInputMethodPrivateWin) { | 262 TEST(RemoteInputMethodWinTest, RemoteInputMethodPrivateWin) { |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 scoped_ptr<InputMethod> input_method(CreateRemoteInputMethodWin(&delegate_)); | 834 scoped_ptr<InputMethod> input_method(CreateRemoteInputMethodWin(&delegate_)); |
838 input_method->AddObserver(&input_method_observer); | 835 input_method->AddObserver(&input_method_observer); |
839 | 836 |
840 EXPECT_EQ(0u, input_method_observer.on_input_method_destroyed_changed()); | 837 EXPECT_EQ(0u, input_method_observer.on_input_method_destroyed_changed()); |
841 input_method.reset(); | 838 input_method.reset(); |
842 EXPECT_EQ(1u, input_method_observer.on_input_method_destroyed_changed()); | 839 EXPECT_EQ(1u, input_method_observer.on_input_method_destroyed_changed()); |
843 } | 840 } |
844 | 841 |
845 } // namespace | 842 } // namespace |
846 } // namespace ui | 843 } // namespace ui |
OLD | NEW |