| 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 <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 } | 720 } |
| 721 | 721 |
| 722 TEST_F(TextfieldTest, KeysWithModifiersTest) { | 722 TEST_F(TextfieldTest, KeysWithModifiersTest) { |
| 723 InitTextfield(); | 723 InitTextfield(); |
| 724 const int ctrl = ui::EF_CONTROL_DOWN; | 724 const int ctrl = ui::EF_CONTROL_DOWN; |
| 725 const int alt = ui::EF_ALT_DOWN; | 725 const int alt = ui::EF_ALT_DOWN; |
| 726 const int command = ui::EF_COMMAND_DOWN; | 726 const int command = ui::EF_COMMAND_DOWN; |
| 727 const int altgr = ui::EF_ALTGR_DOWN; | 727 const int altgr = ui::EF_ALTGR_DOWN; |
| 728 const int shift = ui::EF_SHIFT_DOWN; | 728 const int shift = ui::EF_SHIFT_DOWN; |
| 729 | 729 |
| 730 SendKeyPress(ui::VKEY_T, shift | alt | altgr); |
| 731 SendKeyPress(ui::VKEY_H, alt); |
| 732 SendKeyPress(ui::VKEY_E, altgr); |
| 730 SendKeyPress(ui::VKEY_T, shift); | 733 SendKeyPress(ui::VKEY_T, shift); |
| 731 SendKeyPress(ui::VKEY_E, shift | altgr); | 734 SendKeyPress(ui::VKEY_E, shift | altgr); |
| 732 SendKeyPress(ui::VKEY_X, 0); | 735 SendKeyPress(ui::VKEY_X, 0); |
| 733 SendKeyPress(ui::VKEY_T, ctrl); | 736 SendKeyPress(ui::VKEY_T, ctrl); |
| 734 SendKeyPress(ui::VKEY_1, alt); | 737 SendKeyPress(ui::VKEY_1, alt); |
| 735 SendKeyPress(ui::VKEY_2, command); | 738 SendKeyPress(ui::VKEY_2, command); |
| 736 SendKeyPress(ui::VKEY_3, 0); | 739 SendKeyPress(ui::VKEY_3, 0); |
| 737 SendKeyPress(ui::VKEY_4, 0); | 740 SendKeyPress(ui::VKEY_4, 0); |
| 738 | 741 |
| 739 if (TestingNativeCrOs()) | 742 if (TestingNativeCrOs()) |
| 740 EXPECT_STR_EQ("TEx34", textfield_->text()); | 743 EXPECT_STR_EQ("TeTEx34", textfield_->text()); |
| 741 else | 744 else |
| 742 EXPECT_STR_EQ("TEx234", textfield_->text()); | 745 EXPECT_STR_EQ("TeTEx234", textfield_->text()); |
| 743 } | 746 } |
| 744 | 747 |
| 745 TEST_F(TextfieldTest, ControlAndSelectTest) { | 748 TEST_F(TextfieldTest, ControlAndSelectTest) { |
| 746 // Insert a test string in a textfield. | 749 // Insert a test string in a textfield. |
| 747 InitTextfield(); | 750 InitTextfield(); |
| 748 textfield_->SetText(ASCIIToUTF16("one two three")); | 751 textfield_->SetText(ASCIIToUTF16("one two three")); |
| 749 SendHomeEvent(false); | 752 SendHomeEvent(false); |
| 750 SendKeyEvent(ui::VKEY_RIGHT, true, false); | 753 SendKeyEvent(ui::VKEY_RIGHT, true, false); |
| 751 SendKeyEvent(ui::VKEY_RIGHT, true, false); | 754 SendKeyEvent(ui::VKEY_RIGHT, true, false); |
| 752 SendKeyEvent(ui::VKEY_RIGHT, true, false); | 755 SendKeyEvent(ui::VKEY_RIGHT, true, false); |
| (...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2586 | 2589 |
| 2587 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); | 2590 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
| 2588 ui::AXViewState state_protected; | 2591 ui::AXViewState state_protected; |
| 2589 textfield_->GetAccessibleState(&state_protected); | 2592 textfield_->GetAccessibleState(&state_protected); |
| 2590 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); | 2593 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); |
| 2591 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); | 2594 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); |
| 2592 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); | 2595 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); |
| 2593 } | 2596 } |
| 2594 | 2597 |
| 2595 } // namespace views | 2598 } // namespace views |
| OLD | NEW |