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

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

Issue 2143953002: Remove search::ShouldPrefetchSearchResultsOnSRP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add TODO Created 4 years, 4 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
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 "chrome/browser/ui/search/instant_search_prerenderer.h" 5 #include "chrome/browser/ui/search/instant_search_prerenderer.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <tuple> 10 #include <tuple>
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 EXPECT_FALSE(AutocompleteMatch::IsSearchType(url_type_match.type)); 348 EXPECT_FALSE(AutocompleteMatch::IsSearchType(url_type_match.type));
349 EXPECT_FALSE(prerenderer->IsAllowed(url_type_match, active_tab)); 349 EXPECT_FALSE(prerenderer->IsAllowed(url_type_match, active_tab));
350 350
351 // Search results page supports Instant search. InstantSearchPrerenderer is 351 // Search results page supports Instant search. InstantSearchPrerenderer is
352 // used only when the underlying page doesn't support Instant. 352 // used only when the underlying page doesn't support Instant.
353 NavigateAndCommitActiveTab(GURL("https://www.google.com/alt#quux=foo&strk")); 353 NavigateAndCommitActiveTab(GURL("https://www.google.com/alt#quux=foo&strk"));
354 active_tab = GetActiveWebContents(); 354 active_tab = GetActiveWebContents();
355 EXPECT_FALSE( 355 EXPECT_FALSE(
356 search::ExtractSearchTermsFromURL(profile(), active_tab->GetURL()) 356 search::ExtractSearchTermsFromURL(profile(), active_tab->GetURL())
357 .empty()); 357 .empty());
358 EXPECT_FALSE(search::ShouldPrefetchSearchResultsOnSRP());
359 EXPECT_FALSE(prerenderer->IsAllowed(search_type_match, active_tab)); 358 EXPECT_FALSE(prerenderer->IsAllowed(search_type_match, active_tab));
360 } 359 }
361 360
362 TEST_F(InstantSearchPrerendererTest, UsePrerenderPage) { 361 TEST_F(InstantSearchPrerendererTest, UsePrerenderPage) {
363 PrerenderSearchQuery(ASCIIToUTF16("foo")); 362 PrerenderSearchQuery(ASCIIToUTF16("foo"));
364 363
365 // Open a search results page. A prerendered page exists for |url|. Make sure 364 // Open a search results page. A prerendered page exists for |url|. Make sure
366 // the browser swaps the current tab contents with the prerendered contents. 365 // the browser swaps the current tab contents with the prerendered contents.
367 GURL url("https://www.google.com/alt#quux=foo&strk"); 366 GURL url("https://www.google.com/alt#quux=foo&strk");
368 browser()->OpenURL(content::OpenURLParams(url, Referrer(), CURRENT_TAB, 367 browser()->OpenURL(content::OpenURLParams(url, Referrer(), CURRENT_TAB,
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 std::tuple<base::string16, EmbeddedSearchRequestParams> params; 537 std::tuple<base::string16, EmbeddedSearchRequestParams> params;
539 ChromeViewMsg_SearchBoxSubmit::Read(message, &params); 538 ChromeViewMsg_SearchBoxSubmit::Read(message, &params);
540 EXPECT_EQ("foo", base::UTF16ToASCII(std::get<0>(params))); 539 EXPECT_EQ("foo", base::UTF16ToASCII(std::get<0>(params)));
541 EXPECT_EQ("f", base::UTF16ToASCII(std::get<1>(params).original_query)); 540 EXPECT_EQ("f", base::UTF16ToASCII(std::get<1>(params).original_query));
542 EXPECT_EQ("utf-8", base::UTF16ToASCII(std::get<1>(params).input_encoding)); 541 EXPECT_EQ("utf-8", base::UTF16ToASCII(std::get<1>(params).input_encoding));
543 EXPECT_EQ("", base::UTF16ToASCII(std::get<1>(params).rlz_parameter_value)); 542 EXPECT_EQ("", base::UTF16ToASCII(std::get<1>(params).rlz_parameter_value));
544 EXPECT_EQ("chrome...0", 543 EXPECT_EQ("chrome...0",
545 base::UTF16ToASCII(std::get<1>(params).assisted_query_stats)); 544 base::UTF16ToASCII(std::get<1>(params).assisted_query_stats));
546 } 545 }
547 #endif 546 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698