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

Side by Side Diff: chrome/test/testing_profile.cc

Issue 5213002: Fix for Bug 50726 "Save extension list and "winning" prefs from extensions" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Addressed Mattias' comments Created 10 years 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 | Annotate | Revision Log
« chrome/browser/profile_impl.h ('K') | « chrome/test/testing_profile.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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(
351 this,
352 install_directory));
350 extensions_service_ = new ExtensionsService(this, 353 extensions_service_ = new ExtensionsService(this,
351 command_line, 354 command_line,
352 install_directory, 355 install_directory,
356 extension_prefs_.get(),
353 false); 357 false);
354 return extensions_service_; 358 return extensions_service_;
355 } 359 }
356 360
357 FilePath TestingProfile::GetPath() { 361 FilePath TestingProfile::GetPath() {
358 DCHECK(temp_dir_.IsValid()); // TODO(phajdan.jr): do it better. 362 DCHECK(temp_dir_.IsValid()); // TODO(phajdan.jr): do it better.
359 return temp_dir_.path(); 363 return temp_dir_.path();
360 } 364 }
361 365
362 TestingPrefService* TestingProfile::GetTestingPrefService() { 366 TestingPrefService* TestingProfile::GetTestingPrefService() {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 browser::RegisterAllPrefs(prefs_.get(), prefs_.get()); 411 browser::RegisterAllPrefs(prefs_.get(), prefs_.get());
408 } 412 }
409 413
410 PrefService* TestingProfile::GetPrefs() { 414 PrefService* TestingProfile::GetPrefs() {
411 if (!prefs_.get()) { 415 if (!prefs_.get()) {
412 CreateTestingPrefService(); 416 CreateTestingPrefService();
413 } 417 }
414 return prefs_.get(); 418 return prefs_.get();
415 } 419 }
416 420
421 PrefStore* TestingProfile::GetExtensionPrefStore() {
422 return extension_pref_store_;
423 }
424
425 void TestingProfile::SetExtensionPrefStore(PrefStore* extension_pref_store) {
426 extension_pref_store_ = extension_pref_store;
427 }
428
417 history::TopSites* TestingProfile::GetTopSites() { 429 history::TopSites* TestingProfile::GetTopSites() {
418 return top_sites_.get(); 430 return top_sites_.get();
419 } 431 }
420 432
421 URLRequestContextGetter* TestingProfile::GetRequestContext() { 433 URLRequestContextGetter* TestingProfile::GetRequestContext() {
422 return request_context_.get(); 434 return request_context_.get();
423 } 435 }
424 436
425 void TestingProfile::CreateRequestContext() { 437 void TestingProfile::CreateRequestContext() {
426 if (!request_context_) 438 if (!request_context_)
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 542 }
531 return profile_sync_service_.get(); 543 return profile_sync_service_.get();
532 } 544 }
533 545
534 void TestingProfile::DestroyWebDataService() { 546 void TestingProfile::DestroyWebDataService() {
535 if (!web_data_service_.get()) 547 if (!web_data_service_.get())
536 return; 548 return;
537 549
538 web_data_service_->Shutdown(); 550 web_data_service_->Shutdown();
539 } 551 }
OLDNEW
« chrome/browser/profile_impl.h ('K') | « chrome/test/testing_profile.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698