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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
17 #include "base/json/json_reader.h" | 17 #include "base/json/json_reader.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
21 #include "base/test/test_timeouts.h" | 21 #include "base/test/test_timeouts.h" |
22 #include "base/time.h" | 22 #include "base/time.h" |
23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
24 #include "base/values.h" | 24 #include "base/values.h" |
| 25 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
25 #include "chrome/browser/bookmarks/bookmark_model.h" | 26 #include "chrome/browser/bookmarks/bookmark_model.h" |
26 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
27 #include "chrome/browser/history/history_service_factory.h" | 28 #include "chrome/browser/history/history_service_factory.h" |
28 #include "chrome/browser/infobars/infobar_tab_helper.h" | 29 #include "chrome/browser/infobars/infobar_tab_helper.h" |
29 #include "chrome/browser/prefs/pref_service.h" | 30 #include "chrome/browser/prefs/pref_service.h" |
30 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
31 #include "chrome/browser/search_engines/template_url_service.h" | 32 #include "chrome/browser/search_engines/template_url_service.h" |
32 #include "chrome/browser/search_engines/template_url_service_test_util.h" | 33 #include "chrome/browser/search_engines/template_url_service_test_util.h" |
33 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 34 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
34 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 35 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
35 #include "chrome/browser/ui/browser.h" | 36 #include "chrome/browser/ui/browser.h" |
36 #include "chrome/browser/ui/browser_commands.h" | 37 #include "chrome/browser/ui/browser_commands.h" |
37 #include "chrome/browser/ui/browser_finder.h" | 38 #include "chrome/browser/ui/browser_finder.h" |
38 #include "chrome/browser/ui/browser_list.h" | 39 #include "chrome/browser/ui/browser_list.h" |
39 #include "chrome/browser/ui/browser_navigator.h" | 40 #include "chrome/browser/ui/browser_navigator.h" |
40 #include "chrome/browser/ui/browser_tabstrip.h" | 41 #include "chrome/browser/ui/browser_tabstrip.h" |
41 #include "chrome/browser/ui/browser_window.h" | 42 #include "chrome/browser/ui/browser_window.h" |
42 #include "chrome/browser/ui/find_bar/find_notification_details.h" | 43 #include "chrome/browser/ui/find_bar/find_notification_details.h" |
43 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 44 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 45 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 46 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
44 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 47 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
45 #include "chrome/common/chrome_notification_types.h" | 48 #include "chrome/common/chrome_notification_types.h" |
46 #include "chrome/common/chrome_paths.h" | 49 #include "chrome/common/chrome_paths.h" |
47 #include "chrome/common/extensions/extension_action.h" | 50 #include "chrome/common/extensions/extension_action.h" |
48 #include "chrome/common/pref_names.h" | 51 #include "chrome/common/pref_names.h" |
49 #include "chrome/test/base/bookmark_load_observer.h" | 52 #include "chrome/test/base/bookmark_load_observer.h" |
50 #include "content/public/browser/browser_thread.h" | 53 #include "content/public/browser/browser_thread.h" |
51 #include "content/public/browser/dom_operation_notification_details.h" | 54 #include "content/public/browser/dom_operation_notification_details.h" |
52 #include "content/public/browser/download_item.h" | 55 #include "content/public/browser/download_item.h" |
53 #include "content/public/browser/download_manager.h" | 56 #include "content/public/browser/download_manager.h" |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 content::BrowserContext::GetDownloadManager(browser->profile()); | 438 content::BrowserContext::GetDownloadManager(browser->profile()); |
436 scoped_ptr<content::DownloadTestObserver> observer( | 439 scoped_ptr<content::DownloadTestObserver> observer( |
437 new content::DownloadTestObserverTerminal( | 440 new content::DownloadTestObserverTerminal( |
438 download_manager, 1, | 441 download_manager, 1, |
439 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT)); | 442 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT)); |
440 | 443 |
441 ui_test_utils::NavigateToURL(browser, download_url); | 444 ui_test_utils::NavigateToURL(browser, download_url); |
442 observer->WaitForFinished(); | 445 observer->WaitForFinished(); |
443 } | 446 } |
444 | 447 |
| 448 void SendToOmniboxAndSubmit(LocationBar* location_bar, |
| 449 const std::string& input) { |
| 450 OmniboxView* omnibox = location_bar->GetLocationEntry(); |
| 451 omnibox->model()->OnSetFocus(false); |
| 452 omnibox->SetUserText(ASCIIToUTF16(input)); |
| 453 location_bar->AcceptInput(); |
| 454 while (!omnibox->model()->autocomplete_controller()->done()) { |
| 455 content::WindowedNotificationObserver observer( |
| 456 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, |
| 457 content::NotificationService::AllSources()); |
| 458 observer.Wait(); |
| 459 } |
| 460 } |
| 461 |
445 bool GetNativeWindow(const Browser* browser, gfx::NativeWindow* native_window) { | 462 bool GetNativeWindow(const Browser* browser, gfx::NativeWindow* native_window) { |
446 BrowserWindow* window = browser->window(); | 463 BrowserWindow* window = browser->window(); |
447 if (!window) | 464 if (!window) |
448 return false; | 465 return false; |
449 | 466 |
450 *native_window = window->GetNativeWindow(); | 467 *native_window = window->GetNativeWindow(); |
451 return *native_window; | 468 return *native_window; |
452 } | 469 } |
453 | 470 |
454 bool BringBrowserWindowToFront(const Browser* browser) { | 471 bool BringBrowserWindowToFront(const Browser* browser) { |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 void HistoryEnumerator::HistoryQueryComplete( | 772 void HistoryEnumerator::HistoryQueryComplete( |
756 const base::Closure& quit_task, | 773 const base::Closure& quit_task, |
757 HistoryService::Handle request_handle, | 774 HistoryService::Handle request_handle, |
758 history::QueryResults* results) { | 775 history::QueryResults* results) { |
759 for (size_t i = 0; i < results->size(); ++i) | 776 for (size_t i = 0; i < results->size(); ++i) |
760 urls_.push_back((*results)[i].url()); | 777 urls_.push_back((*results)[i].url()); |
761 quit_task.Run(); | 778 quit_task.Run(); |
762 } | 779 } |
763 | 780 |
764 } // namespace ui_test_utils | 781 } // namespace ui_test_utils |
OLD | NEW |