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 |