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

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: sync 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(url1,
200 url1_favicon, 200 url1_favicon, icon_data, history::FAVICON);
201 icon_data);
202 message_loop.RunAllPending(); 201 message_loop.RunAllPending();
203 const BookmarkNode* f2 = model->AddGroup(f1, 1, f2_title); 202 const BookmarkNode* f2 = model->AddGroup(f1, 1, f2_title);
204 model->AddURLWithCreationTime(f2, 0, url2_title, url2, t2); 203 model->AddURLWithCreationTime(f2, 0, url2_title, url2, t2);
205 model->AddURLWithCreationTime(model->GetBookmarkBarNode(), 204 model->AddURLWithCreationTime(model->GetBookmarkBarNode(),
206 1, url3_title, url3, t3); 205 1, url3_title, url3, t3);
207 206
208 model->AddURLWithCreationTime(model->other_node(), 0, url1_title, url1, t1); 207 model->AddURLWithCreationTime(model->other_node(), 0, url1_title, url1, t1);
209 model->AddURLWithCreationTime(model->other_node(), 1, url2_title, url2, t2); 208 model->AddURLWithCreationTime(model->other_node(), 1, url2_title, url2, t2);
210 const BookmarkNode* f3 = model->AddGroup(model->other_node(), 2, f3_title); 209 const BookmarkNode* f3 = model->AddGroup(model->other_node(), 2, f3_title);
211 const BookmarkNode* f4 = model->AddGroup(f3, 0, f4_title); 210 const BookmarkNode* f4 = model->AddGroup(f3, 0, f4_title);
212 model->AddURLWithCreationTime(f4, 0, url1_title, url1, t1); 211 model->AddURLWithCreationTime(f4, 0, url1_title, url1, t1);
213 model->AddURLWithCreationTime(model->GetBookmarkBarNode(), 2, url4_title, 212 model->AddURLWithCreationTime(model->GetBookmarkBarNode(), 2, url4_title,
214 url4, t4); 213 url4, t4);
215 214
216 // Write to a temp file. 215 // Write to a temp file.
217 BookmarksObserver observer(&message_loop); 216 BookmarksObserver observer(&message_loop);
218 bookmark_html_writer::WriteBookmarks(&profile, path_, &observer); 217 bookmark_html_writer::WriteBookmarks(&profile, path_, &observer);
219 message_loop.Run(); 218 message_loop.Run();
220 219
221 // Clear favicon so that it would be read from file. 220 // Clear favicon so that it would be read from file.
222 std::vector<unsigned char> empty_data; 221 std::vector<unsigned char> empty_data;
223 profile.GetFaviconService(Profile::EXPLICIT_ACCESS)->SetFavicon(url1, 222 profile.GetFaviconService(Profile::EXPLICIT_ACCESS)->SetFavicon(url1,
224 url1_favicon, 223 url1_favicon, empty_data, history::FAVICON);
225 empty_data);
226 message_loop.RunAllPending(); 224 message_loop.RunAllPending();
227 225
228 // Read the bookmarks back in. 226 // Read the bookmarks back in.
229 std::vector<ProfileWriter::BookmarkEntry> parsed_bookmarks; 227 std::vector<ProfileWriter::BookmarkEntry> parsed_bookmarks;
230 std::vector<history::ImportedFaviconUsage> favicons; 228 std::vector<history::ImportedFaviconUsage> favicons;
231 Firefox2Importer::ImportBookmarksFile(path_, std::set<GURL>(), 229 Firefox2Importer::ImportBookmarksFile(path_, std::set<GURL>(),
232 false, L"x", NULL, &parsed_bookmarks, 230 false, L"x", NULL, &parsed_bookmarks,
233 NULL, &favicons); 231 NULL, &favicons);
234 232
235 // Check loaded favicon (url1 is represents by 3 separate bookmarks). 233 // Check loaded favicon (url1 is represents by 3 separate bookmarks).
(...skipping 21 matching lines...) Expand all
257 bookmark_folder_name, string16(), string16()); 255 bookmark_folder_name, string16(), string16());
258 AssertBookmarkEntryEquals(parsed_bookmarks[3], false, url4, url4_title, t4, 256 AssertBookmarkEntryEquals(parsed_bookmarks[3], false, url4, url4_title, t4,
259 bookmark_folder_name, string16(), string16()); 257 bookmark_folder_name, string16(), string16());
260 AssertBookmarkEntryEquals(parsed_bookmarks[4], false, url1, url1_title, t1, 258 AssertBookmarkEntryEquals(parsed_bookmarks[4], false, url1, url1_title, t1,
261 string16(), string16(), string16()); 259 string16(), string16(), string16());
262 AssertBookmarkEntryEquals(parsed_bookmarks[5], false, url2, url2_title, t2, 260 AssertBookmarkEntryEquals(parsed_bookmarks[5], false, url2, url2_title, t2,
263 string16(), string16(), string16()); 261 string16(), string16(), string16());
264 AssertBookmarkEntryEquals(parsed_bookmarks[6], false, url1, url1_title, t1, 262 AssertBookmarkEntryEquals(parsed_bookmarks[6], false, url1, url1_title, t1,
265 f3_title, f4_title, string16()); 263 f3_title, f4_title, string16());
266 } 264 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698