| 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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 expected_url += std::string(chrome::kSafeSearchSafeParameter) + "&" + | 818 expected_url += std::string(chrome::kSafeSearchSafeParameter) + "&" + |
| 819 chrome::kSafeSearchSsuiParameter; | 819 chrome::kSafeSearchSsuiParameter; |
| 820 GURL expected_with_parameters(expected_url); | 820 GURL expected_with_parameters(expected_url); |
| 821 EXPECT_EQ(expected_with_parameters, web_contents->GetURL()); | 821 EXPECT_EQ(expected_with_parameters, web_contents->GetURL()); |
| 822 } | 822 } |
| 823 | 823 |
| 824 IN_PROC_BROWSER_TEST_F(PolicyTest, ReplaceSearchTerms) { | 824 IN_PROC_BROWSER_TEST_F(PolicyTest, ReplaceSearchTerms) { |
| 825 MakeRequestFail make_request_fail("search.example"); | 825 MakeRequestFail make_request_fail("search.example"); |
| 826 | 826 |
| 827 chrome::EnableInstantExtendedAPIForTesting(); | 827 chrome::EnableInstantExtendedAPIForTesting(); |
| 828 browser()->toolbar_model()->SetSupportsExtractionOfURLLikeSearchTerms(true); |
| 828 | 829 |
| 829 // Verifies that a default search is made using the provider configured via | 830 // Verifies that a default search is made using the provider configured via |
| 830 // policy. Also checks that default search can be completely disabled. | 831 // policy. Also checks that default search can be completely disabled. |
| 831 const string16 kKeyword(ASCIIToUTF16("testsearch")); | 832 const string16 kKeyword(ASCIIToUTF16("testsearch")); |
| 832 const std::string kSearchURL("https://www.google.com/search?q={searchTerms}"); | 833 const std::string kSearchURL("https://www.google.com/search?q={searchTerms}"); |
| 833 const std::string kInstantURL("http://does/not/exist"); | 834 const std::string kInstantURL("http://does/not/exist"); |
| 834 const std::string kAlternateURL0( | 835 const std::string kAlternateURL0( |
| 835 "https://www.google.com/search#q={searchTerms}"); | 836 "https://www.google.com/search#q={searchTerms}"); |
| 836 const std::string kAlternateURL1("https://www.google.com/#q={searchTerms}"); | 837 const std::string kAlternateURL1("https://www.google.com/#q={searchTerms}"); |
| 837 const std::string kSearchTermsReplacementKey( | 838 const std::string kSearchTermsReplacementKey( |
| (...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2079 GetDefaultVariationsServerURLForTesting(); | 2080 GetDefaultVariationsServerURLForTesting(); |
| 2080 | 2081 |
| 2081 // Policy is applied and pref is already updated in local state. | 2082 // Policy is applied and pref is already updated in local state. |
| 2082 EXPECT_EQ(default_variations_url + "?restrict=restricted", | 2083 EXPECT_EQ(default_variations_url + "?restrict=restricted", |
| 2083 chrome_variations::VariationsService::GetVariationsServerURL( | 2084 chrome_variations::VariationsService::GetVariationsServerURL( |
| 2084 g_browser_process->local_state()).spec()); | 2085 g_browser_process->local_state()).spec()); |
| 2085 } | 2086 } |
| 2086 #endif | 2087 #endif |
| 2087 | 2088 |
| 2088 } // namespace policy | 2089 } // namespace policy |
| OLD | NEW |