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

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

Issue 7670007: Revert 96969 - Implement SyncableServices in TemplateURLService. Add related unittests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(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 that setting the prepopulate ID from TemplateURL causes the stored
156 // TemplateURLRef to handle parsing the URL parameters differently.
157 TEST_F(TemplateURLTest, SetPrepopulatedAndParse) { 155 TEST_F(TemplateURLTest, SetPrepopulatedAndParse) {
158 TemplateURL t_url; 156 TemplateURL t_url;
159 t_url.SetURL("http://foo{fhqwhgads}", 0, 0); 157 t_url.SetURL("http://foo{fhqwhgads}", 0, 0);
160 TemplateURLRef::Replacements replacements; 158 TemplateURLRef::Replacements replacements;
161 bool valid = false; 159 bool valid = false;
162 160
163 t_url.SetPrepopulateId(0); 161 t_url.SetPrepopulateId(0);
164 EXPECT_EQ("http://foo{fhqwhgads}", 162 EXPECT_EQ("http://foo{fhqwhgads}",
165 t_url.url()->ParseURL("http://foo{fhqwhgads}", 163 t_url.url()->ParseURL("http://foo{fhqwhgads}",
166 &replacements, 164 &replacements,
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 TEST_F(TemplateURLTest, ParseURLNestedParameter) { 570 TEST_F(TemplateURLTest, ParseURLNestedParameter) {
573 TemplateURLRef url_ref("{%s", 0, 0); 571 TemplateURLRef url_ref("{%s", 0, 0);
574 TemplateURLRef::Replacements replacements; 572 TemplateURLRef::Replacements replacements;
575 bool valid = false; 573 bool valid = false;
576 EXPECT_EQ("{", url_ref.ParseURL("{{searchTerms}", &replacements, &valid)); 574 EXPECT_EQ("{", url_ref.ParseURL("{{searchTerms}", &replacements, &valid));
577 ASSERT_EQ(1U, replacements.size()); 575 ASSERT_EQ(1U, replacements.size());
578 EXPECT_EQ(static_cast<size_t>(1), replacements[0].index); 576 EXPECT_EQ(static_cast<size_t>(1), replacements[0].index);
579 EXPECT_EQ(TemplateURLRef::SEARCH_TERMS, replacements[0].type); 577 EXPECT_EQ(TemplateURLRef::SEARCH_TERMS, replacements[0].type);
580 EXPECT_TRUE(valid); 578 EXPECT_TRUE(valid);
581 } 579 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_service_sync_unittest.cc ('k') | chrome/browser/sync/api/sync_change.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698