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

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: Fix android 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
« no previous file with comments | « components/history/core/test/history_client_fake_bookmarks.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8f2e084606683aa03e1148035e2eca665f3e4ee2
--- /dev/null
+++ b/components/history/core/test/history_client_fake_bookmarks.cc
@@ -0,0 +1,47 @@
+// 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() {
+ bookmarks_.clear();
+}
+
+void HistoryClientFakeBookmarks::AddBookmark(const GURL& url) {
+ AddBookmarkWithTitle(url, base::string16());
+}
+
+void HistoryClientFakeBookmarks::AddBookmarkWithTitle(
+ const GURL& url,
+ const base::string16& title) {
+ bookmarks_.insert(std::make_pair(url, title));
+}
+
+void HistoryClientFakeBookmarks::DelBookmark(const GURL& url) {
+ bookmarks_.erase(url);
+}
+
+bool HistoryClientFakeBookmarks::IsBookmarked(const GURL& url) {
+ return bookmarks_.find(url) != bookmarks_.end();
+}
+
+void HistoryClientFakeBookmarks::GetBookmarks(
+ std::vector<URLAndTitle>* bookmarks) {
+ bookmarks->reserve(bookmarks->size() + bookmarks_.size());
+ typedef std::map<GURL, base::string16>::const_iterator iterator;
+ for (iterator i = bookmarks_.begin(); i != bookmarks_.end(); ++i) {
+ URLAndTitle urlAndTitle = {i->first, i->second};
+ bookmarks->push_back(urlAndTitle);
+ }
+}
+
+} // namespace history
« no previous file with comments | « components/history/core/test/history_client_fake_bookmarks.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698