OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // F2 | 162 // F2 |
163 // url2 | 163 // url2 |
164 // url3 | 164 // url3 |
165 // url4 | 165 // url4 |
166 // Other | 166 // Other |
167 // url1 | 167 // url1 |
168 // url2 | 168 // url2 |
169 // F3 | 169 // F3 |
170 // F4 | 170 // F4 |
171 // url1 | 171 // url1 |
172 // Synced | 172 // Mobile |
173 // url1 | 173 // url1 |
174 string16 f1_title = ASCIIToUTF16("F\"&;<1\""); | 174 string16 f1_title = ASCIIToUTF16("F\"&;<1\""); |
175 string16 f2_title = ASCIIToUTF16("F2"); | 175 string16 f2_title = ASCIIToUTF16("F2"); |
176 string16 f3_title = ASCIIToUTF16("F 3"); | 176 string16 f3_title = ASCIIToUTF16("F 3"); |
177 string16 f4_title = ASCIIToUTF16("F4"); | 177 string16 f4_title = ASCIIToUTF16("F4"); |
178 string16 url1_title = ASCIIToUTF16("url 1"); | 178 string16 url1_title = ASCIIToUTF16("url 1"); |
179 string16 url2_title = ASCIIToUTF16("url&2"); | 179 string16 url2_title = ASCIIToUTF16("url&2"); |
180 string16 url3_title = ASCIIToUTF16("url\"3"); | 180 string16 url3_title = ASCIIToUTF16("url\"3"); |
181 string16 url4_title = ASCIIToUTF16("url\"&;"); | 181 string16 url4_title = ASCIIToUTF16("url\"&;"); |
182 GURL url1("http://url1"); | 182 GURL url1("http://url1"); |
(...skipping 18 matching lines...) Expand all Loading... |
201 model->AddURLWithCreationTime(model->bookmark_bar_node(), | 201 model->AddURLWithCreationTime(model->bookmark_bar_node(), |
202 1, url3_title, url3, t3); | 202 1, url3_title, url3, t3); |
203 | 203 |
204 model->AddURLWithCreationTime(model->other_node(), 0, url1_title, url1, t1); | 204 model->AddURLWithCreationTime(model->other_node(), 0, url1_title, url1, t1); |
205 model->AddURLWithCreationTime(model->other_node(), 1, url2_title, url2, t2); | 205 model->AddURLWithCreationTime(model->other_node(), 1, url2_title, url2, t2); |
206 const BookmarkNode* f3 = model->AddFolder(model->other_node(), 2, f3_title); | 206 const BookmarkNode* f3 = model->AddFolder(model->other_node(), 2, f3_title); |
207 const BookmarkNode* f4 = model->AddFolder(f3, 0, f4_title); | 207 const BookmarkNode* f4 = model->AddFolder(f3, 0, f4_title); |
208 model->AddURLWithCreationTime(f4, 0, url1_title, url1, t1); | 208 model->AddURLWithCreationTime(f4, 0, url1_title, url1, t1); |
209 model->AddURLWithCreationTime(model->bookmark_bar_node(), 2, url4_title, | 209 model->AddURLWithCreationTime(model->bookmark_bar_node(), 2, url4_title, |
210 url4, t4); | 210 url4, t4); |
211 model->AddURLWithCreationTime(model->synced_node(), 0, url1_title, url1, t1); | 211 model->AddURLWithCreationTime(model->mobile_node(), 0, url1_title, url1, t1); |
212 | 212 |
213 // Write to a temp file. | 213 // Write to a temp file. |
214 BookmarksObserver observer(&message_loop); | 214 BookmarksObserver observer(&message_loop); |
215 bookmark_html_writer::WriteBookmarks(&profile, path_, &observer); | 215 bookmark_html_writer::WriteBookmarks(&profile, path_, &observer); |
216 message_loop.Run(); | 216 message_loop.Run(); |
217 | 217 |
218 // Clear favicon so that it would be read from file. | 218 // Clear favicon so that it would be read from file. |
219 std::vector<unsigned char> empty_data; | 219 std::vector<unsigned char> empty_data; |
220 profile.GetFaviconService(Profile::EXPLICIT_ACCESS)->SetFavicon(url1, | 220 profile.GetFaviconService(Profile::EXPLICIT_ACCESS)->SetFavicon(url1, |
221 url1_favicon, empty_data, history::FAVICON); | 221 url1_favicon, empty_data, history::FAVICON); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 bookmark_folder_name, string16(), string16()); | 258 bookmark_folder_name, string16(), string16()); |
259 AssertBookmarkEntryEquals(parsed_bookmarks[4], false, url1, url1_title, t1, | 259 AssertBookmarkEntryEquals(parsed_bookmarks[4], false, url1, url1_title, t1, |
260 string16(), string16(), string16()); | 260 string16(), string16(), string16()); |
261 AssertBookmarkEntryEquals(parsed_bookmarks[5], false, url2, url2_title, t2, | 261 AssertBookmarkEntryEquals(parsed_bookmarks[5], false, url2, url2_title, t2, |
262 string16(), string16(), string16()); | 262 string16(), string16(), string16()); |
263 AssertBookmarkEntryEquals(parsed_bookmarks[6], false, url1, url1_title, t1, | 263 AssertBookmarkEntryEquals(parsed_bookmarks[6], false, url1, url1_title, t1, |
264 f3_title, f4_title, string16()); | 264 f3_title, f4_title, string16()); |
265 AssertBookmarkEntryEquals(parsed_bookmarks[7], false, url1, url1_title, t1, | 265 AssertBookmarkEntryEquals(parsed_bookmarks[7], false, url1, url1_title, t1, |
266 string16(), string16(), string16()); | 266 string16(), string16(), string16()); |
267 } | 267 } |
OLD | NEW |