| 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 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2413 // Now test that a remote TemplateURL can override the attributes of the local | 2413 // Now test that a remote TemplateURL can override the attributes of the local |
| 2414 // default search provider. | 2414 // default search provider. |
| 2415 TemplateURL* existing_default = new TemplateURL(data); | 2415 TemplateURL* existing_default = new TemplateURL(data); |
| 2416 model()->Add(base::WrapUnique(existing_default)); | 2416 model()->Add(base::WrapUnique(existing_default)); |
| 2417 model()->SetUserSelectedDefaultSearchProvider(existing_default); | 2417 model()->SetUserSelectedDefaultSearchProvider(existing_default); |
| 2418 | 2418 |
| 2419 merge_result = model()->MergeDataAndStartSyncing( | 2419 merge_result = model()->MergeDataAndStartSyncing( |
| 2420 syncer::SEARCH_ENGINES, list, PassProcessor(), | 2420 syncer::SEARCH_ENGINES, list, PassProcessor(), |
| 2421 CreateAndPassSyncErrorFactory()); | 2421 CreateAndPassSyncErrorFactory()); |
| 2422 | 2422 |
| 2423 result_turl = model()->GetDefaultSearchProvider(); | 2423 const TemplateURL* final_turl = model()->GetDefaultSearchProvider(); |
| 2424 EXPECT_TRUE(result_turl); | 2424 EXPECT_TRUE(final_turl); |
| 2425 EXPECT_EQ(ASCIIToUTF16("new_kw"), result_turl->keyword()); | 2425 EXPECT_EQ(ASCIIToUTF16("new_kw"), final_turl->keyword()); |
| 2426 EXPECT_EQ(ASCIIToUTF16("my name"), result_turl->short_name()); | 2426 EXPECT_EQ(ASCIIToUTF16("my name"), final_turl->short_name()); |
| 2427 EXPECT_EQ(default_turl->url(), result_turl->url()); | 2427 EXPECT_EQ(default_turl->url(), final_turl->url()); |
| 2428 } | 2428 } |
| 2429 | 2429 |
| 2430 TEST_F(TemplateURLServiceSyncTest, MergeNonEditedPrepopulatedEngine) { | 2430 TEST_F(TemplateURLServiceSyncTest, MergeNonEditedPrepopulatedEngine) { |
| 2431 std::unique_ptr<TemplateURLData> default_turl( | 2431 std::unique_ptr<TemplateURLData> default_turl( |
| 2432 TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(NULL)); | 2432 TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(NULL)); |
| 2433 | 2433 |
| 2434 TemplateURLData data(*default_turl); | 2434 TemplateURLData data(*default_turl); |
| 2435 data.safe_for_autoreplace = true; // Can be replaced with built-in values. | 2435 data.safe_for_autoreplace = true; // Can be replaced with built-in values. |
| 2436 data.SetKeyword(ASCIIToUTF16("new_kw")); | 2436 data.SetKeyword(ASCIIToUTF16("new_kw")); |
| 2437 data.SetShortName(ASCIIToUTF16("my name")); | 2437 data.SetShortName(ASCIIToUTF16("my name")); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 | 2481 |
| 2482 TEST_F(TemplateURLServiceSyncTest, NonAsciiKeywordDoesNotCrash) { | 2482 TEST_F(TemplateURLServiceSyncTest, NonAsciiKeywordDoesNotCrash) { |
| 2483 model()->Add(CreateTestTemplateURL(UTF8ToUTF16("\xf0\xaf\xa6\x8d"), | 2483 model()->Add(CreateTestTemplateURL(UTF8ToUTF16("\xf0\xaf\xa6\x8d"), |
| 2484 "http://key1.com")); | 2484 "http://key1.com")); |
| 2485 syncer::SyncDataList initial_data = CreateInitialSyncData(); | 2485 syncer::SyncDataList initial_data = CreateInitialSyncData(); |
| 2486 | 2486 |
| 2487 model()->MergeDataAndStartSyncing( | 2487 model()->MergeDataAndStartSyncing( |
| 2488 syncer::SEARCH_ENGINES, initial_data, PassProcessor(), | 2488 syncer::SEARCH_ENGINES, initial_data, PassProcessor(), |
| 2489 CreateAndPassSyncErrorFactory()); | 2489 CreateAndPassSyncErrorFactory()); |
| 2490 } | 2490 } |
| OLD | NEW |