Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: ui/views/controls/textfield/textfield_unittest.cc

Issue 1234193002: Simplify InputMethodWin initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed test failures on Android. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/views/controls/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // Overridden from InputMethod: 70 // Overridden from InputMethod:
71 bool OnUntranslatedIMEMessage(const base::NativeEvent& event, 71 bool OnUntranslatedIMEMessage(const base::NativeEvent& event,
72 NativeEventResult* result) override; 72 NativeEventResult* result) override;
73 bool DispatchKeyEvent(const ui::KeyEvent& key) override; 73 bool DispatchKeyEvent(const ui::KeyEvent& key) override;
74 void OnTextInputTypeChanged(const ui::TextInputClient* client) override; 74 void OnTextInputTypeChanged(const ui::TextInputClient* client) override;
75 void OnCaretBoundsChanged(const ui::TextInputClient* client) override {} 75 void OnCaretBoundsChanged(const ui::TextInputClient* client) override {}
76 void CancelComposition(const ui::TextInputClient* client) override; 76 void CancelComposition(const ui::TextInputClient* client) override;
77 void OnInputLocaleChanged() override {} 77 void OnInputLocaleChanged() override {}
78 std::string GetInputLocale() override; 78 std::string GetInputLocale() override;
79 bool IsActive() override;
80 bool IsCandidatePopupOpen() const override; 79 bool IsCandidatePopupOpen() const override;
81 void ShowImeIfNeeded() override {} 80 void ShowImeIfNeeded() override {}
82 81
83 bool untranslated_ime_message_called() const { 82 bool untranslated_ime_message_called() const {
84 return untranslated_ime_message_called_; 83 return untranslated_ime_message_called_;
85 } 84 }
86 bool text_input_type_changed() const { return text_input_type_changed_; } 85 bool text_input_type_changed() const { return text_input_type_changed_; }
87 bool cancel_composition_called() const { return cancel_composition_called_; } 86 bool cancel_composition_called() const { return cancel_composition_called_; }
88 87
89 // Clears all internal states and result. 88 // Clears all internal states and result.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 if (IsTextInputClientFocused(client)) { 186 if (IsTextInputClientFocused(client)) {
188 cancel_composition_called_ = true; 187 cancel_composition_called_ = true;
189 ClearComposition(); 188 ClearComposition();
190 } 189 }
191 } 190 }
192 191
193 std::string MockInputMethod::GetInputLocale() { 192 std::string MockInputMethod::GetInputLocale() {
194 return "en-US"; 193 return "en-US";
195 } 194 }
196 195
197 bool MockInputMethod::IsActive() {
198 return true;
199 }
200
201 bool MockInputMethod::IsCandidatePopupOpen() const { 196 bool MockInputMethod::IsCandidatePopupOpen() const {
202 return false; 197 return false;
203 } 198 }
204 199
205 void MockInputMethod::OnWillChangeFocusedClient( 200 void MockInputMethod::OnWillChangeFocusedClient(
206 ui::TextInputClient* focused_before, 201 ui::TextInputClient* focused_before,
207 ui::TextInputClient* focused) { 202 ui::TextInputClient* focused) {
208 ui::TextInputClient* client = GetTextInputClient(); 203 ui::TextInputClient* client = GetTextInputClient();
209 if (client && client->HasCompositionText()) 204 if (client && client->HasCompositionText())
210 client->ConfirmCompositionText(); 205 client->ConfirmCompositionText();
(...skipping 2327 matching lines...) Expand 10 before | Expand all | Expand 10 after
2538 2533
2539 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); 2534 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
2540 ui::AXViewState state_protected; 2535 ui::AXViewState state_protected;
2541 textfield_->GetAccessibleState(&state_protected); 2536 textfield_->GetAccessibleState(&state_protected);
2542 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); 2537 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role);
2543 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); 2538 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value);
2544 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); 2539 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED));
2545 } 2540 }
2546 2541
2547 } // namespace views 2542 } // namespace views
OLDNEW
« ui/base/ime/win/imm32_manager.cc ('K') | « ui/base/ime/win/imm32_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698