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/process_util.h" | 5 #include "base/process_util.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
10 #include "chrome/browser/ui/browser_tabstrip.h" | 10 #include "chrome/browser/ui/browser_tabstrip.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 chrome::Find(browser()); | 88 chrome::Find(browser()); |
89 | 89 |
90 // Open another tab (tab B). | 90 // Open another tab (tab B). |
91 chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED); | 91 chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED); |
92 | 92 |
93 chrome::Find(browser()); | 93 chrome::Find(browser()); |
94 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), | 94 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), |
95 VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); | 95 VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); |
96 | 96 |
97 // Select tab A. | 97 // Select tab A. |
98 chrome::ActivateTabAt(browser(), 0, true); | 98 browser()->tab_strip_model()->ActivateTabAt(0, true); |
99 | 99 |
100 // Close tab B. | 100 // Close tab B. |
101 chrome::CloseWebContents(browser(), chrome::GetWebContentsAt(browser(), 1)); | 101 chrome::CloseWebContents(browser(), chrome::GetWebContentsAt(browser(), 1)); |
102 | 102 |
103 // Click on the location bar so that Find box loses focus. | 103 // Click on the location bar so that Find box loses focus. |
104 ASSERT_NO_FATAL_FAILURE(ui_test_utils::ClickOnView(browser(), | 104 ASSERT_NO_FATAL_FAILURE(ui_test_utils::ClickOnView(browser(), |
105 VIEW_ID_LOCATION_BAR)); | 105 VIEW_ID_LOCATION_BAR)); |
106 // Check the location bar is focused. | 106 // Check the location bar is focused. |
107 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), | 107 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), |
108 location_bar_focus_view_id_)); | 108 location_bar_focus_view_id_)); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 ui_test_utils::FindInPage(chrome::GetActiveWebContents(browser()), | 203 ui_test_utils::FindInPage(chrome::GetActiveWebContents(browser()), |
204 ASCIIToUTF16("b"), true, false, NULL, NULL); | 204 ASCIIToUTF16("b"), true, false, NULL, NULL); |
205 EXPECT_TRUE(ASCIIToUTF16("b") == find_bar->GetFindSelectedText()); | 205 EXPECT_TRUE(ASCIIToUTF16("b") == find_bar->GetFindSelectedText()); |
206 | 206 |
207 // Set focus away from the Find bar (to the Location bar). | 207 // Set focus away from the Find bar (to the Location bar). |
208 chrome::FocusLocationBar(browser()); | 208 chrome::FocusLocationBar(browser()); |
209 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), | 209 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), |
210 location_bar_focus_view_id_)); | 210 location_bar_focus_view_id_)); |
211 | 211 |
212 // Select tab A. Find bar should get focus. | 212 // Select tab A. Find bar should get focus. |
213 chrome::ActivateTabAt(browser(), 0, true); | 213 browser()->tab_strip_model()->ActivateTabAt(0, true); |
214 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), | 214 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), |
215 VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); | 215 VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); |
216 EXPECT_TRUE(ASCIIToUTF16("a") == find_bar->GetFindSelectedText()); | 216 EXPECT_TRUE(ASCIIToUTF16("a") == find_bar->GetFindSelectedText()); |
217 | 217 |
218 // Select tab B. Location bar should get focus. | 218 // Select tab B. Location bar should get focus. |
219 chrome::ActivateTabAt(browser(), 1, true); | 219 browser()->tab_strip_model()->ActivateTabAt(1, true); |
220 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), | 220 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), |
221 location_bar_focus_view_id_)); | 221 location_bar_focus_view_id_)); |
222 } | 222 } |
223 | 223 |
224 // Flaky on XP: http://crbug.com/152100 | 224 // Flaky on XP: http://crbug.com/152100 |
225 #if defined(OS_WIN) | 225 #if defined(OS_WIN) |
226 #define MAYBE_PrepopulateRespectBlank DISABLED_PrepopulateRespectBlank | 226 #define MAYBE_PrepopulateRespectBlank DISABLED_PrepopulateRespectBlank |
227 #else | 227 #else |
228 #define MAYBE_PrepopulateRespectBlank PrepopulateRespectBlank | 228 #define MAYBE_PrepopulateRespectBlank PrepopulateRespectBlank |
229 #endif | 229 #endif |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, notification_source); | 375 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, notification_source); |
376 | 376 |
377 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 377 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
378 browser(), ui::VKEY_V, true, false, false, false)); | 378 browser(), ui::VKEY_V, true, false, false, false)); |
379 | 379 |
380 ASSERT_NO_FATAL_FAILURE(observer.Wait()); | 380 ASSERT_NO_FATAL_FAILURE(observer.Wait()); |
381 FindNotificationDetails details; | 381 FindNotificationDetails details; |
382 ASSERT_TRUE(observer.GetDetailsFor(notification_source.map_key(), &details)); | 382 ASSERT_TRUE(observer.GetDetailsFor(notification_source.map_key(), &details)); |
383 EXPECT_TRUE(details.number_of_matches() > 0); | 383 EXPECT_TRUE(details.number_of_matches() > 0); |
384 } | 384 } |
OLD | NEW |