OLD | NEW |
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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 std::string expected_url("http://google.com/?"); | 731 std::string expected_url("http://google.com/?"); |
732 expected_url += std::string(chrome::kSafeSearchSafeParameter) + "&" + | 732 expected_url += std::string(chrome::kSafeSearchSafeParameter) + "&" + |
733 chrome::kSafeSearchSsuiParameter; | 733 chrome::kSafeSearchSsuiParameter; |
734 GURL expected_with_parameters(expected_url); | 734 GURL expected_with_parameters(expected_url); |
735 EXPECT_EQ(expected_with_parameters, web_contents->GetURL()); | 735 EXPECT_EQ(expected_with_parameters, web_contents->GetURL()); |
736 } | 736 } |
737 | 737 |
738 IN_PROC_BROWSER_TEST_F(PolicyTest, ReplaceSearchTerms) { | 738 IN_PROC_BROWSER_TEST_F(PolicyTest, ReplaceSearchTerms) { |
739 MakeRequestFail("search.example"); | 739 MakeRequestFail("search.example"); |
740 | 740 |
741 CommandLine::ForCurrentProcess()->AppendSwitch( | 741 chrome::search::EnableInstantExtendedAPIForTesting(); |
742 switches::kEnableInstantExtendedAPI); | |
743 | |
744 // Adding the kEnableInstantExtendedAPI is not enough since | |
745 // IsInstantExtendedAPIEnabled does not return true on CHANNEL_DEV. | |
746 if (!chrome::search::IsInstantExtendedAPIEnabled(browser()->profile())) | |
747 return; | |
748 | 742 |
749 // Verifies that a default search is made using the provider configured via | 743 // Verifies that a default search is made using the provider configured via |
750 // policy. Also checks that default search can be completely disabled. | 744 // policy. Also checks that default search can be completely disabled. |
751 const string16 kKeyword(ASCIIToUTF16("testsearch")); | 745 const string16 kKeyword(ASCIIToUTF16("testsearch")); |
752 const std::string kSearchURL("https://www.google.com/search?q={searchTerms}"); | 746 const std::string kSearchURL("https://www.google.com/search?q={searchTerms}"); |
753 const std::string kAlternateURL0( | 747 const std::string kAlternateURL0( |
754 "https://www.google.com/search#q={searchTerms}"); | 748 "https://www.google.com/search#q={searchTerms}"); |
755 const std::string kAlternateURL1("https://www.google.com/#q={searchTerms}"); | 749 const std::string kAlternateURL1("https://www.google.com/#q={searchTerms}"); |
756 | 750 |
757 TemplateURLService* service = TemplateURLServiceFactory::GetForProfile( | 751 TemplateURLService* service = TemplateURLServiceFactory::GetForProfile( |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 EXPECT_EQ(kExpectedLabel, text.substr(0, kExpectedLabel.size())); | 1667 EXPECT_EQ(kExpectedLabel, text.substr(0, kExpectedLabel.size())); |
1674 // HomepageLocation has policy ID 1. | 1668 // HomepageLocation has policy ID 1. |
1675 EXPECT_NE(std::string::npos, text.find("<br>1 ---")); | 1669 EXPECT_NE(std::string::npos, text.find("<br>1 ---")); |
1676 // ShowHomeButton has policy ID 35. | 1670 // ShowHomeButton has policy ID 35. |
1677 EXPECT_NE(std::string::npos, text.find("<br>35 ---")); | 1671 EXPECT_NE(std::string::npos, text.find("<br>35 ---")); |
1678 // BookmarkBarEnabled has policy ID 82. | 1672 // BookmarkBarEnabled has policy ID 82. |
1679 EXPECT_NE(std::string::npos, text.find("<br>82 ---")); | 1673 EXPECT_NE(std::string::npos, text.find("<br>82 ---")); |
1680 } | 1674 } |
1681 | 1675 |
1682 } // namespace policy | 1676 } // namespace policy |
OLD | NEW |