OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base/testing_profile.h" | 5 #include "chrome/test/base/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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 HistoryService* history_service = | 413 HistoryService* history_service = |
414 HistoryServiceFactory::GetForProfileWithoutCreating(this); | 414 HistoryServiceFactory::GetForProfileWithoutCreating(this); |
415 if (history_service) { | 415 if (history_service) { |
416 history_service->history_backend_->bookmark_service_ = | 416 history_service->history_backend_->bookmark_service_ = |
417 bookmark_service; | 417 bookmark_service; |
418 history_service->history_backend_->expirer_.bookmark_service_ = | 418 history_service->history_backend_->expirer_.bookmark_service_ = |
419 bookmark_service; | 419 bookmark_service; |
420 } | 420 } |
421 } | 421 } |
422 | 422 |
423 static scoped_refptr<RefcountedProfileKeyedService> BuildWebDataService( | 423 static ProfileKeyedService* BuildWebDataService( |
424 Profile* profile) { | 424 Profile* profile) { |
425 base::FilePath path = profile->GetPath(); | 425 return new WebDataServiceWrapper(profile); |
426 path = path.Append(chrome::kWebDataFilename); | |
427 WebDataService* web_data_service = new WebDataService(); | |
428 if (web_data_service) | |
429 web_data_service->Init(path); | |
430 return web_data_service; | |
431 } | 426 } |
432 | 427 |
433 void TestingProfile::CreateWebDataService() { | 428 void TestingProfile::CreateWebDataService() { |
434 WebDataServiceFactory::GetInstance()->SetTestingFactory( | 429 WebDataServiceFactory::GetInstance()->SetTestingFactory( |
435 this, BuildWebDataService); | 430 this, BuildWebDataService); |
436 } | 431 } |
437 | 432 |
438 void TestingProfile::BlockUntilBookmarkModelLoaded() { | 433 void TestingProfile::BlockUntilBookmarkModelLoaded() { |
439 // Only get the bookmark model if it actually exists since the caller of the | 434 // Only get the bookmark model if it actually exists since the caller of the |
440 // test should explicitly call CreateBookmarkModel to build it. | 435 // test should explicitly call CreateBookmarkModel to build it. |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 | 796 |
802 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 797 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
803 DCHECK(!build_called_); | 798 DCHECK(!build_called_); |
804 build_called_ = true; | 799 build_called_ = true; |
805 return scoped_ptr<TestingProfile>(new TestingProfile( | 800 return scoped_ptr<TestingProfile>(new TestingProfile( |
806 path_, | 801 path_, |
807 delegate_, | 802 delegate_, |
808 extension_policy_, | 803 extension_policy_, |
809 pref_service_.Pass())); | 804 pref_service_.Pass())); |
810 } | 805 } |
OLD | NEW |