Index: chrome/browser/browser_focus_uitest.cc |
diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc |
index 9bd27da34a013cb49d6b4b9dc16d70f00f124eba..75a6304387ba7e1157e6aa6f90b9d4731405d036 100644 |
--- a/chrome/browser/browser_focus_uitest.cc |
+++ b/chrome/browser/browser_focus_uitest.cc |
@@ -469,6 +469,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { |
// Location bar should be focused. |
ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); |
+ // Move the caret to the end, otherwise the next Tab key may not move focus. |
+ ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
+ browser(), ui::VKEY_END, false, false, false, false)); |
+ |
// Now let's press tab to move the focus. |
for (size_t j = 0; j < arraysize(kExpElementIDs); ++j) { |
SCOPED_TRACE(StringPrintf("inner loop %" PRIuS, j)); |
@@ -515,6 +519,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { |
// Location bar should be focused. |
ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); |
+ // Move the caret to the end, otherwise the next Tab key may not move focus. |
+ ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
+ browser(), ui::VKEY_END, false, false, false, false)); |
+ |
// Now let's press shift-tab to move the focus in reverse. |
for (size_t j = 0; j < arraysize(kExpElementIDs); ++j) { |
SCOPED_TRACE(StringPrintf("inner loop: %" PRIuS, j)); |
@@ -595,6 +603,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) { |
// Location bar should be focused. |
ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); |
+ // Move the caret to the end, otherwise the next Tab key may not move focus. |
+ ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
+ browser(), ui::VKEY_END, false, false, false, false)); |
+ |
// Now let's press tab to move the focus. |
for (size_t j = 0; j < 7; ++j) { |
// Let's make sure the focus is on the expected element in the page. |
@@ -634,6 +646,10 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) { |
// Location bar should be focused. |
ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); |
+ // Move the caret to the end, otherwise the next Tab key may not move focus. |
+ ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
+ browser(), ui::VKEY_END, false, false, false, false)); |
+ |
// Now let's press shift-tab to move the focus in reverse. |
for (size_t j = 0; j < 7; ++j) { |
NotificationType::Type notification_type; |