OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/test/testing_profile.h" | 5 #include "chrome/test/testing_profile.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 242 |
243 // Make sure we don't have any event pending that could disrupt the next | 243 // Make sure we don't have any event pending that could disrupt the next |
244 // test. | 244 // test. |
245 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask); | 245 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask); |
246 MessageLoop::current()->Run(); | 246 MessageLoop::current()->Run(); |
247 } | 247 } |
248 | 248 |
249 void TestingProfile::CreateTopSites() { | 249 void TestingProfile::CreateTopSites() { |
250 DestroyTopSites(); | 250 DestroyTopSites(); |
251 top_sites_ = new history::TopSites(this); | 251 top_sites_ = new history::TopSites(this); |
252 FilePath file_name = temp_dir_.path().Append(chrome::kTopSitesFilename); | 252 FilePath file_name = GetPath().Append(chrome::kTopSitesFilename); |
253 top_sites_->Init(file_name); | 253 top_sites_->Init(file_name); |
254 } | 254 } |
255 | 255 |
256 void TestingProfile::DestroyTopSites() { | 256 void TestingProfile::DestroyTopSites() { |
257 if (top_sites_.get()) { | 257 if (top_sites_.get()) { |
258 top_sites_->Shutdown(); | 258 top_sites_->Shutdown(); |
259 top_sites_ = NULL; | 259 top_sites_ = NULL; |
260 // TopSites::Shutdown schedules some tasks (from TopSitesBackend) that need | 260 // TopSites::Shutdown schedules some tasks (from TopSitesBackend) that need |
261 // to be run to properly shutdown. Run all pending tasks now. This is | 261 // to be run to properly shutdown. Run all pending tasks now. This is |
262 // normally handled by browser_process shutdown. | 262 // normally handled by browser_process shutdown. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 void TestingProfile::UseThemeProvider(BrowserThemeProvider* theme_provider) { | 341 void TestingProfile::UseThemeProvider(BrowserThemeProvider* theme_provider) { |
342 theme_provider->Init(this); | 342 theme_provider->Init(this); |
343 created_theme_provider_ = true; | 343 created_theme_provider_ = true; |
344 theme_provider_.reset(theme_provider); | 344 theme_provider_.reset(theme_provider); |
345 } | 345 } |
346 | 346 |
347 scoped_refptr<ExtensionsService> TestingProfile::CreateExtensionsService( | 347 scoped_refptr<ExtensionsService> TestingProfile::CreateExtensionsService( |
348 const CommandLine* command_line, | 348 const CommandLine* command_line, |
349 const FilePath& install_directory) { | 349 const FilePath& install_directory) { |
| 350 extension_prefs_.reset(new ExtensionPrefs(GetPrefs(),install_directory)); |
350 extensions_service_ = new ExtensionsService(this, | 351 extensions_service_ = new ExtensionsService(this, |
351 command_line, | 352 command_line, |
352 install_directory, | 353 install_directory, |
| 354 extension_prefs_.get(), |
353 false); | 355 false); |
354 return extensions_service_; | 356 return extensions_service_; |
355 } | 357 } |
356 | 358 |
357 FilePath TestingProfile::GetPath() { | 359 FilePath TestingProfile::GetPath() { |
358 DCHECK(temp_dir_.IsValid()); // TODO(phajdan.jr): do it better. | 360 DCHECK(temp_dir_.IsValid()); // TODO(phajdan.jr): do it better. |
359 return temp_dir_.path(); | 361 return temp_dir_.path(); |
360 } | 362 } |
361 | 363 |
362 TestingPrefService* TestingProfile::GetTestingPrefService() { | 364 TestingPrefService* TestingProfile::GetTestingPrefService() { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 } | 532 } |
531 return profile_sync_service_.get(); | 533 return profile_sync_service_.get(); |
532 } | 534 } |
533 | 535 |
534 void TestingProfile::DestroyWebDataService() { | 536 void TestingProfile::DestroyWebDataService() { |
535 if (!web_data_service_.get()) | 537 if (!web_data_service_.get()) |
536 return; | 538 return; |
537 | 539 |
538 web_data_service_->Shutdown(); | 540 web_data_service_->Shutdown(); |
539 } | 541 } |
OLD | NEW |