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

Side by Side Diff: chrome/browser/profile_resetter/profile_resetter_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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/browser/profile_resetter/profile_resetter.h" 5 #include "chrome/browser/profile_resetter/profile_resetter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 TEST_F(ProfileResetterTest, ResetNothing) { 431 TEST_F(ProfileResetterTest, ResetNothing) {
432 // The callback should be called even if there is nothing to reset. 432 // The callback should be called even if there is nothing to reset.
433 ResetAndWait(0); 433 ResetAndWait(0);
434 } 434 }
435 435
436 TEST_F(ProfileResetterTest, ResetDefaultSearchEngineNonOrganic) { 436 TEST_F(ProfileResetterTest, ResetDefaultSearchEngineNonOrganic) {
437 ResetAndWait(ProfileResetter::DEFAULT_SEARCH_ENGINE, kDistributionConfig); 437 ResetAndWait(ProfileResetter::DEFAULT_SEARCH_ENGINE, kDistributionConfig);
438 438
439 TemplateURLService* model = 439 TemplateURLService* model =
440 TemplateURLServiceFactory::GetForProfile(profile()); 440 TemplateURLServiceFactory::GetForProfile(profile());
441 TemplateURL* default_engine = model->GetDefaultSearchProvider(); 441 const TemplateURL* default_engine = model->GetDefaultSearchProvider();
442 ASSERT_NE(static_cast<TemplateURL*>(NULL), default_engine); 442 ASSERT_NE(static_cast<TemplateURL*>(NULL), default_engine);
443 EXPECT_EQ(base::ASCIIToUTF16("first"), default_engine->short_name()); 443 EXPECT_EQ(base::ASCIIToUTF16("first"), default_engine->short_name());
444 EXPECT_EQ(base::ASCIIToUTF16("firstkey"), default_engine->keyword()); 444 EXPECT_EQ(base::ASCIIToUTF16("firstkey"), default_engine->keyword());
445 EXPECT_EQ("http://www.foo.com/s?q={searchTerms}", default_engine->url()); 445 EXPECT_EQ("http://www.foo.com/s?q={searchTerms}", default_engine->url());
446 } 446 }
447 447
448 TEST_F(ProfileResetterTest, ResetDefaultSearchEnginePartially) { 448 TEST_F(ProfileResetterTest, ResetDefaultSearchEnginePartially) {
449 // Search engine's logic is tested by 449 // Search engine's logic is tested by
450 // TemplateURLServiceTest.RepairPrepopulatedSearchEngines. 450 // TemplateURLServiceTest.RepairPrepopulatedSearchEngines.
451 // Make sure TemplateURLService has loaded. 451 // Make sure TemplateURLService has loaded.
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 new ResettableSettingsSnapshot(profile())); 1054 new ResettableSettingsSnapshot(profile()));
1055 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, 1055 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail,
1056 base::Unretained(&capture))); 1056 base::Unretained(&capture)));
1057 deleted_snapshot.reset(); 1057 deleted_snapshot.reset();
1058 // Running remaining tasks shouldn't trigger the callback to be called as 1058 // Running remaining tasks shouldn't trigger the callback to be called as
1059 // |deleted_snapshot| was deleted before it could run. 1059 // |deleted_snapshot| was deleted before it could run.
1060 base::RunLoop().RunUntilIdle(); 1060 base::RunLoop().RunUntilIdle();
1061 } 1061 }
1062 1062
1063 } // namespace 1063 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | chrome/browser/profile_resetter/resettable_settings_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698