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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 // Extract the keyword from a search engine syncer::SyncData. | 53 // Extract the keyword from a search engine syncer::SyncData. |
54 std::string GetKeyword(const syncer::SyncData& sync_data) { | 54 std::string GetKeyword(const syncer::SyncData& sync_data) { |
55 return sync_data.GetSpecifics().search_engine().keyword(); | 55 return sync_data.GetSpecifics().search_engine().keyword(); |
56 } | 56 } |
57 | 57 |
58 // Much like TemplateURLService::CreateSyncDataFromTemplateURL(), but allows the | 58 // Much like TemplateURLService::CreateSyncDataFromTemplateURL(), but allows the |
59 // caller to override the keyword, URL, or GUID fields with empty strings, in | 59 // caller to override the keyword, URL, or GUID fields with empty strings, in |
60 // order to create custom data that should be handled specially when synced to a | 60 // order to create custom data that should be handled specially when synced to a |
61 // client. | 61 // client. |
62 syncer::SyncData CreateCustomSyncData(const TemplateURL& turl, | 62 syncer::SyncData CreateCustomSyncData(const TemplateURL& turl, |
63 bool autogenerate_keyword, | 63 bool autogenerate_keyword, |
64 const std::string& url, | 64 const std::string& url, |
65 const std::string& sync_guid) { | 65 const std::string& sync_guid, |
66 int prepopulate_id = -1) { | |
Peter Kasting
2016/06/14 19:21:26
Nit: Can you do this, or does the compiler barf?
Patrick Noland
2016/06/14 22:55:24
I'd like to do this, but the compiler complains ab
| |
66 sync_pb::EntitySpecifics specifics; | 67 sync_pb::EntitySpecifics specifics; |
67 sync_pb::SearchEngineSpecifics* se_specifics = | 68 sync_pb::SearchEngineSpecifics* se_specifics = |
68 specifics.mutable_search_engine(); | 69 specifics.mutable_search_engine(); |
69 se_specifics->set_short_name(base::UTF16ToUTF8(turl.short_name())); | 70 se_specifics->set_short_name(base::UTF16ToUTF8(turl.short_name())); |
70 se_specifics->set_keyword( | 71 se_specifics->set_keyword( |
71 autogenerate_keyword ? std::string() : base::UTF16ToUTF8(turl.keyword())); | 72 autogenerate_keyword ? std::string() : base::UTF16ToUTF8(turl.keyword())); |
72 se_specifics->set_favicon_url(turl.favicon_url().spec()); | 73 se_specifics->set_favicon_url(turl.favicon_url().spec()); |
73 se_specifics->set_url(url); | 74 se_specifics->set_url(url); |
74 se_specifics->set_safe_for_autoreplace(turl.safe_for_autoreplace()); | 75 se_specifics->set_safe_for_autoreplace(turl.safe_for_autoreplace()); |
75 se_specifics->set_originating_url(turl.originating_url().spec()); | 76 se_specifics->set_originating_url(turl.originating_url().spec()); |
76 se_specifics->set_date_created(turl.date_created().ToInternalValue()); | 77 se_specifics->set_date_created(turl.date_created().ToInternalValue()); |
77 se_specifics->set_input_encodings( | 78 se_specifics->set_input_encodings( |
78 base::JoinString(turl.input_encodings(), ";")); | 79 base::JoinString(turl.input_encodings(), ";")); |
79 se_specifics->set_show_in_default_list(turl.show_in_default_list()); | 80 se_specifics->set_show_in_default_list(turl.show_in_default_list()); |
80 se_specifics->set_suggestions_url(turl.suggestions_url()); | 81 se_specifics->set_suggestions_url(turl.suggestions_url()); |
81 se_specifics->set_prepopulate_id(turl.prepopulate_id()); | 82 se_specifics->set_prepopulate_id(prepopulate_id == -1 ? turl.prepopulate_id() |
83 : prepopulate_id); | |
82 se_specifics->set_autogenerate_keyword(autogenerate_keyword); | 84 se_specifics->set_autogenerate_keyword(autogenerate_keyword); |
83 se_specifics->set_instant_url(turl.instant_url()); | 85 se_specifics->set_instant_url(turl.instant_url()); |
84 se_specifics->set_last_modified(turl.last_modified().ToInternalValue()); | 86 se_specifics->set_last_modified(turl.last_modified().ToInternalValue()); |
85 se_specifics->set_sync_guid(sync_guid); | 87 se_specifics->set_sync_guid(sync_guid); |
86 return syncer::SyncData::CreateLocalData(turl.sync_guid(), // Must be valid! | 88 return syncer::SyncData::CreateLocalData(turl.sync_guid(), // Must be valid! |
87 se_specifics->keyword(), specifics); | 89 se_specifics->keyword(), specifics); |
88 } | 90 } |
89 | 91 |
90 | 92 |
91 // TestChangeProcessor -------------------------------------------------------- | 93 // TestChangeProcessor -------------------------------------------------------- |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 std::unique_ptr<syncer::SyncChangeProcessor> PassProcessor(); | 204 std::unique_ptr<syncer::SyncChangeProcessor> PassProcessor(); |
203 std::unique_ptr<syncer::SyncErrorFactory> CreateAndPassSyncErrorFactory(); | 205 std::unique_ptr<syncer::SyncErrorFactory> CreateAndPassSyncErrorFactory(); |
204 | 206 |
205 // Creates a TemplateURL with some test values. The caller owns the returned | 207 // Creates a TemplateURL with some test values. The caller owns the returned |
206 // TemplateURL*. | 208 // TemplateURL*. |
207 TemplateURL* CreateTestTemplateURL(const base::string16& keyword, | 209 TemplateURL* CreateTestTemplateURL(const base::string16& keyword, |
208 const std::string& url, | 210 const std::string& url, |
209 const std::string& guid = std::string(), | 211 const std::string& guid = std::string(), |
210 time_t last_mod = 100, | 212 time_t last_mod = 100, |
211 bool safe_for_autoreplace = false, | 213 bool safe_for_autoreplace = false, |
212 bool created_by_policy = false) const; | 214 bool created_by_policy = false, |
215 int prepopulate_id = 999999) const; | |
213 | 216 |
214 // Verifies the two TemplateURLs are equal. | 217 // Verifies the two TemplateURLs are equal. |
215 // TODO(stevet): Share this with TemplateURLServiceTest. | 218 // TODO(stevet): Share this with TemplateURLServiceTest. |
216 void AssertEquals(const TemplateURL& expected, | 219 void AssertEquals(const TemplateURL& expected, |
217 const TemplateURL& actual) const; | 220 const TemplateURL& actual) const; |
218 | 221 |
219 // Expect that two syncer::SyncDataLists have equal contents, in terms of the | 222 // Expect that two syncer::SyncDataLists have equal contents, in terms of the |
220 // sync_guid, keyword, and url fields. | 223 // sync_guid, keyword, and url fields. |
221 void AssertEquals(const syncer::SyncDataList& data1, | 224 void AssertEquals(const syncer::SyncDataList& data1, |
222 const syncer::SyncDataList& data2) const; | 225 const syncer::SyncDataList& data2) const; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 return std::unique_ptr<syncer::SyncErrorFactory>( | 292 return std::unique_ptr<syncer::SyncErrorFactory>( |
290 new syncer::SyncErrorFactoryMock()); | 293 new syncer::SyncErrorFactoryMock()); |
291 } | 294 } |
292 | 295 |
293 TemplateURL* TemplateURLServiceSyncTest::CreateTestTemplateURL( | 296 TemplateURL* TemplateURLServiceSyncTest::CreateTestTemplateURL( |
294 const base::string16& keyword, | 297 const base::string16& keyword, |
295 const std::string& url, | 298 const std::string& url, |
296 const std::string& guid, | 299 const std::string& guid, |
297 time_t last_mod, | 300 time_t last_mod, |
298 bool safe_for_autoreplace, | 301 bool safe_for_autoreplace, |
299 bool created_by_policy) const { | 302 bool created_by_policy, |
303 int prepopulate_id) const { | |
300 TemplateURLData data; | 304 TemplateURLData data; |
301 data.SetShortName(ASCIIToUTF16("unittest")); | 305 data.SetShortName(ASCIIToUTF16("unittest")); |
302 data.SetKeyword(keyword); | 306 data.SetKeyword(keyword); |
303 data.SetURL(url); | 307 data.SetURL(url); |
304 data.favicon_url = GURL("http://favicon.url"); | 308 data.favicon_url = GURL("http://favicon.url"); |
305 data.safe_for_autoreplace = safe_for_autoreplace; | 309 data.safe_for_autoreplace = safe_for_autoreplace; |
306 data.date_created = Time::FromTimeT(100); | 310 data.date_created = Time::FromTimeT(100); |
307 data.last_modified = Time::FromTimeT(last_mod); | 311 data.last_modified = Time::FromTimeT(last_mod); |
308 data.created_by_policy = created_by_policy; | 312 data.created_by_policy = created_by_policy; |
309 data.prepopulate_id = 999999; | 313 data.prepopulate_id = prepopulate_id; |
310 if (!guid.empty()) | 314 if (!guid.empty()) |
311 data.sync_guid = guid; | 315 data.sync_guid = guid; |
312 return new TemplateURL(data); | 316 return new TemplateURL(data); |
313 } | 317 } |
314 | 318 |
315 void TemplateURLServiceSyncTest::AssertEquals(const TemplateURL& expected, | 319 void TemplateURLServiceSyncTest::AssertEquals(const TemplateURL& expected, |
316 const TemplateURL& actual) const { | 320 const TemplateURL& actual) const { |
317 ASSERT_EQ(expected.short_name(), actual.short_name()); | 321 ASSERT_EQ(expected.short_name(), actual.short_name()); |
318 ASSERT_EQ(expected.keyword(), actual.keyword()); | 322 ASSERT_EQ(expected.keyword(), actual.keyword()); |
319 ASSERT_EQ(expected.url(), actual.url()); | 323 ASSERT_EQ(expected.url(), actual.url()); |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
847 EXPECT_EQ(0, merge_result.num_items_deleted()); | 851 EXPECT_EQ(0, merge_result.num_items_deleted()); |
848 EXPECT_EQ(3, merge_result.num_items_before_association()); | 852 EXPECT_EQ(3, merge_result.num_items_before_association()); |
849 EXPECT_EQ(4, merge_result.num_items_after_association()); | 853 EXPECT_EQ(4, merge_result.num_items_after_association()); |
850 } | 854 } |
851 | 855 |
852 TEST_F(TemplateURLServiceSyncTest, MergeAddFromNewerSyncData) { | 856 TEST_F(TemplateURLServiceSyncTest, MergeAddFromNewerSyncData) { |
853 // GUIDs all differ, so Sync may overtake some entries, but the timestamps | 857 // GUIDs all differ, so Sync may overtake some entries, but the timestamps |
854 // from Sync are newer. Set up the local data so that one is a dupe, one has a | 858 // from Sync are newer. Set up the local data so that one is a dupe, one has a |
855 // conflicting keyword, and the last has no conflicts (a clean ADD). | 859 // conflicting keyword, and the last has no conflicts (a clean ADD). |
856 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("key1"), "http://key1.com", | 860 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("key1"), "http://key1.com", |
857 "aaa", 10)); // dupe | 861 "aaa", 10, false, false, 111)); // dupe |
858 | 862 |
859 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("key2"), | 863 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("key2"), |
860 "http://expected.com", "bbb", 10)); // keyword conflict | 864 "http://expected.com", "bbb", 10, false, |
865 false, 112)); // keyword conflict | |
861 | 866 |
862 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("unique"), | 867 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("unique"), |
863 "http://unique.com", "ccc", 10)); // add | 868 "http://unique.com", "ccc", 10, false, |
869 false, 113)); // add | |
864 | 870 |
865 syncer::SyncMergeResult merge_result = model()->MergeDataAndStartSyncing( | 871 syncer::SyncMergeResult merge_result = model()->MergeDataAndStartSyncing( |
866 syncer::SEARCH_ENGINES, | 872 syncer::SEARCH_ENGINES, |
867 CreateInitialSyncData(), PassProcessor(), | 873 CreateInitialSyncData(), PassProcessor(), |
868 CreateAndPassSyncErrorFactory()); | 874 CreateAndPassSyncErrorFactory()); |
869 | 875 |
870 // The dupe and keyword conflict results in merges. The unique keyword be | 876 // The dupe and keyword conflict results in merges. The unique keyword be |
871 // added to the model. | 877 // added to the model. |
872 EXPECT_EQ(4U, model()->GetAllSyncData(syncer::SEARCH_ENGINES).size()); | 878 EXPECT_EQ(4U, model()->GetAllSyncData(syncer::SEARCH_ENGINES).size()); |
873 | 879 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1135 TEST_F(TemplateURLServiceSyncTest, AutogeneratedKeywordMigrated) { | 1141 TEST_F(TemplateURLServiceSyncTest, AutogeneratedKeywordMigrated) { |
1136 // Create a couple of sync entries with autogenerated keywords. | 1142 // Create a couple of sync entries with autogenerated keywords. |
1137 syncer::SyncDataList initial_data; | 1143 syncer::SyncDataList initial_data; |
1138 std::unique_ptr<TemplateURL> turl( | 1144 std::unique_ptr<TemplateURL> turl( |
1139 CreateTestTemplateURL(ASCIIToUTF16("key1"), "http://key1.com", "key1")); | 1145 CreateTestTemplateURL(ASCIIToUTF16("key1"), "http://key1.com", "key1")); |
1140 initial_data.push_back( | 1146 initial_data.push_back( |
1141 CreateCustomSyncData(*turl, true, turl->url(), turl->sync_guid())); | 1147 CreateCustomSyncData(*turl, true, turl->url(), turl->sync_guid())); |
1142 turl.reset(CreateTestTemplateURL(ASCIIToUTF16("key2"), | 1148 turl.reset(CreateTestTemplateURL(ASCIIToUTF16("key2"), |
1143 "{google:baseURL}search?q={searchTerms}", "key2")); | 1149 "{google:baseURL}search?q={searchTerms}", "key2")); |
1144 initial_data.push_back( | 1150 initial_data.push_back( |
1145 CreateCustomSyncData(*turl, true, turl->url(), turl->sync_guid())); | 1151 CreateCustomSyncData(*turl, true, turl->url(), turl->sync_guid(), 99)); |
1146 | 1152 |
1147 // Now try to sync the data locally. | 1153 // Now try to sync the data locally. |
1148 model()->MergeDataAndStartSyncing(syncer::SEARCH_ENGINES, initial_data, | 1154 model()->MergeDataAndStartSyncing(syncer::SEARCH_ENGINES, initial_data, |
1149 PassProcessor(), CreateAndPassSyncErrorFactory()); | 1155 PassProcessor(), CreateAndPassSyncErrorFactory()); |
1150 | 1156 |
1151 // Both entries should have been added, with explicit keywords. | 1157 // Both entries should have been added, with explicit keywords. |
1152 TemplateURL* key1 = model()->GetTemplateURLForHost("key1.com"); | 1158 TemplateURL* key1 = model()->GetTemplateURLForHost("key1.com"); |
1153 ASSERT_FALSE(key1 == NULL); | 1159 ASSERT_FALSE(key1 == NULL); |
1154 EXPECT_EQ(ASCIIToUTF16("key1.com"), key1->keyword()); | 1160 EXPECT_EQ(ASCIIToUTF16("key1.com"), key1->keyword()); |
1155 GURL google_url(model()->search_terms_data().GoogleBaseURLValue()); | 1161 GURL google_url(model()->search_terms_data().GoogleBaseURLValue()); |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2214 syncer::SEARCH_ENGINES, list, PassProcessor(), | 2220 syncer::SEARCH_ENGINES, list, PassProcessor(), |
2215 CreateAndPassSyncErrorFactory()); | 2221 CreateAndPassSyncErrorFactory()); |
2216 | 2222 |
2217 const TemplateURL* result_turl = model()->GetTemplateURLForGUID("default"); | 2223 const TemplateURL* result_turl = model()->GetTemplateURLForGUID("default"); |
2218 EXPECT_TRUE(result_turl); | 2224 EXPECT_TRUE(result_turl); |
2219 EXPECT_EQ(ASCIIToUTF16("new_kw"), result_turl->keyword()); | 2225 EXPECT_EQ(ASCIIToUTF16("new_kw"), result_turl->keyword()); |
2220 EXPECT_EQ(ASCIIToUTF16("my name"), result_turl->short_name()); | 2226 EXPECT_EQ(ASCIIToUTF16("my name"), result_turl->short_name()); |
2221 EXPECT_EQ(default_turl->url(), result_turl->url()); | 2227 EXPECT_EQ(default_turl->url(), result_turl->url()); |
2222 } | 2228 } |
2223 | 2229 |
2230 TEST_F(TemplateURLServiceSyncTest, MergeConflictingPrepopulatedEngine) { | |
2231 std::unique_ptr<TemplateURLData> default_turl( | |
2232 TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(NULL)); | |
Peter Kasting
2016/06/14 19:21:26
Nit: nullptr
Patrick Noland
2016/06/14 22:55:24
Done.
| |
2233 | |
2234 TemplateURLData data(*default_turl); | |
2235 data.safe_for_autoreplace = true; | |
2236 data.SetKeyword(ASCIIToUTF16("old_kw")); | |
2237 data.SetShortName(ASCIIToUTF16("my name")); | |
2238 data.SetURL("http://wrong.url.com?q={searchTerms}"); | |
2239 data.date_created = Time::FromTimeT(50); | |
2240 data.last_modified = Time::FromTimeT(50); | |
2241 data.sync_guid = "default"; | |
2242 data.prepopulate_id = 1; | |
2243 model()->Add(new TemplateURL(data)); | |
2244 | |
2245 TemplateURLData new_data(*default_turl); | |
2246 new_data.date_created = Time::FromTimeT(100); | |
Peter Kasting
2016/06/14 19:21:26
Nit: Set fields in the order they're declared with
Patrick Noland
2016/06/14 22:55:24
Done.
| |
2247 new_data.last_modified = Time::FromTimeT(100); | |
2248 new_data.safe_for_autoreplace = false; | |
2249 new_data.SetKeyword(ASCIIToUTF16("new_kw")); | |
2250 new_data.SetShortName(ASCIIToUTF16("my name")); | |
2251 new_data.SetURL("http://wrong.url.com?q={searchTerms}"); | |
2252 new_data.sync_guid = "different_guid"; | |
2253 new_data.prepopulate_id = 1; | |
2254 | |
2255 std::unique_ptr<TemplateURL> sync_turl(new TemplateURL(new_data)); | |
Peter Kasting
2016/06/14 19:21:26
Nit: Use MakeUnique<> over raw new where possible
Patrick Noland
2016/06/14 22:55:24
Done.
| |
2256 syncer::SyncDataList list; | |
2257 list.push_back(TemplateURLService::CreateSyncDataFromTemplateURL(*sync_turl)); | |
2258 syncer::SyncMergeResult merge_result = model()->MergeDataAndStartSyncing( | |
2259 syncer::SEARCH_ENGINES, list, PassProcessor(), | |
2260 CreateAndPassSyncErrorFactory()); | |
2261 | |
2262 const TemplateURL* result_turl = | |
2263 model()->GetTemplateURLForGUID("different_guid"); | |
2264 EXPECT_TRUE(result_turl); | |
2265 EXPECT_EQ(ASCIIToUTF16("new_kw"), result_turl->keyword()); | |
2266 EXPECT_EQ(ASCIIToUTF16("my name"), result_turl->short_name()); | |
2267 EXPECT_EQ(default_turl->url(), result_turl->url()); | |
2268 } | |
2269 | |
2270 TEST_F(TemplateURLServiceSyncTest, | |
2271 MergeConflictingPrepopulatedEngineIntoDefault) { | |
Peter Kasting
2016/06/14 19:21:25
All comments from above apply.
It kinda sucks tha
Patrick Noland
2016/06/14 22:55:24
Done.
| |
2272 std::unique_ptr<TemplateURLData> default_turl( | |
2273 TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(NULL)); | |
2274 | |
2275 TemplateURLData data(*default_turl); | |
2276 data.safe_for_autoreplace = true; | |
2277 data.SetKeyword(ASCIIToUTF16("old_kw")); | |
2278 data.SetShortName(ASCIIToUTF16("my name")); | |
2279 data.SetURL("http://wrong.url.com?q={searchTerms}"); | |
2280 data.date_created = Time::FromTimeT(50); | |
2281 data.last_modified = Time::FromTimeT(50); | |
2282 data.sync_guid = "default"; | |
2283 data.prepopulate_id = 1; | |
2284 TemplateURL* existing_default = new TemplateURL(data); | |
2285 model()->Add(existing_default); | |
2286 model()->SetUserSelectedDefaultSearchProvider(existing_default); | |
2287 | |
2288 TemplateURLData new_data(*default_turl); | |
2289 new_data.date_created = Time::FromTimeT(100); | |
2290 new_data.last_modified = Time::FromTimeT(100); | |
2291 new_data.safe_for_autoreplace = false; | |
2292 new_data.SetKeyword(ASCIIToUTF16("new_kw")); | |
2293 new_data.SetShortName(ASCIIToUTF16("my name")); | |
2294 new_data.SetURL("http://wrong.url.com?q={searchTerms}"); | |
2295 new_data.sync_guid = "different_guid"; | |
2296 new_data.prepopulate_id = 1; | |
2297 | |
2298 std::unique_ptr<TemplateURL> sync_turl(new TemplateURL(new_data)); | |
2299 syncer::SyncDataList list; | |
2300 list.push_back(TemplateURLService::CreateSyncDataFromTemplateURL(*sync_turl)); | |
2301 syncer::SyncMergeResult merge_result = model()->MergeDataAndStartSyncing( | |
2302 syncer::SEARCH_ENGINES, list, PassProcessor(), | |
2303 CreateAndPassSyncErrorFactory()); | |
2304 | |
2305 const TemplateURL* result_turl = model()->GetDefaultSearchProvider(); | |
2306 EXPECT_TRUE(result_turl); | |
2307 EXPECT_EQ(ASCIIToUTF16("new_kw"), result_turl->keyword()); | |
2308 EXPECT_EQ(ASCIIToUTF16("my name"), result_turl->short_name()); | |
2309 EXPECT_EQ(default_turl->url(), result_turl->url()); | |
2310 } | |
2311 | |
2224 TEST_F(TemplateURLServiceSyncTest, MergeNonEditedPrepopulatedEngine) { | 2312 TEST_F(TemplateURLServiceSyncTest, MergeNonEditedPrepopulatedEngine) { |
2225 std::unique_ptr<TemplateURLData> default_turl( | 2313 std::unique_ptr<TemplateURLData> default_turl( |
2226 TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(NULL)); | 2314 TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(NULL)); |
2227 | 2315 |
2228 TemplateURLData data(*default_turl); | 2316 TemplateURLData data(*default_turl); |
2229 data.safe_for_autoreplace = true; // Can be replaced with built-in values. | 2317 data.safe_for_autoreplace = true; // Can be replaced with built-in values. |
2230 data.SetKeyword(ASCIIToUTF16("new_kw")); | 2318 data.SetKeyword(ASCIIToUTF16("new_kw")); |
2231 data.SetShortName(ASCIIToUTF16("my name")); | 2319 data.SetShortName(ASCIIToUTF16("my name")); |
2232 data.SetURL("http://wrong.url.com?q={searchTerms}"); | 2320 data.SetURL("http://wrong.url.com?q={searchTerms}"); |
2233 data.date_created = Time::FromTimeT(50); | 2321 data.date_created = Time::FromTimeT(50); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2275 | 2363 |
2276 TEST_F(TemplateURLServiceSyncTest, NonAsciiKeywordDoesNotCrash) { | 2364 TEST_F(TemplateURLServiceSyncTest, NonAsciiKeywordDoesNotCrash) { |
2277 model()->Add(CreateTestTemplateURL(UTF8ToUTF16("\xf0\xaf\xa6\x8d"), | 2365 model()->Add(CreateTestTemplateURL(UTF8ToUTF16("\xf0\xaf\xa6\x8d"), |
2278 "http://key1.com")); | 2366 "http://key1.com")); |
2279 syncer::SyncDataList initial_data = CreateInitialSyncData(); | 2367 syncer::SyncDataList initial_data = CreateInitialSyncData(); |
2280 | 2368 |
2281 model()->MergeDataAndStartSyncing( | 2369 model()->MergeDataAndStartSyncing( |
2282 syncer::SEARCH_ENGINES, initial_data, PassProcessor(), | 2370 syncer::SEARCH_ENGINES, initial_data, PassProcessor(), |
2283 CreateAndPassSyncErrorFactory()); | 2371 CreateAndPassSyncErrorFactory()); |
2284 } | 2372 } |
OLD | NEW |