OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram_base.h" | 8 #include "base/metrics/histogram_base.h" |
9 #include "base/metrics/histogram_samples.h" | 9 #include "base/metrics/histogram_samples.h" |
10 #include "base/metrics/statistics_recorder.h" | 10 #include "base/metrics/statistics_recorder.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "chrome/test/base/interactive_test_utils.h" | 50 #include "chrome/test/base/interactive_test_utils.h" |
51 #include "chrome/test/base/ui_test_utils.h" | 51 #include "chrome/test/base/ui_test_utils.h" |
52 #include "components/bookmarks/browser/bookmark_utils.h" | 52 #include "components/bookmarks/browser/bookmark_utils.h" |
53 #include "components/bookmarks/test/bookmark_test_helpers.h" | 53 #include "components/bookmarks/test/bookmark_test_helpers.h" |
54 #include "components/google/core/browser/google_url_tracker.h" | 54 #include "components/google/core/browser/google_url_tracker.h" |
55 #include "components/history/core/browser/history_types.h" | 55 #include "components/history/core/browser/history_types.h" |
56 #include "components/history/core/common/thumbnail_score.h" | 56 #include "components/history/core/common/thumbnail_score.h" |
57 #include "components/omnibox/autocomplete_match.h" | 57 #include "components/omnibox/autocomplete_match.h" |
58 #include "components/omnibox/autocomplete_provider.h" | 58 #include "components/omnibox/autocomplete_provider.h" |
59 #include "components/omnibox/autocomplete_result.h" | 59 #include "components/omnibox/autocomplete_result.h" |
| 60 #include "components/omnibox/omnibox_field_trial.h" |
60 #include "components/omnibox/search_provider.h" | 61 #include "components/omnibox/search_provider.h" |
61 #include "components/search_engines/template_url_service.h" | 62 #include "components/search_engines/template_url_service.h" |
62 #include "components/sessions/serialized_navigation_entry.h" | 63 #include "components/sessions/serialized_navigation_entry.h" |
63 #include "content/public/browser/navigation_controller.h" | 64 #include "content/public/browser/navigation_controller.h" |
64 #include "content/public/browser/navigation_entry.h" | 65 #include "content/public/browser/navigation_entry.h" |
65 #include "content/public/browser/notification_service.h" | 66 #include "content/public/browser/notification_service.h" |
66 #include "content/public/browser/render_process_host.h" | 67 #include "content/public/browser/render_process_host.h" |
67 #include "content/public/browser/render_view_host.h" | 68 #include "content/public/browser/render_view_host.h" |
68 #include "content/public/browser/site_instance.h" | 69 #include "content/public/browser/site_instance.h" |
69 #include "content/public/browser/url_data_source.h" | 70 #include "content/public/browser/url_data_source.h" |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 content::WindowedNotificationObserver new_tab_observer( | 810 content::WindowedNotificationObserver new_tab_observer( |
810 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 811 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
811 content::NotificationService::AllSources()); | 812 content::NotificationService::AllSources()); |
812 ui_test_utils::NavigateToURLWithDisposition( | 813 ui_test_utils::NavigateToURLWithDisposition( |
813 browser(), | 814 browser(), |
814 GURL(chrome::kChromeUINewTabURL), | 815 GURL(chrome::kChromeUINewTabURL), |
815 CURRENT_TAB, | 816 CURRENT_TAB, |
816 ui_test_utils::BROWSER_TEST_NONE); | 817 ui_test_utils::BROWSER_TEST_NONE); |
817 new_tab_observer.Wait(); | 818 new_tab_observer.Wait(); |
818 | 819 |
819 omnibox()->model()->autocomplete_controller()->search_provider()-> | 820 OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 0; |
820 kMinimumTimeBetweenSuggestQueriesMs = 0; | |
821 | 821 |
822 // Set the fake response for search query. | 822 // Set the fake response for search query. |
823 fake_factory()->SetFakeResponse(instant_url().Resolve("#q=flowers"), | 823 fake_factory()->SetFakeResponse(instant_url().Resolve("#q=flowers"), |
824 "", | 824 "", |
825 net::HTTP_OK, | 825 net::HTTP_OK, |
826 net::URLRequestStatus::SUCCESS); | 826 net::URLRequestStatus::SUCCESS); |
827 | 827 |
828 // Navigate to a search results page. | 828 // Navigate to a search results page. |
829 content::WindowedNotificationObserver observer( | 829 content::WindowedNotificationObserver observer( |
830 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, | 830 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 content::WindowedNotificationObserver new_tab_observer( | 872 content::WindowedNotificationObserver new_tab_observer( |
873 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 873 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
874 content::NotificationService::AllSources()); | 874 content::NotificationService::AllSources()); |
875 ui_test_utils::NavigateToURLWithDisposition( | 875 ui_test_utils::NavigateToURLWithDisposition( |
876 browser(), | 876 browser(), |
877 GURL(chrome::kChromeUINewTabURL), | 877 GURL(chrome::kChromeUINewTabURL), |
878 CURRENT_TAB, | 878 CURRENT_TAB, |
879 ui_test_utils::BROWSER_TEST_NONE); | 879 ui_test_utils::BROWSER_TEST_NONE); |
880 new_tab_observer.Wait(); | 880 new_tab_observer.Wait(); |
881 | 881 |
882 omnibox()->model()->autocomplete_controller()->search_provider()-> | 882 OmniboxFieldTrial::kDefaultMinimumTimeBetweenSuggestQueriesMs = 0; |
883 kMinimumTimeBetweenSuggestQueriesMs = 0; | |
884 | 883 |
885 // Set the fake response for search query. | 884 // Set the fake response for search query. |
886 fake_factory()->SetFakeResponse(instant_url().Resolve("#q=flowers"), | 885 fake_factory()->SetFakeResponse(instant_url().Resolve("#q=flowers"), |
887 "", | 886 "", |
888 net::HTTP_OK, | 887 net::HTTP_OK, |
889 net::URLRequestStatus::SUCCESS); | 888 net::URLRequestStatus::SUCCESS); |
890 | 889 |
891 // Navigate to a search results page. | 890 // Navigate to a search results page. |
892 content::WindowedNotificationObserver observer( | 891 content::WindowedNotificationObserver observer( |
893 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, | 892 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 stream << "link.href = \"" << result_url.spec() << "\";"; | 972 stream << "link.href = \"" << result_url.spec() << "\";"; |
974 stream << "document.body.appendChild(link);"; | 973 stream << "document.body.appendChild(link);"; |
975 stream << "link.click();"; | 974 stream << "link.click();"; |
976 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); | 975 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); |
977 | 976 |
978 content::WaitForLoadStop(contents); | 977 content::WaitForLoadStop(contents); |
979 std::string expected_title = | 978 std::string expected_title = |
980 "Referrer is " + instant_url().GetWithEmptyPath().spec(); | 979 "Referrer is " + instant_url().GetWithEmptyPath().spec(); |
981 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); | 980 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); |
982 } | 981 } |
OLD | NEW |