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

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

Issue 2298123003: Using input language instead of the application locale to determine the Omnibox's text input type o… (Closed)
Patch Set: fix compiling errors in mus. Created 4 years, 3 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
« no previous file with comments | « ui/base/ime/win/imm32_manager.cc ('k') | ui/views/mus/input_method_mus.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 MockInputMethod(); 76 MockInputMethod();
77 ~MockInputMethod() override; 77 ~MockInputMethod() override;
78 78
79 // Overridden from InputMethod: 79 // Overridden from InputMethod:
80 bool OnUntranslatedIMEMessage(const base::NativeEvent& event, 80 bool OnUntranslatedIMEMessage(const base::NativeEvent& event,
81 NativeEventResult* result) override; 81 NativeEventResult* result) override;
82 void DispatchKeyEvent(ui::KeyEvent* key) override; 82 void DispatchKeyEvent(ui::KeyEvent* key) override;
83 void OnTextInputTypeChanged(const ui::TextInputClient* client) override; 83 void OnTextInputTypeChanged(const ui::TextInputClient* client) override;
84 void OnCaretBoundsChanged(const ui::TextInputClient* client) override {} 84 void OnCaretBoundsChanged(const ui::TextInputClient* client) override {}
85 void CancelComposition(const ui::TextInputClient* client) override; 85 void CancelComposition(const ui::TextInputClient* client) override;
86 void OnInputLocaleChanged() override {}
87 std::string GetInputLocale() override;
88 bool IsCandidatePopupOpen() const override; 86 bool IsCandidatePopupOpen() const override;
89 void ShowImeIfNeeded() override {} 87 void ShowImeIfNeeded() override {}
90 88
91 bool untranslated_ime_message_called() const { 89 bool untranslated_ime_message_called() const {
92 return untranslated_ime_message_called_; 90 return untranslated_ime_message_called_;
93 } 91 }
94 bool text_input_type_changed() const { return text_input_type_changed_; } 92 bool text_input_type_changed() const { return text_input_type_changed_; }
95 bool cancel_composition_called() const { return cancel_composition_called_; } 93 bool cancel_composition_called() const { return cancel_composition_called_; }
96 94
97 // Clears all internal states and result. 95 // Clears all internal states and result.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 InputMethodBase::OnTextInputTypeChanged(client); 202 InputMethodBase::OnTextInputTypeChanged(client);
205 } 203 }
206 204
207 void MockInputMethod::CancelComposition(const ui::TextInputClient* client) { 205 void MockInputMethod::CancelComposition(const ui::TextInputClient* client) {
208 if (IsTextInputClientFocused(client)) { 206 if (IsTextInputClientFocused(client)) {
209 cancel_composition_called_ = true; 207 cancel_composition_called_ = true;
210 ClearComposition(); 208 ClearComposition();
211 } 209 }
212 } 210 }
213 211
214 std::string MockInputMethod::GetInputLocale() {
215 return "en-US";
216 }
217
218 bool MockInputMethod::IsCandidatePopupOpen() const { 212 bool MockInputMethod::IsCandidatePopupOpen() const {
219 return false; 213 return false;
220 } 214 }
221 215
222 void MockInputMethod::OnWillChangeFocusedClient( 216 void MockInputMethod::OnWillChangeFocusedClient(
223 ui::TextInputClient* focused_before, 217 ui::TextInputClient* focused_before,
224 ui::TextInputClient* focused) { 218 ui::TextInputClient* focused) {
225 ui::TextInputClient* client = GetTextInputClient(); 219 ui::TextInputClient* client = GetTextInputClient();
226 if (client && client->HasCompositionText()) 220 if (client && client->HasCompositionText())
227 client->ConfirmCompositionText(); 221 client->ConfirmCompositionText();
(...skipping 2707 matching lines...) Expand 10 before | Expand all | Expand 10 after
2935 2929
2936 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); 2930 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
2937 ui::AXViewState state_protected; 2931 ui::AXViewState state_protected;
2938 textfield_->GetAccessibleState(&state_protected); 2932 textfield_->GetAccessibleState(&state_protected);
2939 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); 2933 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role);
2940 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); 2934 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value);
2941 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); 2935 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED));
2942 } 2936 }
2943 2937
2944 } // namespace views 2938 } // namespace views
OLDNEW
« no previous file with comments | « ui/base/ime/win/imm32_manager.cc ('k') | ui/views/mus/input_method_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698