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 "chrome/test/base/ui_test_utils.h" | 5 #include "chrome/test/base/ui_test_utils.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 BrowserAddedObserver observer; | 131 BrowserAddedObserver observer; |
132 new_browser = observer.WaitForSingleNewBrowser(); | 132 new_browser = observer.WaitForSingleNewBrowser(); |
133 // The new browser should never be in |excluded_browsers|. | 133 // The new browser should never be in |excluded_browsers|. |
134 DCHECK(!ContainsKey(excluded_browsers, new_browser)); | 134 DCHECK(!ContainsKey(excluded_browsers, new_browser)); |
135 } | 135 } |
136 return new_browser; | 136 return new_browser; |
137 } | 137 } |
138 | 138 |
139 } // namespace | 139 } // namespace |
140 | 140 |
141 bool GetCurrentTabTitle(const Browser* browser, string16* title) { | 141 bool GetCurrentTabTitle(const Browser* browser, base::string16* title) { |
142 WebContents* web_contents = | 142 WebContents* web_contents = |
143 browser->tab_strip_model()->GetActiveWebContents(); | 143 browser->tab_strip_model()->GetActiveWebContents(); |
144 if (!web_contents) | 144 if (!web_contents) |
145 return false; | 145 return false; |
146 NavigationEntry* last_entry = web_contents->GetController().GetActiveEntry(); | 146 NavigationEntry* last_entry = web_contents->GetController().GetActiveEntry(); |
147 if (!last_entry) | 147 if (!last_entry) |
148 return false; | 148 return false; |
149 title->assign(last_entry->GetTitleForDisplay(std::string())); | 149 title->assign(last_entry->GetTitleForDisplay(std::string())); |
150 return true; | 150 return true; |
151 } | 151 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 if (dialog_queue->HasActiveDialog()) | 326 if (dialog_queue->HasActiveDialog()) |
327 return dialog_queue->active_dialog(); | 327 return dialog_queue->active_dialog(); |
328 | 328 |
329 content::WindowedNotificationObserver observer( | 329 content::WindowedNotificationObserver observer( |
330 chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, | 330 chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, |
331 content::NotificationService::AllSources()); | 331 content::NotificationService::AllSources()); |
332 observer.Wait(); | 332 observer.Wait(); |
333 return content::Source<AppModalDialog>(observer.source()).ptr(); | 333 return content::Source<AppModalDialog>(observer.source()).ptr(); |
334 } | 334 } |
335 | 335 |
336 int FindInPage(WebContents* tab, const string16& search_string, | 336 int FindInPage(WebContents* tab, |
337 bool forward, bool match_case, int* ordinal, | 337 const base::string16& search_string, |
| 338 bool forward, |
| 339 bool match_case, |
| 340 int* ordinal, |
338 gfx::Rect* selection_rect) { | 341 gfx::Rect* selection_rect) { |
339 FindTabHelper* find_tab_helper = FindTabHelper::FromWebContents(tab); | 342 FindTabHelper* find_tab_helper = FindTabHelper::FromWebContents(tab); |
340 find_tab_helper->StartFinding(search_string, forward, match_case); | 343 find_tab_helper->StartFinding(search_string, forward, match_case); |
341 FindInPageNotificationObserver observer(tab); | 344 FindInPageNotificationObserver observer(tab); |
342 observer.Wait(); | 345 observer.Wait(); |
343 if (ordinal) | 346 if (ordinal) |
344 *ordinal = observer.active_match_ordinal(); | 347 *ordinal = observer.active_match_ordinal(); |
345 if (selection_rect) | 348 if (selection_rect) |
346 *selection_rect = observer.selection_rect(); | 349 *selection_rect = observer.selection_rect(); |
347 return observer.number_of_matches(); | 350 return observer.number_of_matches(); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 runner->Run(); | 519 runner->Run(); |
517 } | 520 } |
518 | 521 |
519 HistoryEnumerator::HistoryEnumerator(Profile* profile) { | 522 HistoryEnumerator::HistoryEnumerator(Profile* profile) { |
520 scoped_refptr<content::MessageLoopRunner> message_loop_runner = | 523 scoped_refptr<content::MessageLoopRunner> message_loop_runner = |
521 new content::MessageLoopRunner; | 524 new content::MessageLoopRunner; |
522 | 525 |
523 HistoryService* hs = HistoryServiceFactory::GetForProfile( | 526 HistoryService* hs = HistoryServiceFactory::GetForProfile( |
524 profile, Profile::EXPLICIT_ACCESS); | 527 profile, Profile::EXPLICIT_ACCESS); |
525 hs->QueryHistory( | 528 hs->QueryHistory( |
526 string16(), | 529 base::string16(), |
527 history::QueryOptions(), | 530 history::QueryOptions(), |
528 &consumer_, | 531 &consumer_, |
529 base::Bind(&HistoryEnumerator::HistoryQueryComplete, | 532 base::Bind(&HistoryEnumerator::HistoryQueryComplete, |
530 base::Unretained(this), message_loop_runner->QuitClosure())); | 533 base::Unretained(this), message_loop_runner->QuitClosure())); |
531 message_loop_runner->Run(); | 534 message_loop_runner->Run(); |
532 } | 535 } |
533 | 536 |
534 HistoryEnumerator::~HistoryEnumerator() {} | 537 HistoryEnumerator::~HistoryEnumerator() {} |
535 | 538 |
536 void HistoryEnumerator::HistoryQueryComplete( | 539 void HistoryEnumerator::HistoryQueryComplete( |
537 const base::Closure& quit_task, | 540 const base::Closure& quit_task, |
538 HistoryService::Handle request_handle, | 541 HistoryService::Handle request_handle, |
539 history::QueryResults* results) { | 542 history::QueryResults* results) { |
540 for (size_t i = 0; i < results->size(); ++i) | 543 for (size_t i = 0; i < results->size(); ++i) |
541 urls_.push_back((*results)[i].url()); | 544 urls_.push_back((*results)[i].url()); |
542 quit_task.Run(); | 545 quit_task.Run(); |
543 } | 546 } |
544 | 547 |
545 } // namespace ui_test_utils | 548 } // namespace ui_test_utils |
OLD | NEW |