| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/keyboard_codes.h" | 5 #include "base/keyboard_codes.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "chrome/browser/automation/ui_controls.h" | 7 #include "chrome/browser/automation/ui_controls.h" |
| 8 #include "chrome/browser/browser.h" | 8 #include "chrome/browser/browser.h" |
| 9 #include "chrome/browser/browser_window.h" | 9 #include "chrome/browser/browser_window.h" |
| 10 #include "chrome/browser/find_bar_controller.h" | 10 #include "chrome/browser/find_bar_controller.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 GURL url = server->TestServerPageW(L"title1.html"); | 118 GURL url = server->TestServerPageW(L"title1.html"); |
| 119 ui_test_utils::NavigateToURL(browser(), url); | 119 ui_test_utils::NavigateToURL(browser(), url); |
| 120 | 120 |
| 121 // Focus the location bar, open and close the find-in-page, focus should | 121 // Focus the location bar, open and close the find-in-page, focus should |
| 122 // return to the location bar. | 122 // return to the location bar. |
| 123 browser()->FocusLocationBar(); | 123 browser()->FocusLocationBar(); |
| 124 EXPECT_EQ(VIEW_ID_LOCATION_BAR, GetFocusedViewID()); | 124 EXPECT_EQ(VIEW_ID_LOCATION_BAR, GetFocusedViewID()); |
| 125 // Ensure the creation of the find bar controller. | 125 // Ensure the creation of the find bar controller. |
| 126 browser()->GetFindBarController()->Show(); | 126 browser()->GetFindBarController()->Show(); |
| 127 EXPECT_EQ(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD, GetFocusedViewID()); | 127 EXPECT_EQ(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD, GetFocusedViewID()); |
| 128 browser()->GetFindBarController()->EndFindSession(); | 128 browser()->GetFindBarController()->EndFindSession( |
| 129 FindBarController::kKeepSelection); |
| 129 EXPECT_EQ(VIEW_ID_LOCATION_BAR, GetFocusedViewID()); | 130 EXPECT_EQ(VIEW_ID_LOCATION_BAR, GetFocusedViewID()); |
| 130 | 131 |
| 131 // Focus the location bar, find something on the page, close the find box, | 132 // Focus the location bar, find something on the page, close the find box, |
| 132 // focus should go to the page. | 133 // focus should go to the page. |
| 133 browser()->FocusLocationBar(); | 134 browser()->FocusLocationBar(); |
| 134 browser()->Find(); | 135 browser()->Find(); |
| 135 EXPECT_EQ(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD, GetFocusedViewID()); | 136 EXPECT_EQ(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD, GetFocusedViewID()); |
| 136 ui_test_utils::FindInPage(browser()->GetSelectedTabContents(), | 137 ui_test_utils::FindInPage(browser()->GetSelectedTabContents(), |
| 137 L"a", true, false, NULL); | 138 L"a", true, false, NULL); |
| 138 browser()->GetFindBarController()->EndFindSession(); | 139 browser()->GetFindBarController()->EndFindSession( |
| 140 FindBarController::kKeepSelection); |
| 139 EXPECT_EQ(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW, GetFocusedViewID()); | 141 EXPECT_EQ(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW, GetFocusedViewID()); |
| 140 | 142 |
| 141 // Focus the location bar, open and close the find box, focus should return to | 143 // Focus the location bar, open and close the find box, focus should return to |
| 142 // the location bar (same as before, just checking that http://crbug.com/23599 | 144 // the location bar (same as before, just checking that http://crbug.com/23599 |
| 143 // is fixed). | 145 // is fixed). |
| 144 browser()->FocusLocationBar(); | 146 browser()->FocusLocationBar(); |
| 145 EXPECT_EQ(VIEW_ID_LOCATION_BAR, GetFocusedViewID()); | 147 EXPECT_EQ(VIEW_ID_LOCATION_BAR, GetFocusedViewID()); |
| 146 browser()->GetFindBarController()->Show(); | 148 browser()->GetFindBarController()->Show(); |
| 147 EXPECT_EQ(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD, GetFocusedViewID()); | 149 EXPECT_EQ(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD, GetFocusedViewID()); |
| 148 browser()->GetFindBarController()->EndFindSession(); | 150 browser()->GetFindBarController()->EndFindSession( |
| 151 FindBarController::kKeepSelection); |
| 149 EXPECT_EQ(VIEW_ID_LOCATION_BAR, GetFocusedViewID()); | 152 EXPECT_EQ(VIEW_ID_LOCATION_BAR, GetFocusedViewID()); |
| 150 } | 153 } |
| OLD | NEW |