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

Side by Side Diff: chrome/browser/ui/views/autofill/autofill_dialog_views_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, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/views/autofill/autofill_dialog_views.h" 5 #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 TestWithBrowserView::TearDown(); 85 TestWithBrowserView::TearDown();
86 } 86 }
87 87
88 MockAutofillDialogViewDelegate* delegate() { return &view_delegate_; } 88 MockAutofillDialogViewDelegate* delegate() { return &view_delegate_; }
89 89
90 TestAutofillDialogViews* dialog() { return dialog_.get(); } 90 TestAutofillDialogViews* dialog() { return dialog_.get(); }
91 91
92 protected: 92 protected:
93 void SetSectionsFocusable() { 93 void SetSectionsFocusable() {
94 dialog()->GetNotificationAreaForTesting()->SetFocusable(true); 94 dialog()->GetNotificationAreaForTesting()->SetFocusBehavior(
95 dialog()->GetScrollableAreaForTesting()->SetFocusable(true); 95 views::View::FocusBehavior::ALWAYS);
96 dialog()->GetScrollableAreaForTesting()->SetFocusBehavior(
97 views::View::FocusBehavior::ALWAYS);
96 } 98 }
97 99
98 private: 100 private:
99 // Fake dialog delegate and host to isolate test behavior. 101 // Fake dialog delegate and host to isolate test behavior.
100 web_modal::TestWebContentsModalDialogManagerDelegate dialog_delegate_; 102 web_modal::TestWebContentsModalDialogManagerDelegate dialog_delegate_;
101 std::unique_ptr<web_modal::TestWebContentsModalDialogHost> dialog_host_; 103 std::unique_ptr<web_modal::TestWebContentsModalDialogHost> dialog_host_;
102 104
103 // Mock view delegate as this file only tests the view. 105 // Mock view delegate as this file only tests the view.
104 testing::NiceMock<MockAutofillDialogViewDelegate> view_delegate_; 106 testing::NiceMock<MockAutofillDialogViewDelegate> view_delegate_;
105 107
(...skipping 12 matching lines...) Expand all
118 views::FocusManager* focus_manager = dialog()->GetWidget()->GetFocusManager(); 120 views::FocusManager* focus_manager = dialog()->GetWidget()->GetFocusManager();
119 views::View* focused_view = focus_manager->GetFocusedView(); 121 views::View* focused_view = focus_manager->GetFocusedView();
120 ASSERT_STREQ(DecoratedTextfield::kViewClassName, 122 ASSERT_STREQ(DecoratedTextfield::kViewClassName,
121 focused_view->GetClassName()); 123 focused_view->GetClassName());
122 EXPECT_FALSE(dialog()->HandleKeyEvent( 124 EXPECT_FALSE(dialog()->HandleKeyEvent(
123 static_cast<views::Textfield*>(focused_view), 125 static_cast<views::Textfield*>(focused_view),
124 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE))); 126 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE)));
125 } 127 }
126 128
127 } // namespace autofill 129 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698