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

Unified Diff: chrome/browser/ui/views/tabs/tab_unittest.cc

Issue 1973073003: Views: Change View::RequestFocus to respect keyboard accessibility. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add RequestFocus test 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/focus/focus_manager.cc » ('j') | ui/views/focus/focus_manager.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/tabs/tab_unittest.cc
diff --git a/chrome/browser/ui/views/tabs/tab_unittest.cc b/chrome/browser/ui/views/tabs/tab_unittest.cc
index 95847bd23066de4ab5876792622be941bde885d2..d283976c6b6bdb096f0dd98374a1beb21561e3bc 100644
--- a/chrome/browser/ui/views/tabs/tab_unittest.cc
+++ b/chrome/browser/ui/views/tabs/tab_unittest.cc
@@ -408,6 +408,26 @@ TEST_F(TabTest, CloseButtonLayout) {
EXPECT_EQ(50, GetCloseButton(tab)->bounds().height());
}
+// Regression test for http://crbug.com/609701. Ensure TabCloseButton does not
+// get focus on right click.
+TEST_F(TabTest, CloseButtonFocus) {
+ Widget widget;
+ InitWidget(&widget);
+ FakeTabController tab_controller;
+ Tab tab(&tab_controller, nullptr);
+ widget.GetContentsView()->AddChildView(&tab);
+
+ views::ImageButton* tab_close_button = GetCloseButton(tab);
+
+ // Verify tab_close_button does not get focus on right click.
+ ui::MouseEvent right_click_event(ui::ET_KEY_PRESSED, gfx::Point(),
+ gfx::Point(), base::TimeDelta(),
+ ui::EF_RIGHT_MOUSE_BUTTON, 0);
+ tab_close_button->OnMousePressed(right_click_event);
+ EXPECT_NE(tab_close_button,
+ tab_close_button->GetFocusManager()->GetFocusedView());
+}
+
// Tests expected changes to the ThrobberView state when the WebContents loading
// state changes or the animation timer (usually in BrowserView) triggers.
TEST_F(TabTest, LayeredThrobber) {
« no previous file with comments | « no previous file | ui/views/focus/focus_manager.cc » ('j') | ui/views/focus/focus_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698