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 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2504 | 2504 |
2505 // Disable textfield and tap on it. Touch text selection should not get | 2505 // Disable textfield and tap on it. Touch text selection should not get |
2506 // activated. | 2506 // activated. |
2507 textfield_->SetEnabled(false); | 2507 textfield_->SetEnabled(false); |
2508 Tap(touch_point); | 2508 Tap(touch_point); |
2509 EXPECT_FALSE(test_api_->touch_selection_controller()); | 2509 EXPECT_FALSE(test_api_->touch_selection_controller()); |
2510 textfield_->SetEnabled(true); | 2510 textfield_->SetEnabled(true); |
2511 | 2511 |
2512 // Make textfield unfocusable and tap on it. Touch text selection should not | 2512 // Make textfield unfocusable and tap on it. Touch text selection should not |
2513 // get activated. | 2513 // get activated. |
2514 textfield_->SetFocusable(false); | 2514 textfield_->SetFocusBehavior(views::View::FocusBehavior::NEVER); |
2515 Tap(touch_point); | 2515 Tap(touch_point); |
2516 EXPECT_FALSE(textfield_->HasFocus()); | 2516 EXPECT_FALSE(textfield_->HasFocus()); |
2517 EXPECT_FALSE(test_api_->touch_selection_controller()); | 2517 EXPECT_FALSE(test_api_->touch_selection_controller()); |
2518 textfield_->SetFocusable(true); | 2518 textfield_->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); |
2519 } | 2519 } |
2520 | 2520 |
2521 // No touch on desktop Mac. Tracked in http://crbug.com/445520. | 2521 // No touch on desktop Mac. Tracked in http://crbug.com/445520. |
2522 #if defined(OS_MACOSX) && !defined(USE_AURA) | 2522 #if defined(OS_MACOSX) && !defined(USE_AURA) |
2523 #define MAYBE_TapOnSelection DISABLED_TapOnSelection | 2523 #define MAYBE_TapOnSelection DISABLED_TapOnSelection |
2524 #else | 2524 #else |
2525 #define MAYBE_TapOnSelection TapOnSelection | 2525 #define MAYBE_TapOnSelection TapOnSelection |
2526 #endif | 2526 #endif |
2527 | 2527 |
2528 TEST_F(TextfieldTouchSelectionTest, MAYBE_TapOnSelection) { | 2528 TEST_F(TextfieldTouchSelectionTest, MAYBE_TapOnSelection) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2569 | 2569 |
2570 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); | 2570 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
2571 ui::AXViewState state_protected; | 2571 ui::AXViewState state_protected; |
2572 textfield_->GetAccessibleState(&state_protected); | 2572 textfield_->GetAccessibleState(&state_protected); |
2573 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); | 2573 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); |
2574 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); | 2574 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); |
2575 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); | 2575 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); |
2576 } | 2576 } |
2577 | 2577 |
2578 } // namespace views | 2578 } // namespace views |
OLD | NEW |