OLD | NEW |
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/extensions/extension_service_unittest.h" | 9 #include "chrome/browser/extensions/extension_service_unittest.h" |
10 #include "chrome/browser/prefs/session_startup_pref.h" | 10 #include "chrome/browser/prefs/session_startup_pref.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 ThemeService* theme_service = | 169 ThemeService* theme_service = |
170 ThemeServiceFactory::GetForProfile(profile_.get()); | 170 ThemeServiceFactory::GetForProfile(profile_.get()); |
171 EXPECT_FALSE(theme_service->UsingDefaultTheme()); | 171 EXPECT_FALSE(theme_service->UsingDefaultTheme()); |
172 #endif | 172 #endif |
173 | 173 |
174 scoped_refptr<Extension> ext2 = CreateExtension( | 174 scoped_refptr<Extension> ext2 = CreateExtension( |
175 "example2", | 175 "example2", |
176 base::FilePath(FILE_PATH_LITERAL("//nonexistent")), | 176 base::FilePath(FILE_PATH_LITERAL("//nonexistent")), |
177 Manifest::INVALID_LOCATION, | 177 Manifest::INVALID_LOCATION, |
178 false); | 178 false); |
179 service_->AddExtension(ext2); | 179 service_->AddExtension(ext2.get()); |
180 // Components and external policy extensions shouldn't be deleted. | 180 // Components and external policy extensions shouldn't be deleted. |
181 scoped_refptr<Extension> ext3 = CreateExtension( | 181 scoped_refptr<Extension> ext3 = CreateExtension( |
182 "example3", | 182 "example3", |
183 base::FilePath(FILE_PATH_LITERAL("//nonexistent2")), | 183 base::FilePath(FILE_PATH_LITERAL("//nonexistent2")), |
184 Manifest::COMPONENT, | 184 Manifest::COMPONENT, |
185 false); | 185 false); |
186 service_->AddExtension(ext3); | 186 service_->AddExtension(ext3.get()); |
187 scoped_refptr<Extension> ext4 = CreateExtension( | 187 scoped_refptr<Extension> ext4 = |
188 "example4", | 188 CreateExtension("example4", |
189 base::FilePath(FILE_PATH_LITERAL("//nonexistent3")), | 189 base::FilePath(FILE_PATH_LITERAL("//nonexistent3")), |
190 Manifest::EXTERNAL_POLICY_DOWNLOAD, | 190 Manifest::EXTERNAL_POLICY_DOWNLOAD, |
191 false); | 191 false); |
192 service_->AddExtension(ext4); | 192 service_->AddExtension(ext4.get()); |
193 EXPECT_EQ(4u, service_->extensions()->size()); | 193 EXPECT_EQ(4u, service_->extensions()->size()); |
194 | 194 |
195 resetter_->Reset( | 195 resetter_->Reset( |
196 ProfileResetter::EXTENSIONS, | 196 ProfileResetter::EXTENSIONS, |
197 ProfileResetter::DISABLE_EXTENSIONS, | 197 ProfileResetter::DISABLE_EXTENSIONS, |
198 base::Bind(&MockObject::StopLoop, base::Unretained(&mock_object_))); | 198 base::Bind(&MockObject::StopLoop, base::Unretained(&mock_object_))); |
199 mock_object_.RunLoop(); | 199 mock_object_.RunLoop(); |
200 | 200 |
201 EXPECT_EQ(2u, service_->extensions()->size()); | 201 EXPECT_EQ(2u, service_->extensions()->size()); |
202 EXPECT_TRUE(service_->extensions()->Contains(ext3->id())); | 202 EXPECT_TRUE(service_->extensions()->Contains(ext3->id())); |
(...skipping 26 matching lines...) Expand all Loading... |
229 TEST_F(ProfileResetterTest, ResetFewFlags) { | 229 TEST_F(ProfileResetterTest, ResetFewFlags) { |
230 // mock_object_ is a StrictMock, so we verify that it is called only once. | 230 // mock_object_ is a StrictMock, so we verify that it is called only once. |
231 resetter_->Reset( | 231 resetter_->Reset( |
232 ProfileResetter::DEFAULT_SEARCH_ENGINE | ProfileResetter::HOMEPAGE, | 232 ProfileResetter::DEFAULT_SEARCH_ENGINE | ProfileResetter::HOMEPAGE, |
233 ProfileResetter::DISABLE_EXTENSIONS, | 233 ProfileResetter::DISABLE_EXTENSIONS, |
234 base::Bind(&MockObject::StopLoop, base::Unretained(&mock_object_))); | 234 base::Bind(&MockObject::StopLoop, base::Unretained(&mock_object_))); |
235 mock_object_.RunLoop(); | 235 mock_object_.RunLoop(); |
236 } | 236 } |
237 | 237 |
238 } // namespace | 238 } // namespace |
OLD | NEW |