OLD | NEW |
---|---|
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 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
762 SendKeyEvent(ui::VKEY_1, false, false, false, true); | 762 SendKeyEvent(ui::VKEY_1, false, false, false, true); |
763 | 763 |
764 // On Mac, Caps+Shift remains uppercase. | 764 // On Mac, Caps+Shift remains uppercase. |
765 if (TestingNativeMac()) | 765 if (TestingNativeMac()) |
766 EXPECT_STR_EQ("TeXT!1!1", textfield_->text()); | 766 EXPECT_STR_EQ("TeXT!1!1", textfield_->text()); |
767 else | 767 else |
768 EXPECT_STR_EQ("TexT!1!1", textfield_->text()); | 768 EXPECT_STR_EQ("TexT!1!1", textfield_->text()); |
769 } | 769 } |
770 | 770 |
771 TEST_F(TextfieldTest, KeysWithModifiersTest) { | 771 TEST_F(TextfieldTest, KeysWithModifiersTest) { |
772 #if defined(OS_WIN) | |
773 // Load U.S. English keyboard layout. Modifier keys in other layouts may | |
774 // change the text inserted into a texfield and cause this test to fail. | |
775 ::LoadKeyboardLayout(L"00000409", KLF_ACTIVATE); | |
Peter Kasting
2016/08/03 00:13:26
Don't you need to call ActivateKeyboardLayout() as
Tomasz Moniuszko
2016/08/18 15:18:10
Done. Code is now shared between chromedriver_test
| |
776 #endif | |
777 | |
772 InitTextfield(); | 778 InitTextfield(); |
773 const int ctrl = ui::EF_CONTROL_DOWN; | 779 const int ctrl = ui::EF_CONTROL_DOWN; |
774 const int alt = ui::EF_ALT_DOWN; | 780 const int alt = ui::EF_ALT_DOWN; |
775 const int command = ui::EF_COMMAND_DOWN; | 781 const int command = ui::EF_COMMAND_DOWN; |
776 const int altgr = ui::EF_ALTGR_DOWN; | 782 const int altgr = ui::EF_ALTGR_DOWN; |
777 const int shift = ui::EF_SHIFT_DOWN; | 783 const int shift = ui::EF_SHIFT_DOWN; |
778 | 784 |
779 SendKeyPress(ui::VKEY_T, shift | alt | altgr); | 785 SendKeyPress(ui::VKEY_T, shift | alt | altgr); |
780 SendKeyPress(ui::VKEY_H, alt); | 786 SendKeyPress(ui::VKEY_H, alt); |
781 SendKeyPress(ui::VKEY_E, altgr); | 787 SendKeyPress(ui::VKEY_E, altgr); |
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2753 | 2759 |
2754 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); | 2760 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
2755 ui::AXViewState state_protected; | 2761 ui::AXViewState state_protected; |
2756 textfield_->GetAccessibleState(&state_protected); | 2762 textfield_->GetAccessibleState(&state_protected); |
2757 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); | 2763 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); |
2758 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); | 2764 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); |
2759 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); | 2765 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); |
2760 } | 2766 } |
2761 | 2767 |
2762 } // namespace views | 2768 } // namespace views |
OLD | NEW |