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

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 11576044: Remove call to IsInstantExtendedAPIGoogleSearchUrl from ToolbarModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nit Created 7 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/search_engines/prepopulated_engines_schema.json » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 782
783 chrome::search::EnableInstantExtendedAPIForTesting(); 783 chrome::search::EnableInstantExtendedAPIForTesting();
784 784
785 // Verifies that a default search is made using the provider configured via 785 // Verifies that a default search is made using the provider configured via
786 // policy. Also checks that default search can be completely disabled. 786 // policy. Also checks that default search can be completely disabled.
787 const string16 kKeyword(ASCIIToUTF16("testsearch")); 787 const string16 kKeyword(ASCIIToUTF16("testsearch"));
788 const std::string kSearchURL("https://www.google.com/search?q={searchTerms}"); 788 const std::string kSearchURL("https://www.google.com/search?q={searchTerms}");
789 const std::string kAlternateURL0( 789 const std::string kAlternateURL0(
790 "https://www.google.com/search#q={searchTerms}"); 790 "https://www.google.com/search#q={searchTerms}");
791 const std::string kAlternateURL1("https://www.google.com/#q={searchTerms}"); 791 const std::string kAlternateURL1("https://www.google.com/#q={searchTerms}");
792 const std::string kSearchTermsReplacementKey(
793 "{google:instantExtendedEnabledKey}");
792 794
793 TemplateURLService* service = TemplateURLServiceFactory::GetForProfile( 795 TemplateURLService* service = TemplateURLServiceFactory::GetForProfile(
794 browser()->profile()); 796 browser()->profile());
795 ui_test_utils::WaitForTemplateURLServiceToLoad(service); 797 ui_test_utils::WaitForTemplateURLServiceToLoad(service);
796 TemplateURL* default_search = service->GetDefaultSearchProvider(); 798 TemplateURL* default_search = service->GetDefaultSearchProvider();
797 ASSERT_TRUE(default_search); 799 ASSERT_TRUE(default_search);
798 EXPECT_NE(kKeyword, default_search->keyword()); 800 EXPECT_NE(kKeyword, default_search->keyword());
799 EXPECT_NE(kSearchURL, default_search->url()); 801 EXPECT_NE(kSearchURL, default_search->url());
800 EXPECT_FALSE( 802 EXPECT_FALSE(
801 default_search->alternate_urls().size() == 2 && 803 default_search->alternate_urls().size() == 2 &&
802 default_search->alternate_urls()[0] == kAlternateURL0 && 804 default_search->alternate_urls()[0] == kAlternateURL0 &&
803 default_search->alternate_urls()[1] == kAlternateURL1); 805 default_search->alternate_urls()[1] == kAlternateURL1);
804 806
805 // Override the default search provider using policies. 807 // Override the default search provider using policies.
806 PolicyMap policies; 808 PolicyMap policies;
807 policies.Set(key::kDefaultSearchProviderEnabled, POLICY_LEVEL_MANDATORY, 809 policies.Set(key::kDefaultSearchProviderEnabled, POLICY_LEVEL_MANDATORY,
808 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true)); 810 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true));
809 policies.Set(key::kDefaultSearchProviderKeyword, POLICY_LEVEL_MANDATORY, 811 policies.Set(key::kDefaultSearchProviderKeyword, POLICY_LEVEL_MANDATORY,
810 POLICY_SCOPE_USER, base::Value::CreateStringValue(kKeyword)); 812 POLICY_SCOPE_USER, base::Value::CreateStringValue(kKeyword));
811 policies.Set(key::kDefaultSearchProviderSearchURL, POLICY_LEVEL_MANDATORY, 813 policies.Set(key::kDefaultSearchProviderSearchURL, POLICY_LEVEL_MANDATORY,
812 POLICY_SCOPE_USER, base::Value::CreateStringValue(kSearchURL)); 814 POLICY_SCOPE_USER, base::Value::CreateStringValue(kSearchURL));
813 base::ListValue* alternate_urls = new base::ListValue(); 815 base::ListValue* alternate_urls = new base::ListValue();
814 alternate_urls->AppendString(kAlternateURL0); 816 alternate_urls->AppendString(kAlternateURL0);
815 alternate_urls->AppendString(kAlternateURL1); 817 alternate_urls->AppendString(kAlternateURL1);
816 policies.Set(key::kDefaultSearchProviderAlternateURLs, POLICY_LEVEL_MANDATORY, 818 policies.Set(key::kDefaultSearchProviderAlternateURLs, POLICY_LEVEL_MANDATORY,
817 POLICY_SCOPE_USER, alternate_urls); 819 POLICY_SCOPE_USER, alternate_urls);
820 policies.Set(key::kDefaultSearchProviderSearchTermsReplacementKey,
821 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
822 base::Value::CreateStringValue(kSearchTermsReplacementKey));
818 provider_.UpdateChromePolicy(policies); 823 provider_.UpdateChromePolicy(policies);
819 default_search = service->GetDefaultSearchProvider(); 824 default_search = service->GetDefaultSearchProvider();
820 ASSERT_TRUE(default_search); 825 ASSERT_TRUE(default_search);
821 EXPECT_EQ(kKeyword, default_search->keyword()); 826 EXPECT_EQ(kKeyword, default_search->keyword());
822 EXPECT_EQ(kSearchURL, default_search->url()); 827 EXPECT_EQ(kSearchURL, default_search->url());
823 EXPECT_EQ(2U, default_search->alternate_urls().size()); 828 EXPECT_EQ(2U, default_search->alternate_urls().size());
824 EXPECT_EQ(kAlternateURL0, default_search->alternate_urls()[0]); 829 EXPECT_EQ(kAlternateURL0, default_search->alternate_urls()[0]);
825 EXPECT_EQ(kAlternateURL1, default_search->alternate_urls()[1]); 830 EXPECT_EQ(kAlternateURL1, default_search->alternate_urls()[1]);
826 831
827 // Verify that searching from the omnibox does search term replacement with 832 // Verify that searching from the omnibox does search term replacement with
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 EXPECT_EQ(kExpectedLabel, text.substr(0, kExpectedLabel.size())); 1745 EXPECT_EQ(kExpectedLabel, text.substr(0, kExpectedLabel.size()));
1741 // HomepageLocation has policy ID 1. 1746 // HomepageLocation has policy ID 1.
1742 EXPECT_NE(std::string::npos, text.find("<br>1 ---")); 1747 EXPECT_NE(std::string::npos, text.find("<br>1 ---"));
1743 // ShowHomeButton has policy ID 35. 1748 // ShowHomeButton has policy ID 35.
1744 EXPECT_NE(std::string::npos, text.find("<br>35 ---")); 1749 EXPECT_NE(std::string::npos, text.find("<br>35 ---"));
1745 // BookmarkBarEnabled has policy ID 82. 1750 // BookmarkBarEnabled has policy ID 82.
1746 EXPECT_NE(std::string::npos, text.find("<br>82 ---")); 1751 EXPECT_NE(std::string::npos, text.find("<br>82 ---"));
1747 } 1752 }
1748 1753
1749 } // namespace policy 1754 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/search_engines/prepopulated_engines_schema.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698