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

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

Issue 839193002: Move ServiceAccessType into //components/keyed_service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on android Created 5 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_html_writer.h" 5 #include "chrome/browser/bookmarks/bookmark_html_writer.h"
6 6
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/i18n/time_formatting.h" 8 #include "base/i18n/time_formatting.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 GURL url3("http://url3"); 189 GURL url3("http://url3");
190 GURL url4("javascript:alert(\"Hello!\");"); 190 GURL url4("javascript:alert(\"Hello!\");");
191 GURL unnamed_bookmark_url("about:blank"); 191 GURL unnamed_bookmark_url("about:blank");
192 base::Time t1(base::Time::Now()); 192 base::Time t1(base::Time::Now());
193 base::Time t2(t1 + base::TimeDelta::FromHours(1)); 193 base::Time t2(t1 + base::TimeDelta::FromHours(1));
194 base::Time t3(t1 + base::TimeDelta::FromHours(1)); 194 base::Time t3(t1 + base::TimeDelta::FromHours(1));
195 base::Time t4(t1 + base::TimeDelta::FromHours(1)); 195 base::Time t4(t1 + base::TimeDelta::FromHours(1));
196 const BookmarkNode* f1 = model->AddFolder( 196 const BookmarkNode* f1 = model->AddFolder(
197 model->bookmark_bar_node(), 0, f1_title); 197 model->bookmark_bar_node(), 0, f1_title);
198 model->AddURLWithCreationTimeAndMetaInfo(f1, 0, url1_title, url1, t1, NULL); 198 model->AddURLWithCreationTimeAndMetaInfo(f1, 0, url1_title, url1, t1, NULL);
199 HistoryServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS)-> 199 HistoryServiceFactory::GetForProfile(&profile,
200 AddPage(url1, base::Time::Now(), history::SOURCE_BROWSED); 200 ServiceAccessType::EXPLICIT_ACCESS)
201 FaviconServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS) 201 ->AddPage(url1, base::Time::Now(), history::SOURCE_BROWSED);
202 ->SetFavicons(url1, 202 FaviconServiceFactory::GetForProfile(&profile,
203 url1_favicon, 203 ServiceAccessType::EXPLICIT_ACCESS)
204 favicon_base::FAVICON, 204 ->SetFavicons(url1, url1_favicon, favicon_base::FAVICON,
205 gfx::Image::CreateFrom1xBitmap(bitmap)); 205 gfx::Image::CreateFrom1xBitmap(bitmap));
206 const BookmarkNode* f2 = model->AddFolder(f1, 1, f2_title); 206 const BookmarkNode* f2 = model->AddFolder(f1, 1, f2_title);
207 model->AddURLWithCreationTimeAndMetaInfo(f2, 0, url2_title, url2, t2, NULL); 207 model->AddURLWithCreationTimeAndMetaInfo(f2, 0, url2_title, url2, t2, NULL);
208 model->AddURLWithCreationTimeAndMetaInfo( 208 model->AddURLWithCreationTimeAndMetaInfo(
209 model->bookmark_bar_node(), 1, url3_title, url3, t3, NULL); 209 model->bookmark_bar_node(), 1, url3_title, url3, t3, NULL);
210 210
211 model->AddURLWithCreationTimeAndMetaInfo( 211 model->AddURLWithCreationTimeAndMetaInfo(
212 model->other_node(), 0, url1_title, url1, t1, NULL); 212 model->other_node(), 0, url1_title, url1, t1, NULL);
213 model->AddURLWithCreationTimeAndMetaInfo( 213 model->AddURLWithCreationTimeAndMetaInfo(
214 model->other_node(), 1, url2_title, url2, t2, NULL); 214 model->other_node(), 1, url2_title, url2, t2, NULL);
(...skipping 12 matching lines...) Expand all
227 NULL); 227 NULL);
228 228
229 base::RunLoop run_loop; 229 base::RunLoop run_loop;
230 230
231 // Write to a temp file. 231 // Write to a temp file.
232 BookmarksObserver observer(&run_loop); 232 BookmarksObserver observer(&run_loop);
233 bookmark_html_writer::WriteBookmarks(&profile, path_, &observer); 233 bookmark_html_writer::WriteBookmarks(&profile, path_, &observer);
234 run_loop.Run(); 234 run_loop.Run();
235 235
236 // Clear favicon so that it would be read from file. 236 // Clear favicon so that it would be read from file.
237 FaviconServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS) 237 FaviconServiceFactory::GetForProfile(&profile,
238 ServiceAccessType::EXPLICIT_ACCESS)
238 ->SetFavicons(url1, url1_favicon, favicon_base::FAVICON, gfx::Image()); 239 ->SetFavicons(url1, url1_favicon, favicon_base::FAVICON, gfx::Image());
239 240
240 // Read the bookmarks back in. 241 // Read the bookmarks back in.
241 std::vector<ImportedBookmarkEntry> parsed_bookmarks; 242 std::vector<ImportedBookmarkEntry> parsed_bookmarks;
242 std::vector<ImportedFaviconUsage> favicons; 243 std::vector<ImportedFaviconUsage> favicons;
243 bookmark_html_reader::ImportBookmarksFile(base::Callback<bool(void)>(), 244 bookmark_html_reader::ImportBookmarksFile(base::Callback<bool(void)>(),
244 base::Callback<bool(const GURL&)>(), 245 base::Callback<bool(const GURL&)>(),
245 path_, 246 path_,
246 &parsed_bookmarks, 247 &parsed_bookmarks,
247 &favicons); 248 &favicons);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 AssertBookmarkEntryEquals(parsed_bookmarks[6], false, url1, url1_title, t1, 283 AssertBookmarkEntryEquals(parsed_bookmarks[6], false, url1, url1_title, t1,
283 f3_title, f4_title, base::string16()); 284 f3_title, f4_title, base::string16());
284 AssertBookmarkEntryEquals(parsed_bookmarks[7], false, url1, url1_title, t1, 285 AssertBookmarkEntryEquals(parsed_bookmarks[7], false, url1, url1_title, t1,
285 base::string16(), base::string16(), 286 base::string16(), base::string16(),
286 base::string16()); 287 base::string16());
287 AssertBookmarkEntryEquals(parsed_bookmarks[8], false, unnamed_bookmark_url, 288 AssertBookmarkEntryEquals(parsed_bookmarks[8], false, unnamed_bookmark_url,
288 unnamed_bookmark_title, t2, 289 unnamed_bookmark_title, t2,
289 base::string16(), base::string16(), 290 base::string16(), base::string16(),
290 base::string16()); 291 base::string16());
291 } 292 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_html_writer.cc ('k') | chrome/browser/bookmarks/chrome_bookmark_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698