Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: chrome/browser/ui/search/instant_extended_interactive_uitest.cc

Issue 23625015: Consolidate TestURLFetcherFactory::SetFakeResponse (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 content::WebContents* active_tab = 505 content::WebContents* active_tab =
506 browser()->tab_strip_model()->GetActiveWebContents(); 506 browser()->tab_strip_model()->GetActiveWebContents();
507 ASSERT_THAT(active_tab->GetURL().spec(), HasSubstr("q=flowers")); 507 ASSERT_THAT(active_tab->GetURL().spec(), HasSubstr("q=flowers"));
508 ASSERT_TRUE(UpdateSearchState(active_tab)); 508 ASSERT_TRUE(UpdateSearchState(active_tab));
509 ASSERT_EQ(0, submit_count_); 509 ASSERT_EQ(0, submit_count_);
510 510
511 // Typed in a search URL "by hand". 511 // Typed in a search URL "by hand".
512 content::WindowedNotificationObserver observer_2( 512 content::WindowedNotificationObserver observer_2(
513 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, 513 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED,
514 content::NotificationService::AllSources()); 514 content::NotificationService::AllSources());
515 SetOmniboxText(instant_url().spec() + "#q=puppies"); 515 SetOmniboxText(instant_url().Resolve("#q=puppies").spec());
516 PressEnterAndWaitForNavigation(); 516 PressEnterAndWaitForNavigation();
517 observer_2.Wait(); 517 observer_2.Wait();
518 518
519 // Should not have reused the tab. 519 // Should not have reused the tab.
520 active_tab = browser()->tab_strip_model()->GetActiveWebContents(); 520 active_tab = browser()->tab_strip_model()->GetActiveWebContents();
521 ASSERT_THAT(active_tab->GetURL().spec(), HasSubstr("q=puppies")); 521 ASSERT_THAT(active_tab->GetURL().spec(), HasSubstr("q=puppies"));
522 } 522 }
523 523
524 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, OmniboxMarginSetForSearchURLs) { 524 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, OmniboxMarginSetForSearchURLs) {
525 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); 525 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 CURRENT_TAB, 911 CURRENT_TAB,
912 ui_test_utils::BROWSER_TEST_NONE); 912 ui_test_utils::BROWSER_TEST_NONE);
913 new_tab_observer.Wait(); 913 new_tab_observer.Wait();
914 914
915 omnibox()->model()->autocomplete_controller()->search_provider()-> 915 omnibox()->model()->autocomplete_controller()->search_provider()->
916 kMinimumTimeBetweenSuggestQueriesMs = 0; 916 kMinimumTimeBetweenSuggestQueriesMs = 0;
917 917
918 // Set the fake response for suggest request. Response has prefetch details. 918 // Set the fake response for suggest request. Response has prefetch details.
919 // Ensure that the page received the prefetch query. 919 // Ensure that the page received the prefetch query.
920 fake_factory()->SetFakeResponse( 920 fake_factory()->SetFakeResponse(
921 instant_url().spec() + "#q=pupp", 921 instant_url().Resolve("#q=pupp"),
922 "[\"pupp\",[\"puppy\", \"puppies\"],[],[]," 922 "[\"pupp\",[\"puppy\", \"puppies\"],[],[],"
923 "{\"google:clientdata\":{\"phi\": 0}," 923 "{\"google:clientdata\":{\"phi\": 0},"
924 "\"google:suggesttype\":[\"QUERY\", \"QUERY\"]," 924 "\"google:suggesttype\":[\"QUERY\", \"QUERY\"],"
925 "\"google:suggestrelevance\":[1400, 9]}]", 925 "\"google:suggestrelevance\":[1400, 9]}]",
926 true); 926 true);
927 927
928 SetOmniboxText("pupp"); 928 SetOmniboxText("pupp");
929 while (!omnibox()->model()->autocomplete_controller()->done()) { 929 while (!omnibox()->model()->autocomplete_controller()->done()) {
930 content::WindowedNotificationObserver ready_observer( 930 content::WindowedNotificationObserver ready_observer(
931 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, 931 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY,
(...skipping 25 matching lines...) Expand all
957 ui_test_utils::BROWSER_TEST_NONE); 957 ui_test_utils::BROWSER_TEST_NONE);
958 new_tab_observer.Wait(); 958 new_tab_observer.Wait();
959 959
960 omnibox()->model()->autocomplete_controller()->search_provider()-> 960 omnibox()->model()->autocomplete_controller()->search_provider()->
961 kMinimumTimeBetweenSuggestQueriesMs = 0; 961 kMinimumTimeBetweenSuggestQueriesMs = 0;
962 962
963 // Set the fake response for suggest request. Response has no prefetch 963 // Set the fake response for suggest request. Response has no prefetch
964 // details. Ensure that the page received a blank query to clear the 964 // details. Ensure that the page received a blank query to clear the
965 // prefetched results. 965 // prefetched results.
966 fake_factory()->SetFakeResponse( 966 fake_factory()->SetFakeResponse(
967 instant_url().spec() + "#q=dogs", 967 instant_url().Resolve("#q=dogs"),
968 "[\"dogs\",[\"https://dogs.com\"],[],[]," 968 "[\"dogs\",[\"https://dogs.com\"],[],[],"
969 "{\"google:suggesttype\":[\"NAVIGATION\"]," 969 "{\"google:suggesttype\":[\"NAVIGATION\"],"
970 "\"google:suggestrelevance\":[2]}]", 970 "\"google:suggestrelevance\":[2]}]",
971 true); 971 true);
972 972
973 SetOmniboxText("dogs"); 973 SetOmniboxText("dogs");
974 while (!omnibox()->model()->autocomplete_controller()->done()) { 974 while (!omnibox()->model()->autocomplete_controller()->done()) {
975 content::WindowedNotificationObserver ready_observer( 975 content::WindowedNotificationObserver ready_observer(
976 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, 976 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY,
977 content::Source<AutocompleteController>( 977 content::Source<AutocompleteController>(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 stream << "link.href = \"" << result_url.spec() << "\";"; 1036 stream << "link.href = \"" << result_url.spec() << "\";";
1037 stream << "document.body.appendChild(link);"; 1037 stream << "document.body.appendChild(link);";
1038 stream << "link.click();"; 1038 stream << "link.click();";
1039 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); 1039 EXPECT_TRUE(content::ExecuteScript(contents, stream.str()));
1040 1040
1041 content::WaitForLoadStop(contents); 1041 content::WaitForLoadStop(contents);
1042 std::string expected_title = 1042 std::string expected_title =
1043 "Referrer is " + instant_url().GetWithEmptyPath().spec(); 1043 "Referrer is " + instant_url().GetWithEmptyPath().spec();
1044 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); 1044 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle());
1045 } 1045 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.cc ('k') | chrome/service/cloud_print/printer_job_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698