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

Side by Side Diff: chrome/browser/profile_resetter/profile_resetter_unittest.cc

Issue 15572002: Implemented 'Reset Search engines' feature. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reset Google search URL together with search engines Created 7 years, 6 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/prefs/session_startup_pref.h" 9 #include "chrome/browser/prefs/session_startup_pref.h"
10 #include "chrome/browser/search_engines/template_url_service_test_util.h" 10 #include "chrome/browser/search_engines/template_url_service_test_util.h"
(...skipping 21 matching lines...) Expand all
32 private: 32 private:
33 MOCK_METHOD0(Callback, void(void)); 33 MOCK_METHOD0(Callback, void(void));
34 34
35 scoped_refptr<content::MessageLoopRunner> runner_; 35 scoped_refptr<content::MessageLoopRunner> runner_;
36 }; 36 };
37 37
38 class ProfileResetterTest : public testing::Test { 38 class ProfileResetterTest : public testing::Test {
39 protected: 39 protected:
40 ProfileResetterTest(); 40 ProfileResetterTest();
41 ~ProfileResetterTest(); 41 ~ProfileResetterTest();
42 // testing::Test: 42 // testing::Test:
Peter Kasting 2013/05/29 04:04:41 Nit: Add blank line above
vasilii 2013/05/29 08:30:18 Done.
43 virtual void SetUp() OVERRIDE; 43 virtual void SetUp() OVERRIDE;
44 virtual void TearDown() OVERRIDE; 44 virtual void TearDown() OVERRIDE;
45 45
46 testing::StrictMock<MockObject> mock_object_; 46 testing::StrictMock<MockObject> mock_object_;
47 TemplateURLServiceTestUtil test_util_; 47 TemplateURLServiceTestUtil test_util_;
48 scoped_ptr<ProfileResetter> resetter_; 48 scoped_ptr<ProfileResetter> resetter_;
49 49
50 DISALLOW_COPY_AND_ASSIGN(ProfileResetterTest); 50 DISALLOW_COPY_AND_ASSIGN(ProfileResetterTest);
51 }; 51 };
52 52
53 ProfileResetterTest::ProfileResetterTest() {} 53 ProfileResetterTest::ProfileResetterTest() {}
54 54
55 ProfileResetterTest::~ProfileResetterTest() {} 55 ProfileResetterTest::~ProfileResetterTest() {}
56 56
57 void ProfileResetterTest::SetUp() { 57 void ProfileResetterTest::SetUp() {
58 test_util_.SetUp(); 58 test_util_.SetUp();
59 resetter_.reset(new ProfileResetter(test_util_.profile())); 59 resetter_.reset(new ProfileResetter(test_util_.profile()));
60 } 60 }
61 61
62 void ProfileResetterTest::TearDown() { 62 void ProfileResetterTest::TearDown() {
63 test_util_.TearDown(); 63 test_util_.TearDown();
64 } 64 }
65 65
66 TEST_F(ProfileResetterTest, ResetDefaultSearchEngine) { 66 TEST_F(ProfileResetterTest, ResetDefaultSearchEngine) {
67 test_util_.VerifyLoad();
68 resetter_->Reset( 67 resetter_->Reset(
69 ProfileResetter::DEFAULT_SEARCH_ENGINE, 68 ProfileResetter::DEFAULT_SEARCH_ENGINE,
70 ProfileResetter::DISABLE_EXTENSIONS, 69 ProfileResetter::DISABLE_EXTENSIONS,
71 base::Bind(&MockObject::StopLoop, base::Unretained(&mock_object_))); 70 base::Bind(&MockObject::StopLoop, base::Unretained(&mock_object_)));
72 mock_object_.RunLoop(); 71 mock_object_.RunLoop();
73 } 72 }
74 73
75 TEST_F(ProfileResetterTest, ResetHomepage) { 74 TEST_F(ProfileResetterTest, ResetHomepage) {
76 PrefService* prefs = test_util_.profile()->GetPrefs(); 75 PrefService* prefs = test_util_.profile()->GetPrefs();
77 DCHECK(prefs); 76 DCHECK(prefs);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 base::Bind(&MockObject::StopLoop, base::Unretained(&mock_object_))); 136 base::Bind(&MockObject::StopLoop, base::Unretained(&mock_object_)));
138 mock_object_.RunLoop(); 137 mock_object_.RunLoop();
139 138
140 startup_pref = SessionStartupPref::GetStartupPref(prefs); 139 startup_pref = SessionStartupPref::GetStartupPref(prefs);
141 EXPECT_EQ(SessionStartupPref::GetDefaultStartupType(), startup_pref.type); 140 EXPECT_EQ(SessionStartupPref::GetDefaultStartupType(), startup_pref.type);
142 EXPECT_EQ(std::vector<GURL>(), startup_pref.urls); 141 EXPECT_EQ(std::vector<GURL>(), startup_pref.urls);
143 } 142 }
144 143
145 TEST_F(ProfileResetterTest, ResetExtensionsAll) { 144 TEST_F(ProfileResetterTest, ResetExtensionsAll) {
146 // mock_object_ is a StrictMock, so we verify that it is called only once. 145 // mock_object_ is a StrictMock, so we verify that it is called only once.
147 test_util_.VerifyLoad();
148 resetter_->Reset( 146 resetter_->Reset(
149 ProfileResetter::ALL, 147 ProfileResetter::ALL,
150 ProfileResetter::UNINSTALL_EXTENSIONS, 148 ProfileResetter::UNINSTALL_EXTENSIONS,
151 base::Bind(&MockObject::StopLoop, base::Unretained(&mock_object_))); 149 base::Bind(&MockObject::StopLoop, base::Unretained(&mock_object_)));
152 mock_object_.RunLoop(); 150 mock_object_.RunLoop();
153 } 151 }
154 152
155 } // namespace 153 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698