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 | |
167 ASSERT_LE(bookmark_count_ + bookmarks.size(), | 166 ASSERT_LE(bookmark_count_ + bookmarks.size(), |
168 arraysize(kFirefox3Bookmarks)); | 167 arraysize(kFirefox3Bookmarks)); |
169 // Importer should import the FF favorites the same as the list, in the same | 168 // Importer should import the FF favorites the same as the list, in the same |
170 // order. | 169 // order. |
171 for (size_t i = 0; i < bookmarks.size(); ++i) { | 170 for (size_t i = 0; i < bookmarks.size(); ++i) { |
172 EXPECT_NO_FATAL_FAILURE( | 171 EXPECT_NO_FATAL_FAILURE( |
173 TestEqualBookmarkEntry(bookmarks[i], | 172 TestEqualBookmarkEntry(bookmarks[i], |
174 kFirefox3Bookmarks[bookmark_count_])) << i; | 173 kFirefox3Bookmarks[bookmark_count_])) << i; |
175 ++bookmark_count_; | 174 ++bookmark_count_; |
176 } | 175 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 importer::SourceProfile source_profile; | 261 importer::SourceProfile source_profile; |
263 source_profile.importer_type = importer::TYPE_FIREFOX3; | 262 source_profile.importer_type = importer::TYPE_FIREFOX3; |
264 source_profile.app_path = app_path_; | 263 source_profile.app_path = app_path_; |
265 source_profile.source_path = profile_path_; | 264 source_profile.source_path = profile_path_; |
266 | 265 |
267 int items = importer::HISTORY | importer::PASSWORDS | importer::FAVORITES; | 266 int items = importer::HISTORY | importer::PASSWORDS | importer::FAVORITES; |
268 if (import_search_plugins) | 267 if (import_search_plugins) |
269 items = items | importer::SEARCH_ENGINES; | 268 items = items | importer::SEARCH_ENGINES; |
270 | 269 |
271 // Deletes itself. | 270 // Deletes itself. |
272 // TODO(gab): Use ExternalProcessImporterHost on both Windows and Linux. | 271 // TODO(gab): Use ExternalProcessImporterHost on Linux as well. |
273 ImporterHost* host; | 272 ImporterHost* host; |
274 #if defined(OS_MACOSX) | 273 #if defined(OS_MACOSX) || defined(OS_WIN) |
275 host = new ExternalProcessImporterHost; | 274 host = new ExternalProcessImporterHost; |
276 #else | 275 #else |
277 host = new ImporterHost; | 276 host = new ImporterHost; |
278 #endif | 277 #endif |
279 host->SetObserver(observer); | 278 host->SetObserver(observer); |
280 host->StartImportSettings(source_profile, browser()->profile(), | 279 host->StartImportSettings(source_profile, browser()->profile(), |
281 items, make_scoped_refptr(writer)); | 280 items, make_scoped_refptr(writer)); |
282 MessageLoop::current()->Run(); | 281 MessageLoop::current()->Run(); |
283 } | 282 } |
284 | 283 |
(...skipping 10 matching lines...) Expand all Loading... |
295 } | 294 } |
296 | 295 |
297 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, | 296 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, |
298 MAYBE_IMPORTER(Firefox35Importer)) { | 297 MAYBE_IMPORTER(Firefox35Importer)) { |
299 bool import_search_engines = false; | 298 bool import_search_engines = false; |
300 scoped_refptr<Firefox3Observer> observer( | 299 scoped_refptr<Firefox3Observer> observer( |
301 new Firefox3Observer(import_search_engines)); | 300 new Firefox3Observer(import_search_engines)); |
302 Firefox3xImporterBrowserTest("firefox35_profile", observer.get(), | 301 Firefox3xImporterBrowserTest("firefox35_profile", observer.get(), |
303 observer.get(), import_search_engines); | 302 observer.get(), import_search_engines); |
304 } | 303 } |
OLD | NEW |