| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/utility/importer/bookmark_html_reader.h" | 5 #include "chrome/utility/importer/bookmark_html_reader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 std::vector<importer::SearchEngineInfo> search_engines; | 336 std::vector<importer::SearchEngineInfo> search_engines; |
| 337 ImportBookmarksFile(base::Callback<bool(void)>(), | 337 ImportBookmarksFile(base::Callback<bool(void)>(), |
| 338 base::Callback<bool(const GURL&)>(), | 338 base::Callback<bool(const GURL&)>(), |
| 339 path, NULL, &search_engines, NULL); | 339 path, NULL, &search_engines, NULL); |
| 340 | 340 |
| 341 ASSERT_EQ(2U, search_engines.size()); | 341 ASSERT_EQ(2U, search_engines.size()); |
| 342 ExpectFirstFirefoxBookmarkWithKeyword(search_engines[0]); | 342 ExpectFirstFirefoxBookmarkWithKeyword(search_engines[0]); |
| 343 ExpectSecondFirefoxBookmarkWithKeyword(search_engines[1]); | 343 ExpectSecondFirefoxBookmarkWithKeyword(search_engines[1]); |
| 344 } | 344 } |
| 345 | 345 |
| 346 TEST_F(BookmarkHTMLReaderTestWithData, |
| 347 RedditSaverFileImport) { |
| 348 base::FilePath path = test_data_path_.AppendASCII("redditsaver.html"); |
| 349 |
| 350 std::vector<ImportedBookmarkEntry> bookmarks; |
| 351 ImportBookmarksFile(base::Callback<bool(void)>(), |
| 352 base::Callback<bool(const GURL&)>(), |
| 353 path, &bookmarks, NULL, NULL); |
| 354 |
| 355 ASSERT_EQ(2U, bookmarks.size()); |
| 356 EXPECT_EQ(ASCIIToUTF16("Google"), bookmarks[0].title); |
| 357 EXPECT_EQ(ASCIIToUTF16("YouTube"), bookmarks[1].title); |
| 358 } |
| 359 |
| 346 // Verifies that importing a bookmarks file without a charset specified succeeds | 360 // Verifies that importing a bookmarks file without a charset specified succeeds |
| 347 // (by falling back to a default charset). Per [ http://crbug.com/460423 ], this | 361 // (by falling back to a default charset). Per [ http://crbug.com/460423 ], this |
| 348 // sort of bookmarks file is generated by IE. | 362 // sort of bookmarks file is generated by IE. |
| 349 TEST_F(BookmarkHTMLReaderTestWithData, | 363 TEST_F(BookmarkHTMLReaderTestWithData, |
| 350 InternetExplorerBookmarkFileWithoutCharsetImport) { | 364 InternetExplorerBookmarkFileWithoutCharsetImport) { |
| 351 base::FilePath path = test_data_path_.AppendASCII("ie_sans_charset.html"); | 365 base::FilePath path = test_data_path_.AppendASCII("ie_sans_charset.html"); |
| 352 | 366 |
| 353 std::vector<ImportedBookmarkEntry> bookmarks; | 367 std::vector<ImportedBookmarkEntry> bookmarks; |
| 354 ImportBookmarksFile(base::Callback<bool(void)>(), | 368 ImportBookmarksFile(base::Callback<bool(void)>(), |
| 355 base::Callback<bool(const GURL&)>(), | 369 base::Callback<bool(const GURL&)>(), |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 ImportBookmarksFile(base::Callback<bool(void)>(), | 423 ImportBookmarksFile(base::Callback<bool(void)>(), |
| 410 base::Bind(&IsURLValid), | 424 base::Bind(&IsURLValid), |
| 411 path, &bookmarks, NULL, NULL); | 425 path, &bookmarks, NULL, NULL); |
| 412 | 426 |
| 413 ASSERT_EQ(2U, bookmarks.size()); | 427 ASSERT_EQ(2U, bookmarks.size()); |
| 414 ExpectFirstFirefox2Bookmark(bookmarks[0]); | 428 ExpectFirstFirefox2Bookmark(bookmarks[0]); |
| 415 ExpectThirdFirefox2Bookmark(bookmarks[1]); | 429 ExpectThirdFirefox2Bookmark(bookmarks[1]); |
| 416 } | 430 } |
| 417 | 431 |
| 418 } // namespace bookmark_html_reader | 432 } // namespace bookmark_html_reader |
| OLD | NEW |