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

Unified Diff: components/history/core/test/history_client_fake_bookmarks.cc

Issue 285233012: Abstract history dependencies on bookmarks through HistoryClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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: components/history/core/test/history_client_fake_bookmarks.cc
diff --git a/components/history/core/test/history_client_fake_bookmarks.cc b/components/history/core/test/history_client_fake_bookmarks.cc
new file mode 100644
index 0000000000000000000000000000000000000000..95c6e0f9039aec8a2272a7139ca9c6c2746bc56c
--- /dev/null
+++ b/components/history/core/test/history_client_fake_bookmarks.cc
@@ -0,0 +1,41 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/history/core/test/history_client_fake_bookmarks.h"
+
+namespace history {
+
+HistoryClientFakeBookmarks::HistoryClientFakeBookmarks() {
+}
+
+HistoryClientFakeBookmarks::~HistoryClientFakeBookmarks() {
+}
+
+void HistoryClientFakeBookmarks::ClearAllBookmarks() {
+ bookmarked_urls_.clear();
+}
+
+void HistoryClientFakeBookmarks::AddBookmark(const GURL& url) {
+ bookmarked_urls_.insert(url);
+}
+
+void HistoryClientFakeBookmarks::DelBookmark(const GURL& url) {
+ bookmarked_urls_.erase(url);
+}
+
+bool HistoryClientFakeBookmarks::IsBookmarked(const GURL& url) {
+ return bookmarked_urls_.find(url) != bookmarked_urls_.end();
+}
+
+void HistoryClientFakeBookmarks::GetBookmarks(
+ std::vector<URLAndTitle> *bookmarks) {
+ bookmarks->reserve(bookmarks->size() + bookmarked_urls_.size());
+ for (std::set<GURL>::const_iterator i = bookmarked_urls_.begin();
+ i != bookmarked_urls_.end(); ++i) {
+ URLAndTitle urlAndTitle = { *i, base::string16() };
+ bookmarks->push_back(urlAndTitle);
+ }
+}
+
+} // namespace history

Powered by Google App Engine
This is Rietveld 408576698