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

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

Issue 6651014: Applied the IconType. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 GURL url4("javascript:alert(\"Hello!\");"); 189 GURL url4("javascript:alert(\"Hello!\");");
190 base::Time t1(base::Time::Now()); 190 base::Time t1(base::Time::Now());
191 base::Time t2(t1 + base::TimeDelta::FromHours(1)); 191 base::Time t2(t1 + base::TimeDelta::FromHours(1));
192 base::Time t3(t1 + base::TimeDelta::FromHours(1)); 192 base::Time t3(t1 + base::TimeDelta::FromHours(1));
193 base::Time t4(t1 + base::TimeDelta::FromHours(1)); 193 base::Time t4(t1 + base::TimeDelta::FromHours(1));
194 const BookmarkNode* f1 = model->AddGroup( 194 const BookmarkNode* f1 = model->AddGroup(
195 model->GetBookmarkBarNode(), 0, f1_title); 195 model->GetBookmarkBarNode(), 0, f1_title);
196 model->AddURLWithCreationTime(f1, 0, url1_title, url1, t1); 196 model->AddURLWithCreationTime(f1, 0, url1_title, url1, t1);
197 profile.GetHistoryService(Profile::EXPLICIT_ACCESS)->AddPage(url1, 197 profile.GetHistoryService(Profile::EXPLICIT_ACCESS)->AddPage(url1,
198 history::SOURCE_BROWSED); 198 history::SOURCE_BROWSED);
199 profile.GetFaviconService(Profile::EXPLICIT_ACCESS)->SetFavicon(url1, 199 profile.GetFaviconService(Profile::EXPLICIT_ACCESS)->SetFavicon(
200 url1_favicon, 200 url1,
201 icon_data); 201 url1_favicon,
202 icon_data,
203 history::FAV_ICON);
202 message_loop.RunAllPending(); 204 message_loop.RunAllPending();
203 const BookmarkNode* f2 = model->AddGroup(f1, 1, f2_title); 205 const BookmarkNode* f2 = model->AddGroup(f1, 1, f2_title);
204 model->AddURLWithCreationTime(f2, 0, url2_title, url2, t2); 206 model->AddURLWithCreationTime(f2, 0, url2_title, url2, t2);
205 model->AddURLWithCreationTime(model->GetBookmarkBarNode(), 207 model->AddURLWithCreationTime(model->GetBookmarkBarNode(),
206 1, url3_title, url3, t3); 208 1, url3_title, url3, t3);
207 209
208 model->AddURLWithCreationTime(model->other_node(), 0, url1_title, url1, t1); 210 model->AddURLWithCreationTime(model->other_node(), 0, url1_title, url1, t1);
209 model->AddURLWithCreationTime(model->other_node(), 1, url2_title, url2, t2); 211 model->AddURLWithCreationTime(model->other_node(), 1, url2_title, url2, t2);
210 const BookmarkNode* f3 = model->AddGroup(model->other_node(), 2, f3_title); 212 const BookmarkNode* f3 = model->AddGroup(model->other_node(), 2, f3_title);
211 const BookmarkNode* f4 = model->AddGroup(f3, 0, f4_title); 213 const BookmarkNode* f4 = model->AddGroup(f3, 0, f4_title);
212 model->AddURLWithCreationTime(f4, 0, url1_title, url1, t1); 214 model->AddURLWithCreationTime(f4, 0, url1_title, url1, t1);
213 model->AddURLWithCreationTime(model->GetBookmarkBarNode(), 2, url4_title, 215 model->AddURLWithCreationTime(model->GetBookmarkBarNode(), 2, url4_title,
214 url4, t4); 216 url4, t4);
215 217
216 // Write to a temp file. 218 // Write to a temp file.
217 BookmarksObserver observer(&message_loop); 219 BookmarksObserver observer(&message_loop);
218 bookmark_html_writer::WriteBookmarks(&profile, path_, &observer); 220 bookmark_html_writer::WriteBookmarks(&profile, path_, &observer);
219 message_loop.Run(); 221 message_loop.Run();
220 222
221 // Clear favicon so that it would be read from file. 223 // Clear favicon so that it would be read from file.
222 std::vector<unsigned char> empty_data; 224 std::vector<unsigned char> empty_data;
223 profile.GetFaviconService(Profile::EXPLICIT_ACCESS)->SetFavicon(url1, 225 profile.GetFaviconService(Profile::EXPLICIT_ACCESS)->SetFavicon(
224 url1_favicon, 226 url1,
225 empty_data); 227 url1_favicon,
228 empty_data,
229 history::FAV_ICON);
226 message_loop.RunAllPending(); 230 message_loop.RunAllPending();
227 231
228 // Read the bookmarks back in. 232 // Read the bookmarks back in.
229 std::vector<ProfileWriter::BookmarkEntry> parsed_bookmarks; 233 std::vector<ProfileWriter::BookmarkEntry> parsed_bookmarks;
230 std::vector<history::ImportedFavIconUsage> favicons; 234 std::vector<history::ImportedFavIconUsage> favicons;
231 Firefox2Importer::ImportBookmarksFile(path_, std::set<GURL>(), 235 Firefox2Importer::ImportBookmarksFile(path_, std::set<GURL>(),
232 false, L"x", NULL, &parsed_bookmarks, 236 false, L"x", NULL, &parsed_bookmarks,
233 NULL, &favicons); 237 NULL, &favicons);
234 238
235 // Check loaded favicon (url1 is represents by 3 separate bookmarks). 239 // Check loaded favicon (url1 is represents by 3 separate bookmarks).
(...skipping 21 matching lines...) Expand all
257 bookmark_folder_name, string16(), string16()); 261 bookmark_folder_name, string16(), string16());
258 AssertBookmarkEntryEquals(parsed_bookmarks[3], false, url4, url4_title, t4, 262 AssertBookmarkEntryEquals(parsed_bookmarks[3], false, url4, url4_title, t4,
259 bookmark_folder_name, string16(), string16()); 263 bookmark_folder_name, string16(), string16());
260 AssertBookmarkEntryEquals(parsed_bookmarks[4], false, url1, url1_title, t1, 264 AssertBookmarkEntryEquals(parsed_bookmarks[4], false, url1, url1_title, t1,
261 string16(), string16(), string16()); 265 string16(), string16(), string16());
262 AssertBookmarkEntryEquals(parsed_bookmarks[5], false, url2, url2_title, t2, 266 AssertBookmarkEntryEquals(parsed_bookmarks[5], false, url2, url2_title, t2,
263 string16(), string16(), string16()); 267 string16(), string16(), string16());
264 AssertBookmarkEntryEquals(parsed_bookmarks[6], false, url1, url1_title, t1, 268 AssertBookmarkEntryEquals(parsed_bookmarks[6], false, url1, url1_title, t1,
265 f3_title, f4_title, string16()); 269 f3_title, f4_title, string16());
266 } 270 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698