| 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 "base/base_paths.h" | 5 #include "base/base_paths.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 { "http://bar/", false, }, | 1226 { "http://bar/", false, }, |
| 1227 { "http://foo/", false, }, | 1227 { "http://foo/", false, }, |
| 1228 { "http://bar/newtab", false, }, | 1228 { "http://bar/newtab", false, }, |
| 1229 }; | 1229 }; |
| 1230 | 1230 |
| 1231 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(url_data); ++i) { | 1231 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(url_data); ++i) { |
| 1232 EXPECT_EQ(url_data[i].result, | 1232 EXPECT_EQ(url_data[i].result, |
| 1233 search_provider.IsSearchURL(GURL(url_data[i].url))); | 1233 search_provider.IsSearchURL(GURL(url_data[i].url))); |
| 1234 } | 1234 } |
| 1235 } | 1235 } |
| 1236 |
| 1237 TEST_F(TemplateURLTest, ReflectsBookmarkBarPinned) { |
| 1238 TemplateURLData data; |
| 1239 data.input_encodings.push_back("UTF-8"); |
| 1240 data.SetURL("{google:baseURL}?{google:bookmarkBarPinned}q={searchTerms}"); |
| 1241 TemplateURL url(NULL, data); |
| 1242 EXPECT_TRUE(url.url_ref().IsValid()); |
| 1243 ASSERT_TRUE(url.url_ref().SupportsReplacement()); |
| 1244 TemplateURLRef::SearchTermsArgs search_terms_args(ASCIIToUTF16("foo")); |
| 1245 |
| 1246 // Do not add the param when InstantExtended is suppressed on SRPs. |
| 1247 url.url_ref_.showing_search_terms_ = false; |
| 1248 std::string result = url.url_ref().ReplaceSearchTerms(search_terms_args); |
| 1249 EXPECT_EQ("http://www.google.com/?q=foo", result); |
| 1250 |
| 1251 // Add the param when InstantExtended is not suppressed on SRPs. |
| 1252 url.url_ref_.showing_search_terms_ = true; |
| 1253 search_terms_args.bookmark_bar_pinned = false; |
| 1254 result = url.url_ref().ReplaceSearchTerms(search_terms_args); |
| 1255 EXPECT_EQ("http://www.google.com/?bmbp=0&q=foo", result); |
| 1256 |
| 1257 url.url_ref_.showing_search_terms_ = true; |
| 1258 search_terms_args.bookmark_bar_pinned = true; |
| 1259 result = url.url_ref().ReplaceSearchTerms(search_terms_args); |
| 1260 EXPECT_EQ("http://www.google.com/?bmbp=1&q=foo", result); |
| 1261 } |
| OLD | NEW |