| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 EXPECT_EQ(ASCIIToUTF16("Google"), page[1].title()); | 156 EXPECT_EQ(ASCIIToUTF16("Google"), page[1].title()); |
| 157 EXPECT_EQ("http://www.cs.unc.edu/~jbs/resources/perl/perl-cgi/programs/" | 157 EXPECT_EQ("http://www.cs.unc.edu/~jbs/resources/perl/perl-cgi/programs/" |
| 158 "form1-POST.html", page[2].url().spec()); | 158 "form1-POST.html", page[2].url().spec()); |
| 159 EXPECT_EQ(ASCIIToUTF16("example form (POST)"), page[2].title()); | 159 EXPECT_EQ(ASCIIToUTF16("example form (POST)"), page[2].title()); |
| 160 EXPECT_EQ(history::SOURCE_FIREFOX_IMPORTED, visit_source); | 160 EXPECT_EQ(history::SOURCE_FIREFOX_IMPORTED, visit_source); |
| 161 ++history_count_; | 161 ++history_count_; |
| 162 } | 162 } |
| 163 | 163 |
| 164 virtual void AddBookmarks(const std::vector<ImportedBookmarkEntry>& bookmarks, | 164 virtual void AddBookmarks(const std::vector<ImportedBookmarkEntry>& bookmarks, |
| 165 const string16& top_level_folder_name) OVERRIDE { | 165 const string16& top_level_folder_name) OVERRIDE { |
| 166 |
| 166 ASSERT_LE(bookmark_count_ + bookmarks.size(), | 167 ASSERT_LE(bookmark_count_ + bookmarks.size(), |
| 167 arraysize(kFirefox3Bookmarks)); | 168 arraysize(kFirefox3Bookmarks)); |
| 168 // Importer should import the FF favorites the same as the list, in the same | 169 // Importer should import the FF favorites the same as the list, in the same |
| 169 // order. | 170 // order. |
| 170 for (size_t i = 0; i < bookmarks.size(); ++i) { | 171 for (size_t i = 0; i < bookmarks.size(); ++i) { |
| 171 EXPECT_NO_FATAL_FAILURE( | 172 EXPECT_NO_FATAL_FAILURE( |
| 172 TestEqualBookmarkEntry(bookmarks[i], | 173 TestEqualBookmarkEntry(bookmarks[i], |
| 173 kFirefox3Bookmarks[bookmark_count_])) << i; | 174 kFirefox3Bookmarks[bookmark_count_])) << i; |
| 174 ++bookmark_count_; | 175 ++bookmark_count_; |
| 175 } | 176 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 importer::SourceProfile source_profile; | 262 importer::SourceProfile source_profile; |
| 262 source_profile.importer_type = importer::TYPE_FIREFOX3; | 263 source_profile.importer_type = importer::TYPE_FIREFOX3; |
| 263 source_profile.app_path = app_path_; | 264 source_profile.app_path = app_path_; |
| 264 source_profile.source_path = profile_path_; | 265 source_profile.source_path = profile_path_; |
| 265 | 266 |
| 266 int items = importer::HISTORY | importer::PASSWORDS | importer::FAVORITES; | 267 int items = importer::HISTORY | importer::PASSWORDS | importer::FAVORITES; |
| 267 if (import_search_plugins) | 268 if (import_search_plugins) |
| 268 items = items | importer::SEARCH_ENGINES; | 269 items = items | importer::SEARCH_ENGINES; |
| 269 | 270 |
| 270 // Deletes itself. | 271 // Deletes itself. |
| 271 // TODO(gab): Use ExternalProcessImporterHost on Linux as well. | 272 // TODO(gab): Use ExternalProcessImporterHost on both Windows and Linux. |
| 272 ImporterHost* host; | 273 ImporterHost* host; |
| 273 #if defined(OS_MACOSX) || defined(OS_WIN) | 274 #if defined(OS_MACOSX) |
| 274 host = new ExternalProcessImporterHost; | 275 host = new ExternalProcessImporterHost; |
| 275 #else | 276 #else |
| 276 host = new ImporterHost; | 277 host = new ImporterHost; |
| 277 #endif | 278 #endif |
| 278 host->SetObserver(observer); | 279 host->SetObserver(observer); |
| 279 host->StartImportSettings(source_profile, browser()->profile(), | 280 host->StartImportSettings(source_profile, browser()->profile(), |
| 280 items, make_scoped_refptr(writer)); | 281 items, make_scoped_refptr(writer)); |
| 281 MessageLoop::current()->Run(); | 282 MessageLoop::current()->Run(); |
| 282 } | 283 } |
| 283 | 284 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 294 } | 295 } |
| 295 | 296 |
| 296 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, | 297 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, |
| 297 MAYBE_IMPORTER(Firefox35Importer)) { | 298 MAYBE_IMPORTER(Firefox35Importer)) { |
| 298 bool import_search_engines = false; | 299 bool import_search_engines = false; |
| 299 scoped_refptr<Firefox3Observer> observer( | 300 scoped_refptr<Firefox3Observer> observer( |
| 300 new Firefox3Observer(import_search_engines)); | 301 new Firefox3Observer(import_search_engines)); |
| 301 Firefox3xImporterBrowserTest("firefox35_profile", observer.get(), | 302 Firefox3xImporterBrowserTest("firefox35_profile", observer.get(), |
| 302 observer.get(), import_search_engines); | 303 observer.get(), import_search_engines); |
| 303 } | 304 } |
| OLD | NEW |