OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 #elif defined(OS_WIN) | 90 #elif defined(OS_WIN) |
91 // This loop times out on Windows XP with no output. http://crbug.com/376635 | 91 // This loop times out on Windows XP with no output. http://crbug.com/376635 |
92 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 92 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
93 return; | 93 return; |
94 #endif | 94 #endif |
95 | 95 |
96 // Loop through the focus chain twice for good measure. | 96 // Loop through the focus chain twice for good measure. |
97 for (size_t i = 0; i < 2; ++i) { | 97 for (size_t i = 0; i < 2; ++i) { |
98 SCOPED_TRACE(base::StringPrintf("focus outer loop: %" PRIuS, i)); | 98 SCOPED_TRACE(base::StringPrintf("focus outer loop: %" PRIuS, i)); |
99 ASSERT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX)); | 99 ASSERT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX)); |
| 100 |
100 // Mac requires an extra Tab key press to traverse the app menu button | 101 // Mac requires an extra Tab key press to traverse the app menu button |
101 // iff "Full Keyboard Access" is enabled. This test code should probably | 102 // iff "Full Keyboard Access" is enabled. In reverse, four Tab key presses |
102 // check the setting via NSApplication's isFullKeyboardAccessEnabled. | 103 // are required to traverse the back/forward buttons and the tab strip. |
| 104 #if defined(OS_MACOSX) |
| 105 if (ui_controls::IsFullKeyboardAccessEnabled()) { |
| 106 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 107 browser(), key, false, reverse, false, false)); |
| 108 if (reverse) { |
| 109 for (int j = 0; j < 3; ++j) { |
| 110 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 111 browser(), key, false, reverse, false, false)); |
| 112 } |
| 113 } |
| 114 } |
| 115 #endif |
103 | 116 |
104 for (size_t j = 0; j < arraysize(kExpectedIDs); ++j) { | 117 for (size_t j = 0; j < arraysize(kExpectedIDs); ++j) { |
105 SCOPED_TRACE(base::StringPrintf("focus inner loop %" PRIuS, j)); | 118 SCOPED_TRACE(base::StringPrintf("focus inner loop %" PRIuS, j)); |
106 const size_t index = reverse ? arraysize(kExpectedIDs) - 1 - j : j; | 119 const size_t index = reverse ? arraysize(kExpectedIDs) - 1 - j : j; |
107 // The details are the node's editable state, i.e. true for "textEdit". | 120 // The details are the node's editable state, i.e. true for "textEdit". |
108 bool is_editable_node = index == 0; | 121 bool is_editable_node = index == 0; |
109 | 122 |
110 // Press Tab (or Shift+Tab) and check the focused element id. | 123 // Press Tab (or Shift+Tab) and check the focused element id. |
111 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWaitWithDetails( | 124 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWaitWithDetails( |
112 browser(), key, false, reverse, false, false, | 125 browser(), key, false, reverse, false, false, |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 692 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
680 content::NotificationService::AllSources()); | 693 content::NotificationService::AllSources()); |
681 chrome::GoForward(browser(), CURRENT_TAB); | 694 chrome::GoForward(browser(), CURRENT_TAB); |
682 forward_nav_observer.Wait(); | 695 forward_nav_observer.Wait(); |
683 } | 696 } |
684 | 697 |
685 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); | 698 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); |
686 } | 699 } |
687 | 700 |
688 } // namespace | 701 } // namespace |
OLD | NEW |