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

Side by Side Diff: chrome/browser/importer/toolbar_importer_unittest.cc

Issue 18120005: Remove Google Toolbar importer (aka google.com/bookmarks importer). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: -explicit Created 7 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "testing/gtest/include/gtest/gtest.h"
6
7 #include <string>
8 #include <vector>
9
10 #include "base/strings/string16.h"
11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/bookmarks/imported_bookmark_entry.h"
14 #include "chrome/browser/first_run/first_run.h"
15 #include "chrome/browser/first_run/first_run_internal.h"
16 #include "chrome/browser/importer/toolbar_importer.h"
17 #include "googleurl/src/gurl.h"
18 #include "third_party/libxml/chromium/libxml_utils.h"
19
20 // See http://crbug.com/11838
21 TEST(Toolbar5ImporterTest, BookmarkParse) {
22 static const string16 kTitle = ASCIIToUTF16("MyTitle");
23 static const char kUrl[] = "http://www.google.com/";
24 static const string16 kFolder = ASCIIToUTF16("Google");
25 static const string16 kFolder2 = ASCIIToUTF16("Homepage");
26 static const string16 kFolderArray[3] = {
27 ASCIIToUTF16("Google"),
28 ASCIIToUTF16("Search"),
29 ASCIIToUTF16("Page")
30 };
31 static const string16 kOtherTitle = ASCIIToUTF16("MyOtherTitle");
32 static const char* kOtherUrl = "http://www.google.com/mail";
33 static const string16 kOtherFolder = ASCIIToUTF16("Mail");
34
35 static const string16 kBookmarkGroupTitle = ASCIIToUTF16("BookmarkGroupTitle");
36
37 // Since the following is very dense to read I enumerate the test cases here.
38 // 1. Correct bookmark structure with one label.
39 // 2. Correct bookmark structure with no labels.
40 // 3. Correct bookmark structure with two labels.
41 // 4. Correct bookmark structure with a folder->label translation by toolbar.
42 // 5. Correct bookmark structure with no favicon.
43 // 6. Two correct bookmarks.
44 // The following are error cases by removing sections from the xml:
45 // 7. Empty string passed as xml.
46 // 8. No <bookmarks> section in the xml.
47 // 9. No <bookmark> section below the <bookmarks> section.
48 // 10. No <title> in a <bookmark> section.
49 // 11. No <url> in a <bookmark> section.
50 // 12. No <timestamp> in a <bookmark> section.
51 // 13. No <labels> in a <bookmark> section.
52 static const char* kGoodBookmark =
53 "<?xml version=\"1.0\" ?> <xml_api_reply version=\"1\"> <bookmarks>"
54 " <bookmark> "
55 "<title>MyTitle</title> "
56 "<url>http://www.google.com/</url> "
57 "<timestamp>1153328691085181</timestamp> "
58 "<id>N123nasdf239</id> <notebook_id>Bxxxxxxx</notebook_id> "
59 "<section_id>Sxxxxxx</section_id> <has_highlight>0</has_highlight>"
60 "<labels> <label>Google</label> </labels> "
61 "<attributes> "
62 "<attribute> "
63 "<name>favicon_url</name> <value>http://www.google.com/favicon.ico</value> "
64 "</attribute> "
65 "<attribute> "
66 "<name>favicon_timestamp</name> <value>1153328653</value> "
67 "</attribute> "
68 "<attribute> <name>notebook_name</name> <value>My notebook 0</value> "
69 "</attribute> "
70 "<attribute> <name>section_name</name> <value>My section 0 "
71 "</value> </attribute> </attributes> "
72 "</bookmark> </bookmarks>";
73 static const char* kGoodBookmarkNoLabel =
74 "<?xml version=\"1.0\" ?> <xml_api_reply version=\"1\"> <bookmarks>"
75 " <bookmark> "
76 "<title>MyTitle</title> "
77 "<url>http://www.google.com/</url> "
78 "<timestamp>1153328691085181</timestamp> "
79 "<id>N123nasdf239</id> <notebook_id>Bxxxxxxx</notebook_id> "
80 "<section_id>Sxxxxxx</section_id> <has_highlight>0</has_highlight>"
81 "<labels> </labels> "
82 "<attributes> "
83 "<attribute> "
84 "<name>favicon_url</name> <value>http://www.google.com/favicon.ico</value> "
85 "</attribute> "
86 "<attribute> "
87 "<name>favicon_timestamp</name> <value>1153328653</value> "
88 "</attribute> "
89 "<attribute> <name>notebook_name</name> <value>My notebook 0</value> "
90 "</attribute> "
91 "<attribute> <name>section_name</name> <value>My section 0 "
92 "</value> </attribute> </attributes> "
93 "</bookmark> </bookmarks>";
94 static const char* kGoodBookmarkTwoLabels =
95 "<?xml version=\"1.0\" ?> <xml_api_reply version=\"1\"> <bookmarks>"
96 " <bookmark> "
97 "<title>MyTitle</title> "
98 "<url>http://www.google.com/</url> "
99 "<timestamp>1153328691085181</timestamp> "
100 "<id>N123nasdf239</id> <notebook_id>Bxxxxxxx</notebook_id> "
101 "<section_id>Sxxxxxx</section_id> <has_highlight>0</has_highlight>"
102 "<labels> <label>Google</label> <label>Homepage</label> </labels> "
103 "<attributes> "
104 "<attribute> "
105 "<name>favicon_url</name> <value>http://www.google.com/favicon.ico</value> "
106 "</attribute> "
107 "<attribute> "
108 "<name>favicon_timestamp</name> <value>1153328653</value> "
109 "</attribute> "
110 "<attribute> <name>notebook_name</name> <value>My notebook 0</value> "
111 "</attribute> "
112 "<attribute> <name>section_name</name> <value>My section 0 "
113 "</value> </attribute> </attributes> "
114 "</bookmark> </bookmarks>";
115 static const char* kGoodBookmarkFolderLabel =
116 "<?xml version=\"1.0\" ?> <xml_api_reply version=\"1\"> <bookmarks>"
117 " <bookmark> "
118 "<title>MyTitle</title> "
119 "<url>http://www.google.com/</url> "
120 "<timestamp>1153328691085181</timestamp> "
121 "<id>N123nasdf239</id> <notebook_id>Bxxxxxxx</notebook_id> "
122 "<section_id>Sxxxxxx</section_id> <has_highlight>0</has_highlight>"
123 "<labels> <label>Google:Search:Page</label> </labels> "
124 "<attributes> "
125 "<attribute> "
126 "<name>favicon_url</name> <value>http://www.google.com/favicon.ico</value> "
127 "</attribute> "
128 "<attribute> "
129 "<name>favicon_timestamp</name> <value>1153328653</value> "
130 "</attribute> "
131 "<attribute> <name>notebook_name</name> <value>My notebook 0</value> "
132 "</attribute> "
133 "<attribute> <name>section_name</name> <value>My section 0 "
134 "</value> </attribute> </attributes> "
135 "</bookmark> </bookmarks>";
136 static const char* kGoodBookmarkNoFavicon =
137 "<?xml version=\"1.0\" ?> <xml_api_reply version=\"1\"> <bookmarks>"
138 " <bookmark> "
139 "<title>MyTitle</title> "
140 "<url>http://www.google.com/</url> "
141 "<timestamp>1153328691085181</timestamp> "
142 "<id>N123nasdf239</id> <notebook_id>Bxxxxxxx</notebook_id> "
143 "<section_id>Sxxxxxx</section_id> <has_highlight>0</has_highlight>"
144 "<labels> <label>Google</label> </labels> "
145 "<attributes> "
146 "<attribute> "
147 "<name>favicon_timestamp</name> <value>1153328653</value> "
148 "</attribute> "
149 "<attribute> <name>notebook_name</name> <value>My notebook 0</value> "
150 "</attribute> "
151 "<attribute> <name>section_name</name> <value>My section 0 "
152 "</value> </attribute> </attributes> "
153 "</bookmark> </bookmarks>";
154 static const char* kGoodBookmark2Items =
155 "<?xml version=\"1.0\" ?> <xml_api_reply version=\"1\"> <bookmarks>"
156 " <bookmark> "
157 "<title>MyTitle</title> "
158 "<url>http://www.google.com/</url> "
159 "<timestamp>1153328691085181</timestamp> "
160 "<id>N123nasdf239</id> <notebook_id>Bxxxxxxx</notebook_id> "
161 "<section_id>Sxxxxxx</section_id> <has_highlight>0</has_highlight>"
162 "<labels> <label>Google</label> </labels> "
163 "<attributes> "
164 "<attribute> "
165 "<name>favicon_url</name> <value>http://www.google.com/favicon.ico</value> "
166 "</attribute> "
167 "<attribute> "
168 "<name>favicon_timestamp</name> <value>1153328653</value> "
169 "</attribute> "
170 "<attribute> <name>notebook_name</name> <value>My notebook 0</value> "
171 "</attribute> "
172 "<attribute> <name>section_name</name> <value>My section 0 "
173 "</value> </attribute> </attributes> "
174 "</bookmark>"
175 " <bookmark> "
176 "<title>MyOtherTitle</title> "
177 "<url>http://www.google.com/mail</url> "
178 "<timestamp>1153328691085181</timestamp> "
179 "<id>N123nasdf239</id> <notebook_id>Bxxxxxxx</notebook_id> "
180 "<section_id>Sxxxxxx</section_id> <has_highlight>0</has_highlight>"
181 "<labels> <label>Mail</label> </labels> "
182 "<attributes> "
183 "<attribute> "
184 "<name>favicon_url</name>"
185 "<value>http://www.google.com/mail/favicon.ico</value> "
186 "</attribute> "
187 "<attribute> "
188 "<name>favicon_timestamp</name> <value>1253328653</value> "
189 "</attribute> "
190 "<attribute> <name>notebook_name</name> <value>My notebook 0</value> "
191 "</attribute> "
192 "<attribute> <name>section_name</name> <value>My section 0 "
193 "</value> </attribute> </attributes> "
194 "</bookmark>"
195 "</bookmarks>";
196 static const char* kEmptyString = "";
197 static const char* kBadBookmarkNoBookmarks =
198 " <bookmark> "
199 "<title>MyTitle</title> "
200 "<url>http://www.google.com/</url> "
201 "<timestamp>1153328691085181</timestamp> "
202 "<id>N123nasdf239</id> <notebook_id>Bxxxxxxx</notebook_id> "
203 "<section_id>Sxxxxxx</section_id> <has_highlight>0</has_highlight>"
204 "<labels> <label>Google</label> </labels> "
205 "<attributes> "
206 "<attribute> "
207 "<name>favicon_url</name> <value>http://www.google.com/favicon.ico</value> "
208 "</attribute> "
209 "<attribute> "
210 "<name>favicon_timestamp</name> <value>1153328653</value> "
211 "</attribute> "
212 "<attribute> <name>notebook_name</name> <value>My notebook 0</value> "
213 "</attribute> "
214 "<attribute> <name>section_name</name> <value>My section 0 "
215 "</value> </attribute> </attributes> "
216 "</bookmark> </bookmarks>";
217 static const char* kBadBookmarkNoBookmark =
218 "<?xml version=\"1.0\" ?> <xml_api_reply version=\"1\"> <bookmarks>"
219 "<title>MyTitle</title> "
220 "<url>http://www.google.com/</url> "
221 "<timestamp>1153328691085181</timestamp> "
222 "<id>N123nasdf239</id> <notebook_id>Bxxxxxxx</notebook_id> "
223 "<section_id>Sxxxxxx</section_id> <has_highlight>0</has_highlight>"
224 "<labels> <label>Google</label> </labels> "
225 "<attributes> "
226 "<attribute> "
227 "<name>favicon_url</name> <value>http://www.google.com/favicon.ico</value> "
228 "</attribute> "
229 "<attribute> "
230 "<name>favicon_timestamp</name> <value>1153328653</value> "
231 "</attribute> "
232 "<attribute> <name>notebook_name</name> <value>My notebook 0</value> "
233 "</attribute> "
234 "<attribute> <name>section_name</name> <value>My section 0 "
235 "</value> </attribute> </attributes> "
236 "</bookmark> </bookmarks>";
237 static const char* kBadBookmarkNoTitle =
238 "<?xml version=\"1.0\" ?> <xml_api_reply version=\"1\"> <bookmarks>"
239 " <bookmark> "
240 "<url>http://www.google.com/</url> "
241 "<timestamp>1153328691085181</timestamp> "
242 "<id>N123nasdf239</id> <notebook_id>Bxxxxxxx</notebook_id> "
243 "<section_id>Sxxxxxx</section_id> <has_highlight>0</has_highlight>"
244 "<labels> <label>Google</label> </labels> "
245 "<attributes> "
246 "<attribute> "
247 "<name>favicon_url</name> <value>http://www.google.com/favicon.ico</value> "
248 "</attribute> "
249 "<attribute> "
250 "<name>favicon_timestamp</name> <value>1153328653</value> "
251 "</attribute> "
252 "<attribute> <name>notebook_name</name> <value>My notebook 0</value> "
253 "</attribute> "
254 "<attribute> <name>section_name</name> <value>My section 0 "
255 "</value> </attribute> </attributes> "
256 "</bookmark> </bookmarks>";
257 static const char* kBadBookmarkNoUrl =
258 "<?xml version=\"1.0\" ?> <xml_api_reply version=\"1\"> <bookmarks>"
259 " <bookmark> "
260 "<title>MyTitle</title> "
261 "<timestamp>1153328691085181</timestamp> "
262 "<id>N123nasdf239</id> <notebook_id>Bxxxxxxx</notebook_id> "
263 "<section_id>Sxxxxxx</section_id> <has_highlight>0</has_highlight>"
264 "<labels> <label>Google</label> </labels> "
265 "<attributes> "
266 "<attribute> "
267 "<name>favicon_url</name> <value>http://www.google.com/favicon.ico</value> "
268 "</attribute> "
269 "<attribute> "
270 "<name>favicon_timestamp</name> <value>1153328653</value> "
271 "</attribute> "
272 "<attribute> <name>notebook_name</name> <value>My notebook 0</value> "
273 "</attribute> "
274 "<attribute> <name>section_name</name> <value>My section 0 "
275 "</value> </attribute> </attributes> "
276 "</bookmark> </bookmarks>";
277 static const char* kBadBookmarkNoTimestamp =
278 "<?xml version=\"1.0\" ?> <xml_api_reply version=\"1\"> <bookmarks>"
279 " <bookmark> "
280 "<title>MyTitle</title> "
281 "<url>http://www.google.com/</url> "
282 "<id>N123nasdf239</id> <notebook_id>Bxxxxxxx</notebook_id> "
283 "<section_id>Sxxxxxx</section_id> <has_highlight>0</has_highlight>"
284 "<labels> <label>Google</label> </labels> "
285 "<attributes> "
286 "<attribute> "
287 "<name>favicon_url</name> <value>http://www.google.com/favicon.ico</value> "
288 "</attribute> "
289 "<attribute> "
290 "<name>favicon_timestamp</name> <value>1153328653</value> "
291 "</attribute> "
292 "<attribute> <name>notebook_name</name> <value>My notebook 0</value> "
293 "</attribute> "
294 "<attribute> <name>section_name</name> <value>My section 0 "
295 "</value> </attribute> </attributes> "
296 "</bookmark> </bookmarks>";
297 static const char* kBadBookmarkNoLabels =
298 "<?xml version=\"1.0\" ?> <xml_api_reply version=\"1\"> <bookmarks>"
299 " <bookmark> "
300 "<title>MyTitle</title> "
301 "<url>http://www.google.com/</url> "
302 "<timestamp>1153328691085181</timestamp> "
303 "<id>N123nasdf239</id> <notebook_id>Bxxxxxxx</notebook_id> "
304 "<section_id>Sxxxxxx</section_id> <has_highlight>0</has_highlight>"
305 "<attributes> "
306 "<attribute> "
307 "<name>favicon_url</name> <value>http://www.google.com/favicon.ico</value> "
308 "</attribute> "
309 "<attribute> "
310 "<name>favicon_timestamp</name> <value>1153328653</value> "
311 "</attribute> "
312 "<attribute> <name>notebook_name</name> <value>My notebook 0</value> "
313 "</attribute> "
314 "<attribute> <name>section_name</name> <value>My section 0 "
315 "</value> </attribute> </attributes> "
316 "</bookmark> </bookmarks>";
317
318 XmlReader reader;
319 std::string bookmark_xml;
320 std::vector<ImportedBookmarkEntry> bookmarks;
321
322 const GURL url(kUrl);
323 const GURL other_url(kOtherUrl);
324
325 // Test doesn't work if the importer thinks this is the first run of Chromium.
326 // Mark this as a subsequent run of the browser.
327 first_run::internal::first_run_ = first_run::internal::FIRST_RUN_FALSE;
328
329 // Test case 1 is parsing a basic bookmark with a single label.
330 bookmark_xml = kGoodBookmark;
331 bookmarks.clear();
332 XmlReader reader1;
333 EXPECT_TRUE(reader1.Load(bookmark_xml));
334 EXPECT_TRUE(Toolbar5Importer::ParseBookmarksFromReader(&reader1, &bookmarks,
335 kBookmarkGroupTitle));
336
337 ASSERT_EQ(1U, bookmarks.size());
338 EXPECT_FALSE(bookmarks[0].in_toolbar);
339 EXPECT_EQ(kTitle, bookmarks[0].title);
340 EXPECT_EQ(url, bookmarks[0].url);
341 ASSERT_EQ(2U, bookmarks[0].path.size());
342 EXPECT_EQ(kFolder, bookmarks[0].path[1]);
343
344 // Test case 2 is parsing a single bookmark with no label.
345 bookmark_xml = kGoodBookmarkNoLabel;
346 bookmarks.clear();
347 XmlReader reader2;
348 EXPECT_TRUE(reader2.Load(bookmark_xml));
349 EXPECT_TRUE(Toolbar5Importer::ParseBookmarksFromReader(&reader2, &bookmarks,
350 kBookmarkGroupTitle));
351
352 ASSERT_EQ(1U, bookmarks.size());
353 EXPECT_FALSE(bookmarks[0].in_toolbar);
354 EXPECT_EQ(kTitle, bookmarks[0].title);
355 EXPECT_EQ(url, bookmarks[0].url);
356 EXPECT_EQ(1U, bookmarks[0].path.size());
357
358 // Test case 3 is parsing a single bookmark with two labels.
359 bookmark_xml = kGoodBookmarkTwoLabels;
360 bookmarks.clear();
361 XmlReader reader3;
362 EXPECT_TRUE(reader3.Load(bookmark_xml));
363 EXPECT_TRUE(Toolbar5Importer::ParseBookmarksFromReader(&reader3, &bookmarks,
364 kBookmarkGroupTitle));
365
366 ASSERT_EQ(2U, bookmarks.size());
367 EXPECT_FALSE(bookmarks[0].in_toolbar);
368 EXPECT_FALSE(bookmarks[1].in_toolbar);
369 EXPECT_EQ(kTitle, bookmarks[0].title);
370 EXPECT_EQ(kTitle, bookmarks[1].title);
371 EXPECT_EQ(url, bookmarks[0].url);
372 EXPECT_EQ(url, bookmarks[1].url);
373 ASSERT_EQ(2U, bookmarks[0].path.size());
374 EXPECT_EQ(kFolder, bookmarks[0].path[1]);
375 ASSERT_EQ(2U, bookmarks[1].path.size());
376 EXPECT_EQ(kFolder2, bookmarks[1].path[1]);
377
378 // Test case 4 is parsing a single bookmark which has a label with a colon,
379 // this test file name translation between Toolbar and Chrome.
380 bookmark_xml = kGoodBookmarkFolderLabel;
381 bookmarks.clear();
382 XmlReader reader4;
383 EXPECT_TRUE(reader4.Load(bookmark_xml));
384 EXPECT_TRUE(Toolbar5Importer::ParseBookmarksFromReader(&reader4, &bookmarks,
385 kBookmarkGroupTitle));
386
387 ASSERT_EQ(1U, bookmarks.size());
388 EXPECT_FALSE(bookmarks[0].in_toolbar);
389 EXPECT_EQ(kTitle, bookmarks[0].title);
390 EXPECT_EQ(url, bookmarks[0].url);
391 ASSERT_EQ(4U, bookmarks[0].path.size());
392 EXPECT_EQ(string16(kFolderArray[0]),
393 bookmarks[0].path[1]);
394 EXPECT_EQ(string16(kFolderArray[1]),
395 bookmarks[0].path[2]);
396 EXPECT_EQ(string16(kFolderArray[2]),
397 bookmarks[0].path[3]);
398
399 // Test case 5 is parsing a single bookmark without a favicon URL.
400 bookmark_xml = kGoodBookmarkNoFavicon;
401 bookmarks.clear();
402 XmlReader reader5;
403 EXPECT_TRUE(reader5.Load(bookmark_xml));
404 EXPECT_TRUE(Toolbar5Importer::ParseBookmarksFromReader(&reader5, &bookmarks,
405 kBookmarkGroupTitle));
406
407 ASSERT_EQ(1U, bookmarks.size());
408 EXPECT_FALSE(bookmarks[0].in_toolbar);
409 EXPECT_EQ(kTitle, bookmarks[0].title);
410 EXPECT_EQ(url, bookmarks[0].url);
411 ASSERT_EQ(2U, bookmarks[0].path.size());
412 EXPECT_EQ(kFolder, bookmarks[0].path[1]);
413
414 // Test case 6 is parsing two bookmarks.
415 bookmark_xml = kGoodBookmark2Items;
416 bookmarks.clear();
417 XmlReader reader6;
418 EXPECT_TRUE(reader6.Load(bookmark_xml));
419 EXPECT_TRUE(Toolbar5Importer::ParseBookmarksFromReader(&reader6, &bookmarks,
420 kBookmarkGroupTitle));
421
422 ASSERT_EQ(2U, bookmarks.size());
423 EXPECT_FALSE(bookmarks[0].in_toolbar);
424 EXPECT_FALSE(bookmarks[1].in_toolbar);
425 EXPECT_EQ(kTitle, bookmarks[0].title);
426 EXPECT_EQ(kOtherTitle, bookmarks[1].title);
427 EXPECT_EQ(url, bookmarks[0].url);
428 EXPECT_EQ(other_url, bookmarks[1].url);
429 ASSERT_EQ(2U, bookmarks[0].path.size());
430 EXPECT_EQ(kFolder, bookmarks[0].path[1]);
431 ASSERT_EQ(2U, bookmarks[1].path.size());
432 EXPECT_EQ(kOtherFolder, bookmarks[1].path[1]);
433
434 // Test case 7 is parsing an empty string for bookmarks.
435 bookmark_xml = kEmptyString;
436 bookmarks.clear();
437 XmlReader reader7;
438 EXPECT_FALSE(reader7.Load(bookmark_xml));
439
440 // Test case 8 is testing the error when no <bookmarks> section is present.
441 bookmark_xml = kBadBookmarkNoBookmarks;
442 bookmarks.clear();
443 XmlReader reader8;
444 EXPECT_TRUE(reader8.Load(bookmark_xml));
445 EXPECT_FALSE(Toolbar5Importer::ParseBookmarksFromReader(&reader8,
446 &bookmarks, kBookmarkGroupTitle));
447
448 // Test case 9 tests when no <bookmark> section is present.
449 bookmark_xml = kBadBookmarkNoBookmark;
450 bookmarks.clear();
451 XmlReader reader9;
452 EXPECT_TRUE(reader9.Load(bookmark_xml));
453 EXPECT_FALSE(Toolbar5Importer::ParseBookmarksFromReader(&reader9,
454 &bookmarks, kBookmarkGroupTitle));
455
456
457 // Test case 10 tests when a bookmark has no <title> section.
458 bookmark_xml = kBadBookmarkNoTitle;
459 bookmarks.clear();
460 XmlReader reader10;
461 EXPECT_TRUE(reader10.Load(bookmark_xml));
462 EXPECT_FALSE(Toolbar5Importer::ParseBookmarksFromReader(&reader10,
463 &bookmarks, kBookmarkGroupTitle));
464
465 // Test case 11 tests when a bookmark has no <url> section.
466 bookmark_xml = kBadBookmarkNoUrl;
467 bookmarks.clear();
468 XmlReader reader11;
469 EXPECT_TRUE(reader11.Load(bookmark_xml));
470 EXPECT_FALSE(Toolbar5Importer::ParseBookmarksFromReader(&reader11,
471 &bookmarks, kBookmarkGroupTitle));
472
473 // Test case 12 tests when a bookmark has no <timestamp> section.
474 bookmark_xml = kBadBookmarkNoTimestamp;
475 bookmarks.clear();
476 XmlReader reader12;
477 EXPECT_TRUE(reader12.Load(bookmark_xml));
478 EXPECT_FALSE(Toolbar5Importer::ParseBookmarksFromReader(&reader12,
479 &bookmarks, kBookmarkGroupTitle));
480
481 // Test case 13 tests when a bookmark has no <labels> section.
482 bookmark_xml = kBadBookmarkNoLabels;
483 bookmarks.clear();
484 XmlReader reader13;
485 EXPECT_TRUE(reader13.Load(bookmark_xml));
486 EXPECT_FALSE(Toolbar5Importer::ParseBookmarksFromReader(&reader13,
487 &bookmarks, kBookmarkGroupTitle));
488 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/toolbar_importer.cc ('k') | chrome/browser/importer/toolbar_importer_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698