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) { | |
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 TemplateURL* local_turl = CreateTestTemplateURL( | 527 TemplateURL* local_turl = CreateTestTemplateURL( |
524 ASCIIToUTF16("localkey"), "www.local.com", "localguid", | 528 ASCIIToUTF16("localkey"), "www.local.com", "localguid", |
525 test_cases[i].local_time, true, test_cases[i].local_created_by_policy); | 529 test_cases[i].local_time, true, test_cases[i].local_created_by_policy); |
526 model()->Add(local_turl); | 530 model()->Add(local_turl); |
527 if (test_cases[i].local_is_default) | 531 if (test_cases[i].local_is_default) |
528 model()->SetUserSelectedDefaultSearchProvider(local_turl); | 532 model()->SetUserSelectedDefaultSearchProvider(local_turl); |
529 | 533 |
530 std::unique_ptr<TemplateURL> sync_turl( | 534 std::unique_ptr<TemplateURL> sync_turl( |
531 CreateTestTemplateURL(ASCIIToUTF16("synckey"), "www.sync.com", | 535 CreateTestTemplateURL(ASCIIToUTF16("synckey"), "www.sync.com", |
532 "syncguid", test_cases[i].sync_time)); | 536 "syncguid", test_cases[i].sync_time)); |
533 EXPECT_EQ(test_cases[i].expected_result, | 537 EXPECT_EQ( |
538 test_cases[i].expected_result, | |
534 model()->IsLocalTemplateURLBetter(local_turl, sync_turl.get())); | 539 model()->IsLocalTemplateURLBetter(local_turl, sync_turl.get())); |
535 | 540 |
536 // Undo the changes. | 541 // Undo the changes. |
537 if (test_cases[i].local_is_default) | 542 if (test_cases[i].local_is_default) |
538 model()->SetUserSelectedDefaultSearchProvider(NULL); | 543 model()->SetUserSelectedDefaultSearchProvider(NULL); |
539 model()->Remove(local_turl); | 544 model()->Remove(local_turl); |
540 } | 545 } |
541 } | 546 } |
542 | 547 |
543 TEST_F(TemplateURLServiceSyncTest, ResolveSyncKeywordConflict) { | 548 TEST_F(TemplateURLServiceSyncTest, ResolveSyncKeywordConflict) { |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
847 EXPECT_EQ(0, merge_result.num_items_deleted()); | 852 EXPECT_EQ(0, merge_result.num_items_deleted()); |
848 EXPECT_EQ(3, merge_result.num_items_before_association()); | 853 EXPECT_EQ(3, merge_result.num_items_before_association()); |
849 EXPECT_EQ(4, merge_result.num_items_after_association()); | 854 EXPECT_EQ(4, merge_result.num_items_after_association()); |
850 } | 855 } |
851 | 856 |
852 TEST_F(TemplateURLServiceSyncTest, MergeAddFromNewerSyncData) { | 857 TEST_F(TemplateURLServiceSyncTest, MergeAddFromNewerSyncData) { |
853 // GUIDs all differ, so Sync may overtake some entries, but the timestamps | 858 // 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 | 859 // 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). | 860 // conflicting keyword, and the last has no conflicts (a clean ADD). |
856 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("key1"), "http://key1.com", | 861 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("key1"), "http://key1.com", |
857 "aaa", 10)); // dupe | 862 "aaa", 10, false, false, 111)); // dupe |
858 | 863 |
859 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("key2"), | 864 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("key2"), |
860 "http://expected.com", "bbb", 10)); // keyword conflict | 865 "http://expected.com", "bbb", 10, false, |
866 false, 112)); // keyword conflict | |
861 | 867 |
862 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("unique"), | 868 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("unique"), |
863 "http://unique.com", "ccc", 10)); // add | 869 "http://unique.com", "ccc", 10, false, |
870 false, 113)); // add | |
864 | 871 |
865 syncer::SyncMergeResult merge_result = model()->MergeDataAndStartSyncing( | 872 syncer::SyncMergeResult merge_result = model()->MergeDataAndStartSyncing( |
866 syncer::SEARCH_ENGINES, | 873 syncer::SEARCH_ENGINES, |
867 CreateInitialSyncData(), PassProcessor(), | 874 CreateInitialSyncData(), PassProcessor(), |
868 CreateAndPassSyncErrorFactory()); | 875 CreateAndPassSyncErrorFactory()); |
869 | 876 |
870 // The dupe and keyword conflict results in merges. The unique keyword be | 877 // The dupe and keyword conflict results in merges. The unique keyword be |
871 // added to the model. | 878 // added to the model. |
872 EXPECT_EQ(4U, model()->GetAllSyncData(syncer::SEARCH_ENGINES).size()); | 879 EXPECT_EQ(4U, model()->GetAllSyncData(syncer::SEARCH_ENGINES).size()); |
873 | 880 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1135 TEST_F(TemplateURLServiceSyncTest, AutogeneratedKeywordMigrated) { | 1142 TEST_F(TemplateURLServiceSyncTest, AutogeneratedKeywordMigrated) { |
1136 // Create a couple of sync entries with autogenerated keywords. | 1143 // Create a couple of sync entries with autogenerated keywords. |
1137 syncer::SyncDataList initial_data; | 1144 syncer::SyncDataList initial_data; |
1138 std::unique_ptr<TemplateURL> turl( | 1145 std::unique_ptr<TemplateURL> turl( |
1139 CreateTestTemplateURL(ASCIIToUTF16("key1"), "http://key1.com", "key1")); | 1146 CreateTestTemplateURL(ASCIIToUTF16("key1"), "http://key1.com", "key1")); |
1140 initial_data.push_back( | 1147 initial_data.push_back( |
1141 CreateCustomSyncData(*turl, true, turl->url(), turl->sync_guid())); | 1148 CreateCustomSyncData(*turl, true, turl->url(), turl->sync_guid())); |
1142 turl.reset(CreateTestTemplateURL(ASCIIToUTF16("key2"), | 1149 turl.reset(CreateTestTemplateURL(ASCIIToUTF16("key2"), |
1143 "{google:baseURL}search?q={searchTerms}", "key2")); | 1150 "{google:baseURL}search?q={searchTerms}", "key2")); |
1144 initial_data.push_back( | 1151 initial_data.push_back( |
1145 CreateCustomSyncData(*turl, true, turl->url(), turl->sync_guid())); | 1152 CreateCustomSyncData(*turl, true, turl->url(), turl->sync_guid(), 99)); |
1146 | 1153 |
1147 // Now try to sync the data locally. | 1154 // Now try to sync the data locally. |
1148 model()->MergeDataAndStartSyncing(syncer::SEARCH_ENGINES, initial_data, | 1155 model()->MergeDataAndStartSyncing(syncer::SEARCH_ENGINES, initial_data, |
1149 PassProcessor(), CreateAndPassSyncErrorFactory()); | 1156 PassProcessor(), CreateAndPassSyncErrorFactory()); |
1150 | 1157 |
1151 // Both entries should have been added, with explicit keywords. | 1158 // Both entries should have been added, with explicit keywords. |
1152 TemplateURL* key1 = model()->GetTemplateURLForHost("key1.com"); | 1159 TemplateURL* key1 = model()->GetTemplateURLForHost("key1.com"); |
1153 ASSERT_FALSE(key1 == NULL); | 1160 ASSERT_FALSE(key1 == NULL); |
1154 EXPECT_EQ(ASCIIToUTF16("key1.com"), key1->keyword()); | 1161 EXPECT_EQ(ASCIIToUTF16("key1.com"), key1->keyword()); |
1155 GURL google_url(model()->search_terms_data().GoogleBaseURLValue()); | 1162 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(), | 2221 syncer::SEARCH_ENGINES, list, PassProcessor(), |
2215 CreateAndPassSyncErrorFactory()); | 2222 CreateAndPassSyncErrorFactory()); |
2216 | 2223 |
2217 const TemplateURL* result_turl = model()->GetTemplateURLForGUID("default"); | 2224 const TemplateURL* result_turl = model()->GetTemplateURLForGUID("default"); |
2218 EXPECT_TRUE(result_turl); | 2225 EXPECT_TRUE(result_turl); |
2219 EXPECT_EQ(ASCIIToUTF16("new_kw"), result_turl->keyword()); | 2226 EXPECT_EQ(ASCIIToUTF16("new_kw"), result_turl->keyword()); |
2220 EXPECT_EQ(ASCIIToUTF16("my name"), result_turl->short_name()); | 2227 EXPECT_EQ(ASCIIToUTF16("my name"), result_turl->short_name()); |
2221 EXPECT_EQ(default_turl->url(), result_turl->url()); | 2228 EXPECT_EQ(default_turl->url(), result_turl->url()); |
2222 } | 2229 } |
2223 | 2230 |
2231 TEST_F(TemplateURLServiceSyncTest, MergeConflictingPrepopulatedEngine) { | |
2232 std::unique_ptr<TemplateURLData> default_turl( | |
2233 TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(nullptr)); | |
2234 | |
2235 TemplateURLData data(*default_turl); | |
2236 data.SetKeyword(ASCIIToUTF16("old_kw")); | |
2237 data.SetShortName(ASCIIToUTF16("my name")); | |
2238 data.SetURL("http://wrong.url.com?q={searchTerms}"); | |
2239 data.safe_for_autoreplace = true; | |
2240 data.date_created = Time::FromTimeT(50); | |
2241 data.last_modified = Time::FromTimeT(50); | |
2242 data.prepopulate_id = 1; | |
2243 data.sync_guid = "default"; | |
2244 model()->Add(new TemplateURL(data)); | |
2245 | |
2246 TemplateURLData new_data(*default_turl); | |
2247 new_data.SetKeyword(ASCIIToUTF16("new_kw")); | |
2248 new_data.SetShortName(ASCIIToUTF16("my name")); | |
2249 new_data.SetURL("http://wrong.url.com?q={searchTerms}"); | |
2250 new_data.safe_for_autoreplace = false; | |
2251 new_data.date_created = Time::FromTimeT(100); | |
2252 new_data.last_modified = Time::FromTimeT(100); | |
2253 new_data.prepopulate_id = 1; | |
2254 new_data.sync_guid = "different_guid"; | |
2255 | |
2256 std::unique_ptr<TemplateURL> sync_turl = | |
Peter Kasting
2016/06/14 23:48:39
Nit: Above each group of code blocks that implemen
| |
2257 base::MakeUnique<TemplateURL>(new_data); | |
2258 syncer::SyncDataList list; | |
2259 list.push_back(TemplateURLService::CreateSyncDataFromTemplateURL(*sync_turl)); | |
2260 syncer::SyncMergeResult merge_result = model()->MergeDataAndStartSyncing( | |
2261 syncer::SEARCH_ENGINES, list, PassProcessor(), | |
2262 CreateAndPassSyncErrorFactory()); | |
2263 | |
2264 TemplateURL* result_turl = model()->GetTemplateURLForGUID("different_guid"); | |
2265 EXPECT_TRUE(result_turl); | |
2266 EXPECT_EQ(ASCIIToUTF16("new_kw"), result_turl->keyword()); | |
2267 EXPECT_EQ(ASCIIToUTF16("my name"), result_turl->short_name()); | |
2268 EXPECT_EQ(default_turl->url(), result_turl->url()); | |
2269 | |
2270 model()->Remove(result_turl); | |
2271 model()->StopSyncing(syncer::SEARCH_ENGINES); | |
2272 sync_processor_wrapper_.reset( | |
2273 new syncer::SyncChangeProcessorWrapperForTest(sync_processor_.get())); | |
2274 | |
2275 TemplateURL* existing_default = new TemplateURL(data); | |
2276 model()->Add(existing_default); | |
2277 model()->SetUserSelectedDefaultSearchProvider(existing_default); | |
2278 | |
2279 merge_result = model()->MergeDataAndStartSyncing( | |
2280 syncer::SEARCH_ENGINES, list, PassProcessor(), | |
2281 CreateAndPassSyncErrorFactory()); | |
2282 | |
2283 result_turl = model()->GetDefaultSearchProvider(); | |
2284 EXPECT_TRUE(result_turl); | |
2285 EXPECT_EQ(ASCIIToUTF16("new_kw"), result_turl->keyword()); | |
2286 EXPECT_EQ(ASCIIToUTF16("my name"), result_turl->short_name()); | |
2287 EXPECT_EQ(default_turl->url(), result_turl->url()); | |
2288 } | |
2289 | |
2224 TEST_F(TemplateURLServiceSyncTest, MergeNonEditedPrepopulatedEngine) { | 2290 TEST_F(TemplateURLServiceSyncTest, MergeNonEditedPrepopulatedEngine) { |
2225 std::unique_ptr<TemplateURLData> default_turl( | 2291 std::unique_ptr<TemplateURLData> default_turl( |
2226 TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(NULL)); | 2292 TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(NULL)); |
2227 | 2293 |
2228 TemplateURLData data(*default_turl); | 2294 TemplateURLData data(*default_turl); |
2229 data.safe_for_autoreplace = true; // Can be replaced with built-in values. | 2295 data.safe_for_autoreplace = true; // Can be replaced with built-in values. |
2230 data.SetKeyword(ASCIIToUTF16("new_kw")); | 2296 data.SetKeyword(ASCIIToUTF16("new_kw")); |
2231 data.SetShortName(ASCIIToUTF16("my name")); | 2297 data.SetShortName(ASCIIToUTF16("my name")); |
2232 data.SetURL("http://wrong.url.com?q={searchTerms}"); | 2298 data.SetURL("http://wrong.url.com?q={searchTerms}"); |
2233 data.date_created = Time::FromTimeT(50); | 2299 data.date_created = Time::FromTimeT(50); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2275 | 2341 |
2276 TEST_F(TemplateURLServiceSyncTest, NonAsciiKeywordDoesNotCrash) { | 2342 TEST_F(TemplateURLServiceSyncTest, NonAsciiKeywordDoesNotCrash) { |
2277 model()->Add(CreateTestTemplateURL(UTF8ToUTF16("\xf0\xaf\xa6\x8d"), | 2343 model()->Add(CreateTestTemplateURL(UTF8ToUTF16("\xf0\xaf\xa6\x8d"), |
2278 "http://key1.com")); | 2344 "http://key1.com")); |
2279 syncer::SyncDataList initial_data = CreateInitialSyncData(); | 2345 syncer::SyncDataList initial_data = CreateInitialSyncData(); |
2280 | 2346 |
2281 model()->MergeDataAndStartSyncing( | 2347 model()->MergeDataAndStartSyncing( |
2282 syncer::SEARCH_ENGINES, initial_data, PassProcessor(), | 2348 syncer::SEARCH_ENGINES, initial_data, PassProcessor(), |
2283 CreateAndPassSyncErrorFactory()); | 2349 CreateAndPassSyncErrorFactory()); |
2284 } | 2350 } |
OLD | NEW |