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

Side by Side Diff: chrome/browser/search/search_unittest.cc

Issue 2152743002: Remove search::ShouldPrerenderInstantUrlOnOmniboxFocus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_prefetch_srp
Patch Set: rebase 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
« no previous file with comments | « chrome/browser/search/search.cc ('k') | chrome/browser/ui/search/search_tab_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/histogram_base.h" 10 #include "base/metrics/histogram_base.h"
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 EXPECT_FALSE(ShouldUseSearchPathForInstant()); 570 EXPECT_FALSE(ShouldUseSearchPathForInstant());
571 } 571 }
572 572
573 TEST_F(SearchTest, ShouldUseSearchPathForInstant_EnabledViaFieldTrial) { 573 TEST_F(SearchTest, ShouldUseSearchPathForInstant_EnabledViaFieldTrial) {
574 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( 574 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
575 "EmbeddedSearch", 575 "EmbeddedSearch",
576 "Group1 use_alternate_instant_url:1 use_search_path_for_instant:1")); 576 "Group1 use_alternate_instant_url:1 use_search_path_for_instant:1"));
577 EXPECT_TRUE(ShouldUseSearchPathForInstant()); 577 EXPECT_TRUE(ShouldUseSearchPathForInstant());
578 } 578 }
579 579
580 TEST_F(SearchTest,
581 ShouldPrerenderInstantUrlOnOmniboxFocus_DisabledViaFieldTrial) {
582 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
583 "EmbeddedSearch",
584 "Group1 espv:89 prerender_instant_url_on_omnibox_focus:0"));
585 EXPECT_FALSE(ShouldPrerenderInstantUrlOnOmniboxFocus());
586 EXPECT_EQ(89ul, EmbeddedSearchPageVersion());
587 }
588
589 TEST_F(SearchTest,
590 ShouldPrerenderInstantUrlOnOmniboxFocus_EnabledViaFieldTrial) {
591 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
592 "EmbeddedSearch",
593 "Group1 espv:80 prerender_instant_url_on_omnibox_focus:1"));
594 EXPECT_TRUE(ShouldPrerenderInstantUrlOnOmniboxFocus());
595 EXPECT_EQ(80ul, EmbeddedSearchPageVersion());
596 }
597
598 580
599 TEST_F(SearchTest, IsNTPURL) { 581 TEST_F(SearchTest, IsNTPURL) {
600 GURL invalid_url; 582 GURL invalid_url;
601 GURL ntp_url(chrome::kChromeUINewTabURL); 583 GURL ntp_url(chrome::kChromeUINewTabURL);
602 GURL local_ntp_url(chrome::kChromeSearchLocalNtpUrl); 584 GURL local_ntp_url(chrome::kChromeSearchLocalNtpUrl);
603 585
604 EXPECT_FALSE(IsNTPURL(invalid_url, profile())); 586 EXPECT_FALSE(IsNTPURL(invalid_url, profile()));
605 // No margin. 587 // No margin.
606 EnableQueryExtractionForTesting(); 588 EnableQueryExtractionForTesting();
607 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true); 589 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 TemplateURLRef::SearchTermsArgs search_terms_args(base::ASCIIToUTF16("foo")); 738 TemplateURLRef::SearchTermsArgs search_terms_args(base::ASCIIToUTF16("foo"));
757 GURL result(template_url_->url_ref().ReplaceSearchTerms( 739 GURL result(template_url_->url_ref().ReplaceSearchTerms(
758 search_terms_args, UIThreadSearchTermsData(profile()))); 740 search_terms_args, UIThreadSearchTermsData(profile())));
759 ASSERT_TRUE(result.is_valid()); 741 ASSERT_TRUE(result.is_valid());
760 // Query extraction is disabled. Make sure 742 // Query extraction is disabled. Make sure
761 // {google:instantExtendedEnabledParameter} is not set in the search URL. 743 // {google:instantExtendedEnabledParameter} is not set in the search URL.
762 EXPECT_EQ("http://www.google.com/search?q=foo", result.spec()); 744 EXPECT_EQ("http://www.google.com/search?q=foo", result.spec());
763 } 745 }
764 746
765 } // namespace search 747 } // namespace search
OLDNEW
« no previous file with comments | « chrome/browser/search/search.cc ('k') | chrome/browser/ui/search/search_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698