Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_html_writer.h" | 10 #include "chrome/browser/bookmarks/bookmark_html_writer.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 EXPECT_TRUE(path_count < 3 || entry.path[3] == f3); | 53 EXPECT_TRUE(path_count < 3 || entry.path[3] == f3); |
| 54 } | 54 } |
| 55 | 55 |
| 56 std::wstring path_; | 56 std::wstring path_; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 // Tests bookmark_html_writer by populating a BookmarkModel, writing it out by | 59 // Tests bookmark_html_writer by populating a BookmarkModel, writing it out by |
| 60 // way of bookmark_html_writer, then using the importer to read it back in. | 60 // way of bookmark_html_writer, then using the importer to read it back in. |
| 61 TEST_F(BookmarkHTMLWriterTest, Test) { | 61 TEST_F(BookmarkHTMLWriterTest, Test) { |
| 62 // Populate the BookmarkModel. This creates the following bookmark structure: | 62 // Populate the BookmarkModel. This creates the following bookmark structure: |
| 63 // Bookmark Bar | 63 // Bookmarks bar |
| 64 // F1 | 64 // F1 |
| 65 // url1 | 65 // url1 |
| 66 // F2 | 66 // F2 |
| 67 // url2 | 67 // url2 |
| 68 // url3 | 68 // url3 |
| 69 // Other | 69 // Other |
| 70 // url1 | 70 // url1 |
| 71 // url2 | 71 // url2 |
| 72 // F3 | 72 // F3 |
| 73 // F4 | 73 // F4 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 103 bookmark_html_writer::WriteBookmarks(NULL, &model, path_); | 103 bookmark_html_writer::WriteBookmarks(NULL, &model, path_); |
| 104 | 104 |
| 105 // Read the bookmarks back in. | 105 // Read the bookmarks back in. |
| 106 std::vector<ProfileWriter::BookmarkEntry> parsed_bookmarks; | 106 std::vector<ProfileWriter::BookmarkEntry> parsed_bookmarks; |
| 107 Firefox2Importer::ImportBookmarksFile(path_, std::set<GURL>(), false, | 107 Firefox2Importer::ImportBookmarksFile(path_, std::set<GURL>(), false, |
| 108 L"x", NULL, &parsed_bookmarks, NULL, | 108 L"x", NULL, &parsed_bookmarks, NULL, |
| 109 NULL); | 109 NULL); |
| 110 | 110 |
| 111 // Verify we got back what we wrote. | 111 // Verify we got back what we wrote. |
| 112 ASSERT_EQ(6U, parsed_bookmarks.size()); | 112 ASSERT_EQ(6U, parsed_bookmarks.size()); |
| 113 // TODO(jungshik): This test will fail if run in a non-en-US locale. | |
| 114 // Hardcode the value of IDS_BOOKMARK_BAR_FOLDER_NAME in en-US locale. | |
| 115 const wchar_t* kBookmarkBarFolderName = L"Bookmarks bar"; | |
|
sky
2009/03/24 20:11:11
All unit tests are run in en-US (see chrome_test_s
| |
| 113 AssertBookmarkEntryEquals(parsed_bookmarks[0], false, url1, url1_title, t1, | 116 AssertBookmarkEntryEquals(parsed_bookmarks[0], false, url1, url1_title, t1, |
| 114 L"Bookmark Bar", f1_title, std::wstring()); | 117 kBookmarkBarFolderName, f1_title, std::wstring()); |
| 115 AssertBookmarkEntryEquals(parsed_bookmarks[1], false, url2, url2_title, t2, | 118 AssertBookmarkEntryEquals(parsed_bookmarks[1], false, url2, url2_title, t2, |
| 116 L"Bookmark Bar", f1_title, f2_title); | 119 kBookmarkBarFolderName, f1_title, f2_title); |
| 117 AssertBookmarkEntryEquals(parsed_bookmarks[2], false, url3, url3_title, t3, | 120 AssertBookmarkEntryEquals(parsed_bookmarks[2], false, url3, url3_title, t3, |
| 118 L"Bookmark Bar", std::wstring(), std::wstring()); | 121 kBookmarkBarFolderName, std::wstring(), |
| 122 std::wstring()); | |
| 119 AssertBookmarkEntryEquals(parsed_bookmarks[3], false, url1, url1_title, t1, | 123 AssertBookmarkEntryEquals(parsed_bookmarks[3], false, url1, url1_title, t1, |
| 120 std::wstring(), std::wstring(), std::wstring()); | 124 std::wstring(), std::wstring(), std::wstring()); |
| 121 AssertBookmarkEntryEquals(parsed_bookmarks[4], false, url2, url2_title, t2, | 125 AssertBookmarkEntryEquals(parsed_bookmarks[4], false, url2, url2_title, t2, |
| 122 std::wstring(), std::wstring(), std::wstring()); | 126 std::wstring(), std::wstring(), std::wstring()); |
| 123 AssertBookmarkEntryEquals(parsed_bookmarks[5], false, url1, url1_title, t1, | 127 AssertBookmarkEntryEquals(parsed_bookmarks[5], false, url1, url1_title, t1, |
| 124 f3_title, f4_title, std::wstring()); | 128 f3_title, f4_title, std::wstring()); |
| 125 } | 129 } |
| OLD | NEW |