Remove last references to profile->GetHistory() and profile->GetBookmarkModel().
BUG=97804, 112525
TEST=existing unittests
Review URL: https://chromiumcodereview.appspot.com/10795056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150483 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/test/base/profile_mock.h b/chrome/test/base/profile_mock.h
index b46371d..d3929a5e 100644
--- a/chrome/test/base/profile_mock.h
+++ b/chrome/test/base/profile_mock.h
@@ -14,9 +14,6 @@
ProfileMock();
virtual ~ProfileMock();
- MOCK_METHOD0(GetBookmarkModel, BookmarkModel*());
- MOCK_METHOD1(GetHistoryService, HistoryService*(ServiceAccessType access));
- MOCK_METHOD0(GetHistoryServiceWithoutCreating, HistoryService*());
MOCK_METHOD1(GetPasswordStore, PasswordStore* (ServiceAccessType access));
};
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index c173ef3..eabf2e3f 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -420,15 +420,19 @@
}
void TestingProfile::BlockUntilBookmarkModelLoaded() {
- DCHECK(GetBookmarkModel());
- if (GetBookmarkModel()->IsLoaded())
+ // Only get the bookmark model if it actually exists since the caller of the
+ // test should explicitly call CreateBookmarkModel to build it.
+ BookmarkModel* bookmark_model =
+ BookmarkModelFactory::GetForProfileIfExists(this);
+ DCHECK(bookmark_model);
+ if (bookmark_model->IsLoaded())
return;
base::RunLoop run_loop;
BookmarkLoadObserver observer(content::GetQuitTaskForRunLoop(&run_loop));
- GetBookmarkModel()->AddObserver(&observer);
+ bookmark_model->AddObserver(&observer);
run_loop.Run();
- GetBookmarkModel()->RemoveObserver(&observer);
- DCHECK(GetBookmarkModel()->IsLoaded());
+ bookmark_model->RemoveObserver(&observer);
+ DCHECK(bookmark_model->IsLoaded());
}
// TODO(phajdan.jr): Doesn't this hang if Top Sites are already loaded?
@@ -436,7 +440,7 @@
content::WindowedNotificationObserver top_sites_loaded_observer(
chrome::NOTIFICATION_TOP_SITES_LOADED,
content::NotificationService::AllSources());
- if (!GetHistoryService(Profile::EXPLICIT_ACCESS))
+ if (!HistoryServiceFactory::GetForProfile(this, Profile::EXPLICIT_ACCESS))
GetTopSites()->HistoryLoaded();
top_sites_loaded_observer.Wait();
}
@@ -520,14 +524,6 @@
return favicon_service_.get();
}
-HistoryService* TestingProfile::GetHistoryService(ServiceAccessType access) {
- return HistoryServiceFactory::GetForProfileIfExists(this, access);
-}
-
-HistoryService* TestingProfile::GetHistoryServiceWithoutCreating() {
- return HistoryServiceFactory::GetForProfileWithoutCreating(this);
-}
-
net::CookieMonster* TestingProfile::GetCookieMonster() {
if (!GetRequestContext())
return NULL;
@@ -706,10 +702,6 @@
return last_session_exited_cleanly_;
}
-BookmarkModel* TestingProfile::GetBookmarkModel() {
- return BookmarkModelFactory::GetForProfileIfExists(this);
-}
-
bool TestingProfile::IsSameProfile(Profile *p) {
return this == p;
}
diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h
index 493f903..2cf39706 100644
--- a/chrome/test/base/testing_profile.h
+++ b/chrome/test/base/testing_profile.h
@@ -217,8 +217,6 @@
virtual ExtensionSpecialStoragePolicy*
GetExtensionSpecialStoragePolicy() OVERRIDE;
virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE;
- virtual HistoryService* GetHistoryService(ServiceAccessType access) OVERRIDE;
- virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE;
// The CookieMonster will only be returned if a Context has been created. Do
// this by calling CreateRequestContext(). See the note at GetRequestContext
// for more information.
@@ -258,7 +256,6 @@
std::wstring* output_string) {}
virtual void MergeResourceInteger(int message_id, int* output_value) {}
virtual void MergeResourceBoolean(int message_id, bool* output_value) {}
- virtual BookmarkModel* GetBookmarkModel() OVERRIDE;
virtual bool IsSameProfile(Profile *p) OVERRIDE;
virtual base::Time GetStartTime() const OVERRIDE;
virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE;