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

Side by Side Diff: chrome/browser/bookmarks/bookmark_test_helpers.cc

Issue 242693003: Introduce BookmarkClient interface to abstract embedder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" 5 #include "chrome/browser/bookmarks/bookmark_test_helpers.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 break; 90 break;
91 } 91 }
92 } 92 }
93 return end_pos; 93 return end_pos;
94 } 94 }
95 95
96 } // namespace 96 } // namespace
97 97
98 namespace test { 98 namespace test {
99 99
100 BookmarkModel* TestBookmarkClient::CreateModel() {
101 scoped_ptr<BookmarkModel> bookmark_model(new BookmarkModel(this));
tfarina 2014/04/22 21:19:58 I don't think using scoped_ptr + release here help
sdefresne 2014/04/23 16:10:18 Done.
102 bookmark_model->DoneLoading(bookmark_model->CreateLoadDetails());
103 return bookmark_model.release();
104 }
105
106 base::CancelableTaskTracker::TaskId TestBookmarkClient::GetFaviconImageForURL(
107 const GURL& page_url,
108 int icon_types,
109 int desired_size_in_dip,
110 const FaviconImageCallback& callback,
111 base::CancelableTaskTracker* tracker) {
112 return base::CancelableTaskTracker::kBadTaskId;
113 }
114
115 bool TestBookmarkClient::SupportsTypedCountForNodes() {
116 return false;
117 }
118
119 void TestBookmarkClient::GetTypedCountForNodes(
120 const NodeSet& nodes,
121 NodeTypedCountPairs* node_typed_count_pairs) {
122 NOTREACHED();
123 }
124
125 void TestBookmarkClient::RecordAction(const base::UserMetricsAction& action) {
126 }
127
128 void TestBookmarkClient::OnLoad() {
129 }
130
131 void TestBookmarkClient::OnClearStore() {
132 }
133
134 void TestBookmarkClient::NotifyHistoryAboutRemovedBookmarks(
135 const std::set<GURL>& removed_bookmark_urls) {
136 }
137
100 void WaitForBookmarkModelToLoad(BookmarkModel* model) { 138 void WaitForBookmarkModelToLoad(BookmarkModel* model) {
101 if (model->loaded()) 139 if (model->loaded())
102 return; 140 return;
103 base::RunLoop run_loop; 141 base::RunLoop run_loop;
104 BookmarkLoadObserver observer(content::GetQuitTaskForRunLoop(&run_loop)); 142 BookmarkLoadObserver observer(content::GetQuitTaskForRunLoop(&run_loop));
105 model->AddObserver(&observer); 143 model->AddObserver(&observer);
106 content::RunThisRunLoop(&run_loop); 144 content::RunThisRunLoop(&run_loop);
107 model->RemoveObserver(&observer); 145 model->RemoveObserver(&observer);
108 DCHECK(model->loaded()); 146 DCHECK(model->loaded());
109 } 147 }
(...skipping 23 matching lines...) Expand all
133 const BookmarkNode* node, 171 const BookmarkNode* node,
134 const std::string& model_string) { 172 const std::string& model_string) {
135 DCHECK(node); 173 DCHECK(node);
136 std::string::size_type start_pos = 0; 174 std::string::size_type start_pos = 0;
137 std::string::size_type end_pos = 175 std::string::size_type end_pos =
138 AddNodesFromString(model, node, model_string, start_pos); 176 AddNodesFromString(model, node, model_string, start_pos);
139 DCHECK(end_pos == std::string::npos); 177 DCHECK(end_pos == std::string::npos);
140 } 178 }
141 179
142 } // namespace test 180 } // namespace test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698