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

Unified Diff: components/history/core/browser/history_backend_unittest.cc

Issue 1198373002: Split HistoryClient in two objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@1192403002
Patch Set: Add comments in ChromeHistoryBackendClient Created 5 years, 6 months 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 side-by-side diff with in-line comments
Download patch
Index: components/history/core/browser/history_backend_unittest.cc
diff --git a/components/history/core/browser/history_backend_unittest.cc b/components/history/core/browser/history_backend_unittest.cc
index b1c0b0720720b4c2485e9f2cf6590646c72ebb72..c9aad3318447eb97aee24970e297f8803fc40899 100644
--- a/components/history/core/browser/history_backend_unittest.cc
+++ b/components/history/core/browser/history_backend_unittest.cc
@@ -26,6 +26,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "components/favicon_base/favicon_usage_data.h"
+#include "components/history/core/browser/history_backend_client.h"
#include "components/history/core/browser/history_constants.h"
#include "components/history/core/browser/history_database_params.h"
#include "components/history/core/browser/history_service.h"
@@ -68,15 +69,6 @@ typedef base::Callback<void(const history::URLRow*,
const history::URLRow*)>
SimulateNotificationCallback;
-class HistoryClientMock : public history::HistoryClientFakeBookmarks {
- public:
- explicit HistoryClientMock(const GURL& url_to_bookmark) {
- AddBookmark(url_to_bookmark);
- }
-
- MOCK_METHOD0(BlockUntilBookmarksLoaded, void());
-};
-
void SimulateNotificationURLVisited(history::HistoryServiceObserver* observer,
const history::URLRow* row1,
const history::URLRow* row2,
@@ -249,7 +241,7 @@ class HistoryBackendTestBase : public testing::Test {
&test_dir_))
return;
backend_ = new HistoryBackend(new HistoryBackendTestDelegate(this),
- &history_client_,
+ history_client_.CreateBackendClient(),
base::ThreadTaskRunnerHandle::Get());
backend_->Init(std::string(), false,
TestHistoryDatabaseParamsForPath(test_dir_));
@@ -1697,7 +1689,7 @@ TEST_F(HistoryBackendTest, MigrationVisitSource) {
ASSERT_TRUE(base::CopyFile(old_history_path, new_history_file));
backend_ = new HistoryBackend(new HistoryBackendTestDelegate(this),
- &history_client_,
+ history_client_.CreateBackendClient(),
base::ThreadTaskRunnerHandle::Get());
backend_->Init(std::string(), false,
TestHistoryDatabaseParamsForPath(new_history_path));
@@ -3116,7 +3108,7 @@ TEST_F(HistoryBackendTest, MigrationVisitDuration) {
ASSERT_TRUE(base::CopyFile(old_history, new_history_file));
backend_ = new HistoryBackend(new HistoryBackendTestDelegate(this),
- &history_client_,
+ history_client_.CreateBackendClient(),
base::ThreadTaskRunnerHandle::Get());
backend_->Init(std::string(), false,
TestHistoryDatabaseParamsForPath(new_history_path));
@@ -3340,10 +3332,9 @@ TEST_F(HistoryBackendTest, RemoveNotification) {
// Add a URL.
GURL url("http://www.google.com");
- scoped_ptr<HistoryClientMock> history_client(new HistoryClientMock(url));
- HistoryClientMock* history_client_mock = history_client.get();
- scoped_ptr<HistoryService> service(new HistoryService(
- history_client.Pass(), scoped_ptr<history::VisitDelegate>()));
+ scoped_ptr<HistoryService> service(
+ new HistoryService(make_scoped_ptr(new HistoryClientFakeBookmarks),
+ scoped_ptr<history::VisitDelegate>()));
EXPECT_TRUE(
service->Init(kAcceptLanguagesForTest,
TestHistoryDatabaseParamsForPath(scoped_temp_dir.path())));
@@ -3354,7 +3345,6 @@ TEST_F(HistoryBackendTest, RemoveNotification) {
// This won't actually delete the URL, rather it'll empty out the visits.
// This triggers blocking on the BookmarkModel.
- EXPECT_CALL(*history_client_mock, BlockUntilBookmarksLoaded());
service->DeleteURL(url);
}
« no previous file with comments | « components/history/core/browser/history_backend_client.cc ('k') | components/history/core/browser/history_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698