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

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

Issue 14575004: Extract BookmarksFileImporter from Firefox2Importer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test cleanup Created 7 years, 7 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/bookmarks/imported_bookmark_entry.h"
12 #include "chrome/browser/history/history_types.h" 13 #include "chrome/browser/history/history_types.h"
13 #include "chrome/browser/importer/firefox2_importer.h" 14 #include "chrome/browser/importer/firefox2_importer.h"
14 #include "chrome/browser/importer/firefox_importer_unittest_utils.h" 15 #include "chrome/browser/importer/firefox_importer_unittest_utils.h"
15 #include "chrome/browser/importer/nss_decryptor.h" 16 #include "chrome/browser/importer/nss_decryptor.h"
16 #include "chrome/common/chrome_paths.h" 17 #include "chrome/common/chrome_paths.h"
17 18
18 // TODO(jschuh): Disabled on Win64 build. http://crbug.com/179688 19 // TODO(jschuh): Disabled on Win64 build. http://crbug.com/179688
19 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64) 20 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64)
20 #define MAYBE_NSS(x) DISABLED_##x 21 #define MAYBE_NSS(x) DISABLED_##x
21 #else 22 #else
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 TEST(FirefoxImporterTest, Firefox2BookmarkFileImport) { 195 TEST(FirefoxImporterTest, Firefox2BookmarkFileImport) {
195 base::FilePath path; 196 base::FilePath path;
196 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &path)); 197 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &path));
197 path = path.AppendASCII("firefox2_importer"); 198 path = path.AppendASCII("firefox2_importer");
198 199
199 // Import all bookmarks from a file which include an empty folder entry. 200 // Import all bookmarks from a file which include an empty folder entry.
200 base::FilePath empty_folder_path = path.AppendASCII("empty_folder.html"); 201 base::FilePath empty_folder_path = path.AppendASCII("empty_folder.html");
201 std::set<GURL> default_urls; 202 std::set<GURL> default_urls;
202 Firefox2Importer* importer = new Firefox2Importer(); 203 Firefox2Importer* importer = new Firefox2Importer();
203 importer->AddRef(); 204 importer->AddRef();
204 std::vector<ProfileWriter::BookmarkEntry> bookmarks; 205 std::vector<ImportedBookmarkEntry> bookmarks;
205 importer->ImportBookmarksFile(empty_folder_path, default_urls, 206 importer->ImportBookmarksFile(empty_folder_path, default_urls,
206 importer, &bookmarks, NULL, NULL); 207 importer, &bookmarks, NULL, NULL);
207 EXPECT_EQ(3U, bookmarks.size()); 208 EXPECT_EQ(3U, bookmarks.size());
208 std::vector<ProfileWriter::BookmarkEntry>::iterator it; 209 std::vector<ImportedBookmarkEntry>::iterator it;
209 ProfileWriter::BookmarkEntry entry; 210 ImportedBookmarkEntry entry;
210 std::vector<string16>::iterator path_it; 211 std::vector<string16>::iterator path_it;
211 if (bookmarks.size() == 3) { 212 if (bookmarks.size() == 3) {
212 it = bookmarks.begin(); 213 it = bookmarks.begin();
213 entry = *it++; 214 entry = *it++;
214 EXPECT_EQ(ASCIIToUTF16("Empty"), entry.title); 215 EXPECT_EQ(ASCIIToUTF16("Empty"), entry.title);
215 EXPECT_TRUE(entry.is_folder); 216 EXPECT_TRUE(entry.is_folder);
216 EXPECT_EQ(base::Time::FromTimeT(1295938143), entry.creation_time); 217 EXPECT_EQ(base::Time::FromTimeT(1295938143), entry.creation_time);
217 EXPECT_EQ(1U, entry.path.size()); 218 EXPECT_EQ(1U, entry.path.size());
218 if (entry.path.size() == 1) 219 if (entry.path.size() == 1)
219 EXPECT_EQ(ASCIIToUTF16("Empty's Parent"), entry.path.front()); 220 EXPECT_EQ(ASCIIToUTF16("Empty's Parent"), entry.path.front());
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 EXPECT_EQ("http://www.tamurayukari.com/", entry.url.spec()); 296 EXPECT_EQ("http://www.tamurayukari.com/", entry.url.spec());
296 EXPECT_EQ(0U, entry.path.size()); 297 EXPECT_EQ(0U, entry.path.size());
297 entry = *it++; 298 entry = *it++;
298 EXPECT_EQ(ASCIIToUTF16("Google"), entry.title); 299 EXPECT_EQ(ASCIIToUTF16("Google"), entry.title);
299 EXPECT_EQ("http://www.google.com/", entry.url.spec()); 300 EXPECT_EQ("http://www.google.com/", entry.url.spec());
300 EXPECT_EQ(0U, entry.path.size()); 301 EXPECT_EQ(0U, entry.path.size());
301 } 302 }
302 303
303 importer->Release(); 304 importer->Release();
304 } 305 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698