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

Unified Diff: chrome/utility/importer/bookmark_html_reader_unittest.cc

Issue 2968923003: Fixed importing of empty folders from HTML bookmarks file (Closed)
Patch Set: Fixed review issues Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/utility/importer/bookmark_html_reader.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/utility/importer/bookmark_html_reader_unittest.cc
diff --git a/chrome/utility/importer/bookmark_html_reader_unittest.cc b/chrome/utility/importer/bookmark_html_reader_unittest.cc
index 67f1cc0967dc3954459ce75d97fae81fa1955eac..2b6d8db7221a9f2c3fa64472f2cc3856e88df613 100644
--- a/chrome/utility/importer/bookmark_html_reader_unittest.cc
+++ b/chrome/utility/importer/bookmark_html_reader_unittest.cc
@@ -188,6 +188,8 @@ class BookmarkHTMLReaderTestWithData : public testing::Test {
const importer::SearchEngineInfo& info);
void ExpectSecondFirefoxBookmarkWithKeyword(
const importer::SearchEngineInfo& info);
+ void ExpectFirstEmptyFolderBookmark(const ImportedBookmarkEntry& entry);
+ void ExpectSecondEmptyFolderBookmark(const ImportedBookmarkEntry& entry);
base::FilePath test_data_path_;
};
@@ -286,6 +288,27 @@ void BookmarkHTMLReaderTestWithData::ExpectSecondFirefoxBookmarkWithKeyword(
EXPECT_EQ(ASCIIToUTF16("BookmarkName"), info.display_name);
}
+void BookmarkHTMLReaderTestWithData::ExpectFirstEmptyFolderBookmark(
+ const ImportedBookmarkEntry& entry) {
+ EXPECT_EQ(base::string16(), entry.title);
+ EXPECT_TRUE(entry.is_folder);
+ EXPECT_EQ(base::Time::FromTimeT(1295938143), entry.creation_time);
+ EXPECT_EQ(1U, entry.path.size());
+ if (entry.path.size() == 1)
+ EXPECT_EQ(ASCIIToUTF16("Empty's Parent"), entry.path.front());
+}
+
+void BookmarkHTMLReaderTestWithData::ExpectSecondEmptyFolderBookmark(
+ const ImportedBookmarkEntry& entry) {
+ EXPECT_EQ(ASCIIToUTF16("[Tamura Yukari.com]"), entry.title);
+ EXPECT_FALSE(entry.is_folder);
+ EXPECT_EQ(base::Time::FromTimeT(1234567890), entry.creation_time);
+ EXPECT_EQ(1U, entry.path.size());
+ if (entry.path.size() == 1)
+ EXPECT_EQ(base::string16(), entry.path.front());
+ EXPECT_EQ("http://www.tamurayukari.com/", entry.url.spec());
+}
+
} // namespace
TEST_F(BookmarkHTMLReaderTestWithData, Firefox2BookmarkFileImport) {
@@ -343,6 +366,20 @@ TEST_F(BookmarkHTMLReaderTestWithData, FirefoxBookmarkFileWithKeywordImport) {
ExpectSecondFirefoxBookmarkWithKeyword(search_engines[1]);
}
+TEST_F(BookmarkHTMLReaderTestWithData, EmptyFolderImport) {
+ base::FilePath path = test_data_path_.AppendASCII("empty_folder.html");
+
+ std::vector<ImportedBookmarkEntry> bookmarks;
+ ImportBookmarksFile(base::Callback<bool(void)>(),
+ base::Callback<bool(const GURL&)>(), path, &bookmarks,
+ NULL, NULL);
+
+ ASSERT_EQ(3U, bookmarks.size());
+ ExpectFirstEmptyFolderBookmark(bookmarks[0]);
+ ExpectSecondEmptyFolderBookmark(bookmarks[1]);
+ ExpectThirdFirefox2Bookmark(bookmarks[2]);
+}
+
TEST_F(BookmarkHTMLReaderTestWithData,
RedditSaverFileImport) {
base::FilePath path = test_data_path_.AppendASCII("redditsaver.html");
« no previous file with comments | « chrome/utility/importer/bookmark_html_reader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698