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

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

Issue 3146007: Fix for issue 51693, which was a regression from integrating the open source... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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
« no previous file with comments | « chrome/browser/search_engines/template_url_model.cc ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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/template_url.h" 10 #include "chrome/browser/search_engines/template_url.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 GURL result = GURL(ref.ReplaceSearchTerms(turl, L"foobar", 321 GURL result = GURL(ref.ReplaceSearchTerms(turl, L"foobar",
322 data[i].accepted_suggestion, data[i].original_query_for_suggestion)); 322 data[i].accepted_suggestion, data[i].original_query_for_suggestion));
323 EXPECT_TRUE(result.is_valid()); 323 EXPECT_TRUE(result.is_valid());
324 EXPECT_EQ(data[i].expected_result, result.spec()); 324 EXPECT_EQ(data[i].expected_result, result.spec());
325 } 325 }
326 } 326 }
327 327
328 #if defined(OS_WIN) 328 #if defined(OS_WIN)
329 TEST_F(TemplateURLTest, RLZ) { 329 TEST_F(TemplateURLTest, RLZ) {
330 std::wstring rlz_string; 330 std::wstring rlz_string;
331 #if defined(GOOGLE_CHROME_BUILD)
331 RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, &rlz_string); 332 RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, &rlz_string);
333 #endif
332 334
333 TemplateURL t_url; 335 TemplateURL t_url;
334 TemplateURLRef ref("http://bar/?{google:RLZ}{searchTerms}", 1, 2); 336 TemplateURLRef ref("http://bar/?{google:RLZ}{searchTerms}", 1, 2);
335 ASSERT_TRUE(ref.IsValid()); 337 ASSERT_TRUE(ref.IsValid());
336 ASSERT_TRUE(ref.SupportsReplacement()); 338 ASSERT_TRUE(ref.SupportsReplacement());
337 GURL result(ref.ReplaceSearchTerms(t_url, L"x", 339 GURL result(ref.ReplaceSearchTerms(t_url, L"x",
338 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())); 340 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()));
339 ASSERT_TRUE(result.is_valid()); 341 ASSERT_TRUE(result.is_valid());
340 std::string expected_url = "http://bar/?"; 342 std::string expected_url = "http://bar/?";
341 if (!rlz_string.empty()) { 343 if (!rlz_string.empty()) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 TEST_F(TemplateURLTest, ParseURLNestedParameter) { 477 TEST_F(TemplateURLTest, ParseURLNestedParameter) {
476 TemplateURLRef url_ref("{%s", 0, 0); 478 TemplateURLRef url_ref("{%s", 0, 0);
477 TemplateURLRef::Replacements replacements; 479 TemplateURLRef::Replacements replacements;
478 bool valid = false; 480 bool valid = false;
479 EXPECT_EQ("{", url_ref.ParseURL("{{searchTerms}", &replacements, &valid)); 481 EXPECT_EQ("{", url_ref.ParseURL("{{searchTerms}", &replacements, &valid));
480 ASSERT_EQ(1U, replacements.size()); 482 ASSERT_EQ(1U, replacements.size());
481 EXPECT_EQ(static_cast<size_t>(1), replacements[0].index); 483 EXPECT_EQ(static_cast<size_t>(1), replacements[0].index);
482 EXPECT_EQ(TemplateURLRef::SEARCH_TERMS, replacements[0].type); 484 EXPECT_EQ(TemplateURLRef::SEARCH_TERMS, replacements[0].type);
483 EXPECT_TRUE(valid); 485 EXPECT_TRUE(valid);
484 } 486 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698