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

Unified Diff: chrome/browser/history/scored_history_match_unittest.cc

Issue 285233012: Abstract history dependencies on bookmarks through HistoryClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests Created 6 years, 7 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: chrome/browser/history/scored_history_match_unittest.cc
diff --git a/chrome/browser/history/scored_history_match_unittest.cc b/chrome/browser/history/scored_history_match_unittest.cc
index 2ab39a908a96c21d569077832a27263042d7b55f..f89091e91bebe0c7b85d0a42d30966d21a28b190 100644
--- a/chrome/browser/history/scored_history_match_unittest.cc
+++ b/chrome/browser/history/scored_history_match_unittest.cc
@@ -8,7 +8,7 @@
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/history/scored_history_match.h"
-#include "components/bookmarks/browser/bookmark_service.h"
+#include "components/history/core/browser/test_history_client.h"
#include "testing/gtest/include/gtest/gtest.h"
using base::ASCIIToUTF16;
@@ -181,30 +181,23 @@ TEST_F(ScoredHistoryMatchTest, Scoring) {
EXPECT_EQ(scored_f.raw_score(), 0);
}
-class BookmarkServiceMock : public BookmarkService {
+class HistoryClientMock : public TestHistoryClient {
public:
- explicit BookmarkServiceMock(const GURL& url);
- virtual ~BookmarkServiceMock() {}
+ explicit HistoryClientMock(const GURL& url);
- // Returns true if the given |url| is the same as |url_|.
+ // HistoryClient:
virtual bool IsBookmarked(const GURL& url) OVERRIDE;
- // Required but unused.
- virtual void GetBookmarks(std::vector<URLAndTitle>* bookmarks) OVERRIDE {}
- virtual void BlockTillLoaded() OVERRIDE {}
-
private:
- const GURL url_;
+ GURL url_;
- DISALLOW_COPY_AND_ASSIGN(BookmarkServiceMock);
+ DISALLOW_COPY_AND_ASSIGN(HistoryClientMock);
};
-BookmarkServiceMock::BookmarkServiceMock(const GURL& url)
- : BookmarkService(),
- url_(url) {
-}
+HistoryClientMock::HistoryClientMock(const GURL& url)
+ : url_(url) {}
-bool BookmarkServiceMock::IsBookmarked(const GURL& url) {
+bool HistoryClientMock::IsBookmarked(const GURL& url) {
return url == url_;
}
@@ -225,10 +218,10 @@ TEST_F(ScoredHistoryMatchTest, ScoringBookmarks) {
one_word_no_offset, word_starts, now, NULL);
// Now bookmark that URL and make sure its score increases.
base::AutoReset<int> reset(&ScoredHistoryMatch::bookmark_value_, 5);
- BookmarkServiceMock bookmark_service_mock(url);
+ HistoryClientMock history_client_mock(url);
ScoredHistoryMatch scored_with_bookmark(
row, visits, std::string(), ASCIIToUTF16("abc"), Make1Term("abc"),
- one_word_no_offset, word_starts, now, &bookmark_service_mock);
+ one_word_no_offset, word_starts, now, &history_client_mock);
EXPECT_GT(scored_with_bookmark.raw_score(), scored.raw_score());
}

Powered by Google App Engine
This is Rietveld 408576698