Chromium Code Reviews| 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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 801 SendKeyEvent(ui::VKEY_Z, true, false); | 801 SendKeyEvent(ui::VKEY_Z, true, false); |
| 802 SendKeyEvent(ui::VKEY_E, true, false); | 802 SendKeyEvent(ui::VKEY_E, true, false); |
| 803 SendKeyEvent(ui::VKEY_R, true, false); | 803 SendKeyEvent(ui::VKEY_R, true, false); |
| 804 SendKeyEvent(ui::VKEY_O, true, false); | 804 SendKeyEvent(ui::VKEY_O, true, false); |
| 805 SendKeyEvent(ui::VKEY_SPACE, false, false); | 805 SendKeyEvent(ui::VKEY_SPACE, false, false); |
| 806 EXPECT_STR_EQ("ZERO two three", textfield_->text()); | 806 EXPECT_STR_EQ("ZERO two three", textfield_->text()); |
| 807 | 807 |
| 808 SendEndEvent(true); | 808 SendEndEvent(true); |
| 809 EXPECT_STR_EQ("two three", textfield_->GetSelectedText()); | 809 EXPECT_STR_EQ("two three", textfield_->GetSelectedText()); |
| 810 SendHomeEvent(true); | 810 SendHomeEvent(true); |
| 811 | |
| 812 // On Mac, moving to beginning of line while selecting, extends the existing | |
|
tapted
2016/05/20 06:47:36
It's possible some of the existing behaviours are
karandeepb
2016/05/24 07:47:15
Have checked this, the existing behavior is correc
| |
| 813 // selection. | |
| 814 #if defined(OS_MACOSX) | |
| 815 EXPECT_STR_EQ("ZERO two three", textfield_->text()); | |
| 816 #else | |
| 811 EXPECT_STR_EQ("ZERO ", textfield_->GetSelectedText()); | 817 EXPECT_STR_EQ("ZERO ", textfield_->GetSelectedText()); |
| 818 #endif | |
| 812 } | 819 } |
| 813 | 820 |
| 814 TEST_F(TextfieldTest, InsertionDeletionTest) { | 821 TEST_F(TextfieldTest, InsertionDeletionTest) { |
| 815 // Insert a test string in a textfield. | 822 // Insert a test string in a textfield. |
| 816 InitTextfield(); | 823 InitTextfield(); |
| 817 for (size_t i = 0; i < 10; i++) | 824 for (size_t i = 0; i < 10; i++) |
| 818 SendKeyEvent(static_cast<ui::KeyboardCode>(ui::VKEY_A + i)); | 825 SendKeyEvent(static_cast<ui::KeyboardCode>(ui::VKEY_A + i)); |
| 819 EXPECT_STR_EQ("abcdefghij", textfield_->text()); | 826 EXPECT_STR_EQ("abcdefghij", textfield_->text()); |
| 820 | 827 |
| 821 // Test the delete and backspace keys. | 828 // Test the delete and backspace keys. |
| (...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2654 | 2661 |
| 2655 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); | 2662 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
| 2656 ui::AXViewState state_protected; | 2663 ui::AXViewState state_protected; |
| 2657 textfield_->GetAccessibleState(&state_protected); | 2664 textfield_->GetAccessibleState(&state_protected); |
| 2658 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); | 2665 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); |
| 2659 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); | 2666 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); |
| 2660 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); | 2667 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); |
| 2661 } | 2668 } |
| 2662 | 2669 |
| 2663 } // namespace views | 2670 } // namespace views |
| OLD | NEW |