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

Side by Side Diff: chrome/browser/search_engines/template_url_unittest.cc

Issue 7558014: Add a URL param to indicate group selection in Instant field trial. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Passing NULL as far as possible Created 9 years, 4 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/string_util.h" 6 #include "base/string_util.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/rlz/rlz.h" 9 #include "chrome/browser/rlz/rlz.h"
10 #include "chrome/browser/search_engines/search_terms_data.h" 10 #include "chrome/browser/search_engines/search_terms_data.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 { "http://en.wikipedia.org/{searchTerms}", ASCIIToUTF16("wiki/?"), 81 { "http://en.wikipedia.org/{searchTerms}", ASCIIToUTF16("wiki/?"),
82 "http://en.wikipedia.org/wiki/%3F" } 82 "http://en.wikipedia.org/wiki/%3F" }
83 }; 83 };
84 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(search_term_cases); ++i) { 84 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(search_term_cases); ++i) {
85 const SearchTermsCase& value = search_term_cases[i]; 85 const SearchTermsCase& value = search_term_cases[i];
86 TemplateURL t_url; 86 TemplateURL t_url;
87 TemplateURLRef ref(value.url, 0, 0); 87 TemplateURLRef ref(value.url, 0, 0);
88 ASSERT_TRUE(ref.IsValid()); 88 ASSERT_TRUE(ref.IsValid());
89 89
90 ASSERT_TRUE(ref.SupportsReplacement()); 90 ASSERT_TRUE(ref.SupportsReplacement());
91 GURL result = GURL(ref.ReplaceSearchTerms(t_url, value.terms, 91 GURL result = GURL(ref.ReplaceSearchTerms(NULL, t_url, value.terms,
92 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())); 92 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
93 ASSERT_TRUE(result.is_valid()); 93 ASSERT_TRUE(result.is_valid());
94 ASSERT_EQ(value.output, result.spec()); 94 ASSERT_EQ(value.output, result.spec());
95 } 95 }
96 } 96 }
97 97
98 TEST_F(TemplateURLTest, URLRefTestCount) { 98 TEST_F(TemplateURLTest, URLRefTestCount) {
99 TemplateURL t_url; 99 TemplateURL t_url;
100 TemplateURLRef ref("http://foo{searchTerms}{count?}", 0, 0); 100 TemplateURLRef ref("http://foo{searchTerms}{count?}", 0, 0);
101 ASSERT_TRUE(ref.IsValid()); 101 ASSERT_TRUE(ref.IsValid());
102 ASSERT_TRUE(ref.SupportsReplacement()); 102 ASSERT_TRUE(ref.SupportsReplacement());
103 GURL result = GURL(ref.ReplaceSearchTerms(t_url, ASCIIToUTF16("X"), 103 GURL result = GURL(ref.ReplaceSearchTerms(NULL, t_url, ASCIIToUTF16("X"),
104 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())); 104 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
105 ASSERT_TRUE(result.is_valid()); 105 ASSERT_TRUE(result.is_valid());
106 ASSERT_EQ("http://foox/", result.spec()); 106 ASSERT_EQ("http://foox/", result.spec());
107 } 107 }
108 108
109 TEST_F(TemplateURLTest, URLRefTestCount2) { 109 TEST_F(TemplateURLTest, URLRefTestCount2) {
110 TemplateURL t_url; 110 TemplateURL t_url;
111 TemplateURLRef ref("http://foo{searchTerms}{count}", 0, 0); 111 TemplateURLRef ref("http://foo{searchTerms}{count}", 0, 0);
112 ASSERT_TRUE(ref.IsValid()); 112 ASSERT_TRUE(ref.IsValid());
113 ASSERT_TRUE(ref.SupportsReplacement()); 113 ASSERT_TRUE(ref.SupportsReplacement());
114 GURL result = GURL(ref.ReplaceSearchTerms(t_url, ASCIIToUTF16("X"), 114 GURL result = GURL(ref.ReplaceSearchTerms(NULL, t_url, ASCIIToUTF16("X"),
115 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())); 115 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
116 ASSERT_TRUE(result.is_valid()); 116 ASSERT_TRUE(result.is_valid());
117 ASSERT_EQ("http://foox10/", result.spec()); 117 ASSERT_EQ("http://foox10/", result.spec());
118 } 118 }
119 119
120 TEST_F(TemplateURLTest, URLRefTestIndices) { 120 TEST_F(TemplateURLTest, URLRefTestIndices) {
121 TemplateURL t_url; 121 TemplateURL t_url;
122 TemplateURLRef ref("http://foo{searchTerms}x{startIndex?}y{startPage?}", 122 TemplateURLRef ref("http://foo{searchTerms}x{startIndex?}y{startPage?}",
123 1, 2); 123 1, 2);
124 ASSERT_TRUE(ref.IsValid()); 124 ASSERT_TRUE(ref.IsValid());
125 ASSERT_TRUE(ref.SupportsReplacement()); 125 ASSERT_TRUE(ref.SupportsReplacement());
126 GURL result = GURL(ref.ReplaceSearchTerms(t_url, ASCIIToUTF16("X"), 126 GURL result = GURL(ref.ReplaceSearchTerms(NULL, t_url, ASCIIToUTF16("X"),
127 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())); 127 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
128 ASSERT_TRUE(result.is_valid()); 128 ASSERT_TRUE(result.is_valid());
129 ASSERT_EQ("http://fooxxy/", result.spec()); 129 ASSERT_EQ("http://fooxxy/", result.spec());
130 } 130 }
131 131
132 TEST_F(TemplateURLTest, URLRefTestIndices2) { 132 TEST_F(TemplateURLTest, URLRefTestIndices2) {
133 TemplateURL t_url; 133 TemplateURL t_url;
134 TemplateURLRef ref("http://foo{searchTerms}x{startIndex}y{startPage}", 1, 2); 134 TemplateURLRef ref("http://foo{searchTerms}x{startIndex}y{startPage}", 1, 2);
135 ASSERT_TRUE(ref.IsValid()); 135 ASSERT_TRUE(ref.IsValid());
136 ASSERT_TRUE(ref.SupportsReplacement()); 136 ASSERT_TRUE(ref.SupportsReplacement());
137 GURL result = GURL(ref.ReplaceSearchTerms(t_url, ASCIIToUTF16("X"), 137 GURL result = GURL(ref.ReplaceSearchTerms(NULL, t_url, ASCIIToUTF16("X"),
138 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())); 138 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
139 ASSERT_TRUE(result.is_valid()); 139 ASSERT_TRUE(result.is_valid());
140 ASSERT_EQ("http://fooxx1y2/", result.spec()); 140 ASSERT_EQ("http://fooxx1y2/", result.spec());
141 } 141 }
142 142
143 TEST_F(TemplateURLTest, URLRefTestEncoding) { 143 TEST_F(TemplateURLTest, URLRefTestEncoding) {
144 TemplateURL t_url; 144 TemplateURL t_url;
145 TemplateURLRef ref( 145 TemplateURLRef ref(
146 "http://foo{searchTerms}x{inputEncoding?}y{outputEncoding?}a", 1, 2); 146 "http://foo{searchTerms}x{inputEncoding?}y{outputEncoding?}a", 1, 2);
147 ASSERT_TRUE(ref.IsValid()); 147 ASSERT_TRUE(ref.IsValid());
148 ASSERT_TRUE(ref.SupportsReplacement()); 148 ASSERT_TRUE(ref.SupportsReplacement());
149 GURL result = GURL(ref.ReplaceSearchTerms(t_url, ASCIIToUTF16("X"), 149 GURL result = GURL(ref.ReplaceSearchTerms(NULL, t_url, ASCIIToUTF16("X"),
150 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())); 150 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
151 ASSERT_TRUE(result.is_valid()); 151 ASSERT_TRUE(result.is_valid());
152 ASSERT_EQ("http://fooxxutf-8ya/", result.spec()); 152 ASSERT_EQ("http://fooxxutf-8ya/", result.spec());
153 } 153 }
154 154
155 TEST_F(TemplateURLTest, SetPrepopulatedAndParse) { 155 TEST_F(TemplateURLTest, SetPrepopulatedAndParse) {
156 TemplateURL t_url; 156 TemplateURL t_url;
157 t_url.SetURL("http://foo{fhqwhgads}", 0, 0); 157 t_url.SetURL("http://foo{fhqwhgads}", 0, 0);
158 TemplateURLRef::Replacements replacements; 158 TemplateURLRef::Replacements replacements;
159 bool valid = false; 159 bool valid = false;
(...skipping 14 matching lines...) Expand all
174 EXPECT_TRUE(replacements.empty()); 174 EXPECT_TRUE(replacements.empty());
175 EXPECT_TRUE(valid); 175 EXPECT_TRUE(valid);
176 } 176 }
177 177
178 TEST_F(TemplateURLTest, InputEncodingBeforeSearchTerm) { 178 TEST_F(TemplateURLTest, InputEncodingBeforeSearchTerm) {
179 TemplateURL t_url; 179 TemplateURL t_url;
180 TemplateURLRef ref( 180 TemplateURLRef ref(
181 "http://foox{inputEncoding?}a{searchTerms}y{outputEncoding?}b", 1, 2); 181 "http://foox{inputEncoding?}a{searchTerms}y{outputEncoding?}b", 1, 2);
182 ASSERT_TRUE(ref.IsValid()); 182 ASSERT_TRUE(ref.IsValid());
183 ASSERT_TRUE(ref.SupportsReplacement()); 183 ASSERT_TRUE(ref.SupportsReplacement());
184 GURL result = GURL(ref.ReplaceSearchTerms(t_url, ASCIIToUTF16("X"), 184 GURL result = GURL(ref.ReplaceSearchTerms(NULL, t_url, ASCIIToUTF16("X"),
185 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())); 185 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
186 ASSERT_TRUE(result.is_valid()); 186 ASSERT_TRUE(result.is_valid());
187 ASSERT_EQ("http://fooxutf-8axyb/", result.spec()); 187 ASSERT_EQ("http://fooxutf-8axyb/", result.spec());
188 } 188 }
189 189
190 TEST_F(TemplateURLTest, URLRefTestEncoding2) { 190 TEST_F(TemplateURLTest, URLRefTestEncoding2) {
191 TemplateURL t_url; 191 TemplateURL t_url;
192 TemplateURLRef ref( 192 TemplateURLRef ref(
193 "http://foo{searchTerms}x{inputEncoding}y{outputEncoding}a", 1, 2); 193 "http://foo{searchTerms}x{inputEncoding}y{outputEncoding}a", 1, 2);
194 ASSERT_TRUE(ref.IsValid()); 194 ASSERT_TRUE(ref.IsValid());
195 ASSERT_TRUE(ref.SupportsReplacement()); 195 ASSERT_TRUE(ref.SupportsReplacement());
196 GURL result = GURL(ref.ReplaceSearchTerms(t_url, ASCIIToUTF16("X"), 196 GURL result = GURL(ref.ReplaceSearchTerms(NULL, t_url, ASCIIToUTF16("X"),
197 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())); 197 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
198 ASSERT_TRUE(result.is_valid()); 198 ASSERT_TRUE(result.is_valid());
199 ASSERT_EQ("http://fooxxutf-8yutf-8a/", result.spec()); 199 ASSERT_EQ("http://fooxxutf-8yutf-8a/", result.spec());
200 } 200 }
201 201
202 TEST_F(TemplateURLTest, URLRefTestSearchTermsUsingTermsData) { 202 TEST_F(TemplateURLTest, URLRefTestSearchTermsUsingTermsData) {
203 struct SearchTermsCase { 203 struct SearchTermsCase {
204 const char* url; 204 const char* url;
205 const string16 terms; 205 const string16 terms;
206 const char* output; 206 const char* output;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 }; 334 };
335 TemplateURL turl; 335 TemplateURL turl;
336 turl.add_input_encoding("UTF-8"); 336 turl.add_input_encoding("UTF-8");
337 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { 337 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
338 TemplateURLRef ref(data[i].url, 1, 2); 338 TemplateURLRef ref(data[i].url, 1, 2);
339 EXPECT_TRUE(ref.IsValid()); 339 EXPECT_TRUE(ref.IsValid());
340 EXPECT_TRUE(ref.SupportsReplacement()); 340 EXPECT_TRUE(ref.SupportsReplacement());
341 std::string expected_result = data[i].expected_result; 341 std::string expected_result = data[i].expected_result;
342 ReplaceSubstringsAfterOffset(&expected_result, 0, "{language}", 342 ReplaceSubstringsAfterOffset(&expected_result, 0, "{language}",
343 g_browser_process->GetApplicationLocale()); 343 g_browser_process->GetApplicationLocale());
344 GURL result = GURL(ref.ReplaceSearchTerms(turl, ASCIIToUTF16("X"), 344 GURL result = GURL(ref.ReplaceSearchTerms(NULL, turl, ASCIIToUTF16("X"),
345 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())); 345 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
346 EXPECT_TRUE(result.is_valid()); 346 EXPECT_TRUE(result.is_valid());
347 EXPECT_EQ(expected_result, result.spec()); 347 EXPECT_EQ(expected_result, result.spec());
348 } 348 }
349 } 349 }
350 350
351 351
352 // Tests replacing search terms in various encodings and making sure the 352 // Tests replacing search terms in various encodings and making sure the
353 // generated URL matches the expected value. 353 // generated URL matches the expected value.
354 TEST_F(TemplateURLTest, ReplaceArbitrarySearchTerms) { 354 TEST_F(TemplateURLTest, ReplaceArbitrarySearchTerms) {
355 struct TestData { 355 struct TestData {
356 const std::string encoding; 356 const std::string encoding;
357 const string16 search_term; 357 const string16 search_term;
358 const std::string url; 358 const std::string url;
359 const std::string expected_result; 359 const std::string expected_result;
360 } data[] = { 360 } data[] = {
361 { "BIG5", WideToUTF16(L"\x60BD"), 361 { "BIG5", WideToUTF16(L"\x60BD"),
362 "http://foo/?{searchTerms}{inputEncoding}", 362 "http://foo/?{searchTerms}{inputEncoding}",
363 "http://foo/?%B1~BIG5" }, 363 "http://foo/?%B1~BIG5" },
364 { "UTF-8", ASCIIToUTF16("blah"), 364 { "UTF-8", ASCIIToUTF16("blah"),
365 "http://foo/?{searchTerms}{inputEncoding}", 365 "http://foo/?{searchTerms}{inputEncoding}",
366 "http://foo/?blahUTF-8" }, 366 "http://foo/?blahUTF-8" },
367 }; 367 };
368 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { 368 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
369 TemplateURL turl; 369 TemplateURL turl;
370 turl.add_input_encoding(data[i].encoding); 370 turl.add_input_encoding(data[i].encoding);
371 TemplateURLRef ref(data[i].url, 1, 2); 371 TemplateURLRef ref(data[i].url, 1, 2);
372 GURL result = GURL(ref.ReplaceSearchTerms(turl, 372 GURL result = GURL(ref.ReplaceSearchTerms(NULL, turl, data[i].search_term,
373 data[i].search_term, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, 373 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
374 string16()));
375 EXPECT_TRUE(result.is_valid()); 374 EXPECT_TRUE(result.is_valid());
376 EXPECT_EQ(data[i].expected_result, result.spec()); 375 EXPECT_EQ(data[i].expected_result, result.spec());
377 } 376 }
378 } 377 }
379 378
380 TEST_F(TemplateURLTest, Suggestions) { 379 TEST_F(TemplateURLTest, Suggestions) {
381 struct TestData { 380 struct TestData {
382 const int accepted_suggestion; 381 const int accepted_suggestion;
383 const string16 original_query_for_suggestion; 382 const string16 original_query_for_suggestion;
384 const std::string expected_result; 383 const std::string expected_result;
385 } data[] = { 384 } data[] = {
386 { TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16(), 385 { TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16(),
387 "http://bar/foo?q=foobar" }, 386 "http://bar/foo?q=foobar" },
388 { TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, ASCIIToUTF16("foo"), 387 { TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, ASCIIToUTF16("foo"),
389 "http://bar/foo?q=foobar" }, 388 "http://bar/foo?q=foobar" },
390 { TemplateURLRef::NO_SUGGESTION_CHOSEN, string16(), 389 { TemplateURLRef::NO_SUGGESTION_CHOSEN, string16(),
391 "http://bar/foo?aq=f&q=foobar" }, 390 "http://bar/foo?aq=f&q=foobar" },
392 { TemplateURLRef::NO_SUGGESTION_CHOSEN, ASCIIToUTF16("foo"), 391 { TemplateURLRef::NO_SUGGESTION_CHOSEN, ASCIIToUTF16("foo"),
393 "http://bar/foo?aq=f&q=foobar" }, 392 "http://bar/foo?aq=f&q=foobar" },
394 { 0, string16(), "http://bar/foo?aq=0&oq=&q=foobar" }, 393 { 0, string16(), "http://bar/foo?aq=0&oq=&q=foobar" },
395 { 1, ASCIIToUTF16("foo"), "http://bar/foo?aq=1&oq=foo&q=foobar" }, 394 { 1, ASCIIToUTF16("foo"), "http://bar/foo?aq=1&oq=foo&q=foobar" },
396 }; 395 };
397 TemplateURL turl; 396 TemplateURL turl;
398 turl.add_input_encoding("UTF-8"); 397 turl.add_input_encoding("UTF-8");
399 TemplateURLRef ref("http://bar/foo?{google:acceptedSuggestion}" 398 TemplateURLRef ref("http://bar/foo?{google:acceptedSuggestion}"
400 "{google:originalQueryForSuggestion}q={searchTerms}", 1, 2); 399 "{google:originalQueryForSuggestion}q={searchTerms}", 1, 2);
401 ASSERT_TRUE(ref.IsValid()); 400 ASSERT_TRUE(ref.IsValid());
402 ASSERT_TRUE(ref.SupportsReplacement()); 401 ASSERT_TRUE(ref.SupportsReplacement());
403 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { 402 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
404 GURL result = GURL(ref.ReplaceSearchTerms(turl, ASCIIToUTF16("foobar"), 403 GURL result = GURL(ref.ReplaceSearchTerms(NULL, turl,
405 data[i].accepted_suggestion, data[i].original_query_for_suggestion)); 404 ASCIIToUTF16("foobar"), data[i].accepted_suggestion,
405 data[i].original_query_for_suggestion));
406 EXPECT_TRUE(result.is_valid()); 406 EXPECT_TRUE(result.is_valid());
407 EXPECT_EQ(data[i].expected_result, result.spec()); 407 EXPECT_EQ(data[i].expected_result, result.spec());
408 } 408 }
409 } 409 }
410 410
411 #if defined(OS_WIN) 411 #if defined(OS_WIN)
412 TEST_F(TemplateURLTest, RLZ) { 412 TEST_F(TemplateURLTest, RLZ) {
413 string16 rlz_string; 413 string16 rlz_string;
414 #if defined(GOOGLE_CHROME_BUILD) 414 #if defined(GOOGLE_CHROME_BUILD)
415 RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, &rlz_string); 415 RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, &rlz_string);
416 #endif 416 #endif
417 417
418 TemplateURL t_url; 418 TemplateURL t_url;
419 TemplateURLRef ref("http://bar/?{google:RLZ}{searchTerms}", 1, 2); 419 TemplateURLRef ref("http://bar/?{google:RLZ}{searchTerms}", 1, 2);
420 ASSERT_TRUE(ref.IsValid()); 420 ASSERT_TRUE(ref.IsValid());
421 ASSERT_TRUE(ref.SupportsReplacement()); 421 ASSERT_TRUE(ref.SupportsReplacement());
422 GURL result(ref.ReplaceSearchTerms(t_url, L"x", 422 GURL result(ref.ReplaceSearchTerms(NULL, t_url, L"x",
423 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())); 423 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
424 ASSERT_TRUE(result.is_valid()); 424 ASSERT_TRUE(result.is_valid());
425 std::string expected_url = "http://bar/?"; 425 std::string expected_url = "http://bar/?";
426 if (!rlz_string.empty()) { 426 if (!rlz_string.empty()) {
427 expected_url += "rlz=" + WideToUTF8(rlz_string) + "&"; 427 expected_url += "rlz=" + WideToUTF8(rlz_string) + "&";
428 } 428 }
429 expected_url += "x"; 429 expected_url += "x";
430 ASSERT_EQ(expected_url, result.spec()); 430 ASSERT_EQ(expected_url, result.spec());
431 } 431 }
432 #endif 432 #endif
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 TEST_F(TemplateURLTest, ParseURLNestedParameter) { 570 TEST_F(TemplateURLTest, ParseURLNestedParameter) {
571 TemplateURLRef url_ref("{%s", 0, 0); 571 TemplateURLRef url_ref("{%s", 0, 0);
572 TemplateURLRef::Replacements replacements; 572 TemplateURLRef::Replacements replacements;
573 bool valid = false; 573 bool valid = false;
574 EXPECT_EQ("{", url_ref.ParseURL("{{searchTerms}", &replacements, &valid)); 574 EXPECT_EQ("{", url_ref.ParseURL("{{searchTerms}", &replacements, &valid));
575 ASSERT_EQ(1U, replacements.size()); 575 ASSERT_EQ(1U, replacements.size());
576 EXPECT_EQ(static_cast<size_t>(1), replacements[0].index); 576 EXPECT_EQ(static_cast<size_t>(1), replacements[0].index);
577 EXPECT_EQ(TemplateURLRef::SEARCH_TERMS, replacements[0].type); 577 EXPECT_EQ(TemplateURLRef::SEARCH_TERMS, replacements[0].type);
578 EXPECT_TRUE(valid); 578 EXPECT_TRUE(valid);
579 } 579 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698