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

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

Issue 1898633004: Views: Add new SetFocusBehavior method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 4 years, 7 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/views/controls/textfield/textfield.cc ('k') | ui/views/controls/tree/tree_view.cc » ('j') | 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 2528 matching lines...) Expand 10 before | Expand all | Expand 10 after
2539 2539
2540 // Disable textfield and tap on it. Touch text selection should not get 2540 // Disable textfield and tap on it. Touch text selection should not get
2541 // activated. 2541 // activated.
2542 textfield_->SetEnabled(false); 2542 textfield_->SetEnabled(false);
2543 Tap(touch_point); 2543 Tap(touch_point);
2544 EXPECT_FALSE(test_api_->touch_selection_controller()); 2544 EXPECT_FALSE(test_api_->touch_selection_controller());
2545 textfield_->SetEnabled(true); 2545 textfield_->SetEnabled(true);
2546 2546
2547 // Make textfield unfocusable and tap on it. Touch text selection should not 2547 // Make textfield unfocusable and tap on it. Touch text selection should not
2548 // get activated. 2548 // get activated.
2549 textfield_->SetFocusable(false); 2549 textfield_->SetFocusBehavior(View::FocusBehavior::NEVER);
2550 Tap(touch_point); 2550 Tap(touch_point);
2551 EXPECT_FALSE(textfield_->HasFocus()); 2551 EXPECT_FALSE(textfield_->HasFocus());
2552 EXPECT_FALSE(test_api_->touch_selection_controller()); 2552 EXPECT_FALSE(test_api_->touch_selection_controller());
2553 textfield_->SetFocusable(true); 2553 textfield_->SetFocusBehavior(View::FocusBehavior::ALWAYS);
2554 } 2554 }
2555 2555
2556 // No touch on desktop Mac. Tracked in http://crbug.com/445520. 2556 // No touch on desktop Mac. Tracked in http://crbug.com/445520.
2557 #if defined(OS_MACOSX) && !defined(USE_AURA) 2557 #if defined(OS_MACOSX) && !defined(USE_AURA)
2558 #define MAYBE_TapOnSelection DISABLED_TapOnSelection 2558 #define MAYBE_TapOnSelection DISABLED_TapOnSelection
2559 #else 2559 #else
2560 #define MAYBE_TapOnSelection TapOnSelection 2560 #define MAYBE_TapOnSelection TapOnSelection
2561 #endif 2561 #endif
2562 2562
2563 TEST_F(TextfieldTouchSelectionTest, MAYBE_TapOnSelection) { 2563 TEST_F(TextfieldTouchSelectionTest, MAYBE_TapOnSelection) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2604 2604
2605 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); 2605 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
2606 ui::AXViewState state_protected; 2606 ui::AXViewState state_protected;
2607 textfield_->GetAccessibleState(&state_protected); 2607 textfield_->GetAccessibleState(&state_protected);
2608 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); 2608 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role);
2609 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); 2609 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value);
2610 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); 2610 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED));
2611 } 2611 }
2612 2612
2613 } // namespace views 2613 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/views/controls/tree/tree_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698