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

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

Issue 2353333002: Reland of Force U.S. English keyboard layout for TextfieldTest.KeysWithModifiersTest (Closed)
Patch Set: Use ScopedCFTypeRef instead of PlatformKeyboardLayout Created 4 years, 2 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/events/test/keyboard_layout_win.cc ('k') | no next file » | 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 18 matching lines...) Expand all
29 #include "ui/base/ime/input_method_factory.h" 29 #include "ui/base/ime/input_method_factory.h"
30 #include "ui/base/ime/text_edit_commands.h" 30 #include "ui/base/ime/text_edit_commands.h"
31 #include "ui/base/ime/text_input_client.h" 31 #include "ui/base/ime/text_input_client.h"
32 #include "ui/base/ui_base_switches.h" 32 #include "ui/base/ui_base_switches.h"
33 #include "ui/base/ui_base_switches_util.h" 33 #include "ui/base/ui_base_switches_util.h"
34 #include "ui/events/event.h" 34 #include "ui/events/event.h"
35 #include "ui/events/event_processor.h" 35 #include "ui/events/event_processor.h"
36 #include "ui/events/event_utils.h" 36 #include "ui/events/event_utils.h"
37 #include "ui/events/keycodes/keyboard_codes.h" 37 #include "ui/events/keycodes/keyboard_codes.h"
38 #include "ui/events/test/event_generator.h" 38 #include "ui/events/test/event_generator.h"
39 #include "ui/events/test/keyboard_layout.h"
39 #include "ui/gfx/render_text.h" 40 #include "ui/gfx/render_text.h"
40 #include "ui/strings/grit/ui_strings.h" 41 #include "ui/strings/grit/ui_strings.h"
41 #include "ui/views/controls/textfield/textfield_controller.h" 42 #include "ui/views/controls/textfield/textfield_controller.h"
42 #include "ui/views/controls/textfield/textfield_model.h" 43 #include "ui/views/controls/textfield/textfield_model.h"
43 #include "ui/views/controls/textfield/textfield_test_api.h" 44 #include "ui/views/controls/textfield/textfield_test_api.h"
44 #include "ui/views/focus/focus_manager.h" 45 #include "ui/views/focus/focus_manager.h"
45 #include "ui/views/style/platform_style.h" 46 #include "ui/views/style/platform_style.h"
46 #include "ui/views/test/test_views_delegate.h" 47 #include "ui/views/test/test_views_delegate.h"
47 #include "ui/views/test/views_test_base.h" 48 #include "ui/views/test/views_test_base.h"
48 #include "ui/views/test/widget_test.h" 49 #include "ui/views/test/widget_test.h"
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 SendKeyEvent(ui::VKEY_1, false, true, false, true); 753 SendKeyEvent(ui::VKEY_1, false, true, false, true);
753 SendKeyEvent(ui::VKEY_1, false, false, false, true); 754 SendKeyEvent(ui::VKEY_1, false, false, false, true);
754 755
755 // On Mac, Caps+Shift remains uppercase. 756 // On Mac, Caps+Shift remains uppercase.
756 if (TestingNativeMac()) 757 if (TestingNativeMac())
757 EXPECT_STR_EQ("TeXT!1!1", textfield_->text()); 758 EXPECT_STR_EQ("TeXT!1!1", textfield_->text());
758 else 759 else
759 EXPECT_STR_EQ("TexT!1!1", textfield_->text()); 760 EXPECT_STR_EQ("TexT!1!1", textfield_->text());
760 } 761 }
761 762
762 TEST_F(TextfieldTest, KeysWithModifiersTest) { 763 #if defined(OS_WIN) || defined(OS_MACOSX)
764 #define MAYBE_KeysWithModifiersTest KeysWithModifiersTest
765 #else
766 // TODO(crbug.com/645104): Implement keyboard layout changing for other
767 // platforms.
768 #define MAYBE_KeysWithModifiersTest DISABLED_KeysWithModifiersTest
769 #endif
770
771 TEST_F(TextfieldTest, MAYBE_KeysWithModifiersTest) {
772 // Activate U.S. English keyboard layout. Modifier keys in other layouts may
773 // change the text inserted into a texfield and cause this test to fail.
774 ui::ScopedKeyboardLayout keyboard_layout(ui::KEYBOARD_LAYOUT_ENGLISH_US);
775
763 InitTextfield(); 776 InitTextfield();
764 const int ctrl = ui::EF_CONTROL_DOWN; 777 const int ctrl = ui::EF_CONTROL_DOWN;
765 const int alt = ui::EF_ALT_DOWN; 778 const int alt = ui::EF_ALT_DOWN;
766 const int command = ui::EF_COMMAND_DOWN; 779 const int command = ui::EF_COMMAND_DOWN;
767 const int altgr = ui::EF_ALTGR_DOWN; 780 const int altgr = ui::EF_ALTGR_DOWN;
768 const int shift = ui::EF_SHIFT_DOWN; 781 const int shift = ui::EF_SHIFT_DOWN;
769 782
770 SendKeyPress(ui::VKEY_T, shift | alt | altgr); 783 SendKeyPress(ui::VKEY_T, shift | alt | altgr);
771 SendKeyPress(ui::VKEY_H, alt); 784 SendKeyPress(ui::VKEY_H, alt);
772 SendKeyPress(ui::VKEY_E, altgr); 785 SendKeyPress(ui::VKEY_E, altgr);
(...skipping 2209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2982 2995
2983 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); 2996 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
2984 ui::AXViewState state_protected; 2997 ui::AXViewState state_protected;
2985 textfield_->GetAccessibleState(&state_protected); 2998 textfield_->GetAccessibleState(&state_protected);
2986 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); 2999 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role);
2987 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); 3000 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value);
2988 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); 3001 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED));
2989 } 3002 }
2990 3003
2991 } // namespace views 3004 } // namespace views
OLDNEW
« no previous file with comments | « ui/events/test/keyboard_layout_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698