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

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

Issue 2816383002: Remove non-const version of GetDefaultSearchProvider() and make all callers call the const version (Closed)
Patch Set: Fix unit test (the model was already loaded) Created 3 years, 8 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
OLDNEW
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 2405 matching lines...) Expand 10 before | Expand all | Expand 10 after
2416 // Now test that a remote TemplateURL can override the attributes of the local 2416 // Now test that a remote TemplateURL can override the attributes of the local
2417 // default search provider. 2417 // default search provider.
2418 TemplateURL* existing_default = new TemplateURL(data); 2418 TemplateURL* existing_default = new TemplateURL(data);
2419 model()->Add(base::WrapUnique(existing_default)); 2419 model()->Add(base::WrapUnique(existing_default));
2420 model()->SetUserSelectedDefaultSearchProvider(existing_default); 2420 model()->SetUserSelectedDefaultSearchProvider(existing_default);
2421 2421
2422 merge_result = model()->MergeDataAndStartSyncing( 2422 merge_result = model()->MergeDataAndStartSyncing(
2423 syncer::SEARCH_ENGINES, list, PassProcessor(), 2423 syncer::SEARCH_ENGINES, list, PassProcessor(),
2424 CreateAndPassSyncErrorFactory()); 2424 CreateAndPassSyncErrorFactory());
2425 2425
2426 result_turl = model()->GetDefaultSearchProvider(); 2426 const TemplateURL* final_turl = model()->GetDefaultSearchProvider();
2427 EXPECT_TRUE(result_turl); 2427 EXPECT_TRUE(final_turl);
2428 EXPECT_EQ(ASCIIToUTF16("new_kw"), result_turl->keyword()); 2428 EXPECT_EQ(ASCIIToUTF16("new_kw"), final_turl->keyword());
2429 EXPECT_EQ(ASCIIToUTF16("my name"), result_turl->short_name()); 2429 EXPECT_EQ(ASCIIToUTF16("my name"), final_turl->short_name());
2430 EXPECT_EQ(default_turl->url(), result_turl->url()); 2430 EXPECT_EQ(default_turl->url(), final_turl->url());
2431 } 2431 }
2432 2432
2433 TEST_F(TemplateURLServiceSyncTest, MergeNonEditedPrepopulatedEngine) { 2433 TEST_F(TemplateURLServiceSyncTest, MergeNonEditedPrepopulatedEngine) {
2434 std::unique_ptr<TemplateURLData> default_turl( 2434 std::unique_ptr<TemplateURLData> default_turl(
2435 TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(NULL)); 2435 TemplateURLPrepopulateData::GetPrepopulatedDefaultSearch(NULL));
2436 2436
2437 TemplateURLData data(*default_turl); 2437 TemplateURLData data(*default_turl);
2438 data.safe_for_autoreplace = true; // Can be replaced with built-in values. 2438 data.safe_for_autoreplace = true; // Can be replaced with built-in values.
2439 data.SetKeyword(ASCIIToUTF16("new_kw")); 2439 data.SetKeyword(ASCIIToUTF16("new_kw"));
2440 data.SetShortName(ASCIIToUTF16("my name")); 2440 data.SetShortName(ASCIIToUTF16("my name"));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2484 2484
2485 TEST_F(TemplateURLServiceSyncTest, NonAsciiKeywordDoesNotCrash) { 2485 TEST_F(TemplateURLServiceSyncTest, NonAsciiKeywordDoesNotCrash) {
2486 model()->Add(CreateTestTemplateURL(UTF8ToUTF16("\xf0\xaf\xa6\x8d"), 2486 model()->Add(CreateTestTemplateURL(UTF8ToUTF16("\xf0\xaf\xa6\x8d"),
2487 "http://key1.com")); 2487 "http://key1.com"));
2488 syncer::SyncDataList initial_data = CreateInitialSyncData(); 2488 syncer::SyncDataList initial_data = CreateInitialSyncData();
2489 2489
2490 model()->MergeDataAndStartSyncing( 2490 model()->MergeDataAndStartSyncing(
2491 syncer::SEARCH_ENGINES, initial_data, PassProcessor(), 2491 syncer::SEARCH_ENGINES, initial_data, PassProcessor(),
2492 CreateAndPassSyncErrorFactory()); 2492 CreateAndPassSyncErrorFactory());
2493 } 2493 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698