| OLD | NEW |
| 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 TEST_F(SearchTest, | 589 TEST_F(SearchTest, |
| 590 ShouldPrerenderInstantUrlOnOmniboxFocus_EnabledViaFieldTrial) { | 590 ShouldPrerenderInstantUrlOnOmniboxFocus_EnabledViaFieldTrial) { |
| 591 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | 591 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 592 "EmbeddedSearch", | 592 "EmbeddedSearch", |
| 593 "Group1 espv:80 prerender_instant_url_on_omnibox_focus:1")); | 593 "Group1 espv:80 prerender_instant_url_on_omnibox_focus:1")); |
| 594 EXPECT_TRUE(ShouldPrerenderInstantUrlOnOmniboxFocus()); | 594 EXPECT_TRUE(ShouldPrerenderInstantUrlOnOmniboxFocus()); |
| 595 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); | 595 EXPECT_EQ(80ul, EmbeddedSearchPageVersion()); |
| 596 } | 596 } |
| 597 | 597 |
| 598 | 598 |
| 599 TEST_F(SearchTest, ShouldShowGoogleLocalNTP_Default) { | |
| 600 EXPECT_TRUE(ShouldShowGoogleLocalNTP()); | |
| 601 } | |
| 602 | |
| 603 TEST_F(SearchTest, ShouldShowGoogleLocalNTP_EnabledViaFinch) { | |
| 604 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
| 605 "EmbeddedSearch", "Group1 espv:2 google_local_ntp:1")); | |
| 606 EXPECT_TRUE(ShouldShowGoogleLocalNTP()); | |
| 607 } | |
| 608 | |
| 609 TEST_F(SearchTest, ShouldShowGoogleLocalNTP_DisabledViaFinch) { | |
| 610 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( | |
| 611 "EmbeddedSearch", "Group1 espv:2 google_local_ntp:0")); | |
| 612 EXPECT_FALSE(ShouldShowGoogleLocalNTP()); | |
| 613 } | |
| 614 | |
| 615 | |
| 616 TEST_F(SearchTest, IsNTPURL) { | 599 TEST_F(SearchTest, IsNTPURL) { |
| 617 GURL invalid_url; | 600 GURL invalid_url; |
| 618 GURL ntp_url(chrome::kChromeUINewTabURL); | 601 GURL ntp_url(chrome::kChromeUINewTabURL); |
| 619 GURL local_ntp_url(chrome::kChromeSearchLocalNtpUrl); | 602 GURL local_ntp_url(chrome::kChromeSearchLocalNtpUrl); |
| 620 | 603 |
| 621 EXPECT_FALSE(IsNTPURL(invalid_url, profile())); | 604 EXPECT_FALSE(IsNTPURL(invalid_url, profile())); |
| 622 // No margin. | 605 // No margin. |
| 623 EnableQueryExtractionForTesting(); | 606 EnableQueryExtractionForTesting(); |
| 624 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true); | 607 profile()->GetPrefs()->SetBoolean(prefs::kSearchSuggestEnabled, true); |
| 625 GURL remote_ntp_url(GetInstantURL(profile(), false)); | 608 GURL remote_ntp_url(GetInstantURL(profile(), false)); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 TemplateURLRef::SearchTermsArgs search_terms_args(base::ASCIIToUTF16("foo")); | 756 TemplateURLRef::SearchTermsArgs search_terms_args(base::ASCIIToUTF16("foo")); |
| 774 GURL result(template_url_->url_ref().ReplaceSearchTerms( | 757 GURL result(template_url_->url_ref().ReplaceSearchTerms( |
| 775 search_terms_args, UIThreadSearchTermsData(profile()))); | 758 search_terms_args, UIThreadSearchTermsData(profile()))); |
| 776 ASSERT_TRUE(result.is_valid()); | 759 ASSERT_TRUE(result.is_valid()); |
| 777 // Query extraction is disabled. Make sure | 760 // Query extraction is disabled. Make sure |
| 778 // {google:instantExtendedEnabledParameter} is not set in the search URL. | 761 // {google:instantExtendedEnabledParameter} is not set in the search URL. |
| 779 EXPECT_EQ("http://www.google.com/search?q=foo", result.spec()); | 762 EXPECT_EQ("http://www.google.com/search?q=foo", result.spec()); |
| 780 } | 763 } |
| 781 | 764 |
| 782 } // namespace search | 765 } // namespace search |
| OLD | NEW |