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

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

Issue 2755002: Link with RLZ library from open source repo.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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') | chrome/chrome.gyp » ('j') | 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-2008 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"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { 320 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
321 GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(turl, L"foobar", 321 GURL result = GURL(WideToUTF8(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 RLZTracker::InitRlz(base::DIR_EXE);
331 std::wstring rlz_string; 330 std::wstring rlz_string;
332 RLZTracker::GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, &rlz_string); 331 RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, &rlz_string);
333 332
334 TemplateURL t_url; 333 TemplateURL t_url;
335 TemplateURLRef ref(L"http://bar/?{google:RLZ}{searchTerms}", 1, 2); 334 TemplateURLRef ref(L"http://bar/?{google:RLZ}{searchTerms}", 1, 2);
336 ASSERT_TRUE(ref.IsValid()); 335 ASSERT_TRUE(ref.IsValid());
337 ASSERT_TRUE(ref.SupportsReplacement()); 336 ASSERT_TRUE(ref.SupportsReplacement());
338 GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"x", 337 GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"x",
339 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()))); 338 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
340 ASSERT_TRUE(result.is_valid()); 339 ASSERT_TRUE(result.is_valid());
341 std::string expected_url = "http://bar/?"; 340 std::string expected_url = "http://bar/?";
342 if (!rlz_string.empty()) { 341 if (!rlz_string.empty()) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 TEST_F(TemplateURLTest, ParseURLNestedParameter) { 475 TEST_F(TemplateURLTest, ParseURLNestedParameter) {
477 TemplateURLRef url_ref(L"{%s", 0, 0); 476 TemplateURLRef url_ref(L"{%s", 0, 0);
478 TemplateURLRef::Replacements replacements; 477 TemplateURLRef::Replacements replacements;
479 bool valid = false; 478 bool valid = false;
480 EXPECT_EQ(L"{", url_ref.ParseURL(L"{{searchTerms}", &replacements, &valid)); 479 EXPECT_EQ(L"{", url_ref.ParseURL(L"{{searchTerms}", &replacements, &valid));
481 ASSERT_EQ(1U, replacements.size()); 480 ASSERT_EQ(1U, replacements.size());
482 EXPECT_EQ(static_cast<size_t>(1), replacements[0].index); 481 EXPECT_EQ(static_cast<size_t>(1), replacements[0].index);
483 EXPECT_EQ(TemplateURLRef::SEARCH_TERMS, replacements[0].type); 482 EXPECT_EQ(TemplateURLRef::SEARCH_TERMS, replacements[0].type);
484 EXPECT_TRUE(valid); 483 EXPECT_TRUE(valid);
485 } 484 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_model.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698