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

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

Issue 12670013: Out-of-process import on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge up to r196136 + modifications in extracted CLs Created 7 years, 8 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) 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 EXPECT_EQ(ASCIIToUTF16("Google"), page[1].title()); 325 EXPECT_EQ(ASCIIToUTF16("Google"), page[1].title());
326 EXPECT_EQ("http://www.cs.unc.edu/~jbs/resources/perl/perl-cgi/programs/" 326 EXPECT_EQ("http://www.cs.unc.edu/~jbs/resources/perl/perl-cgi/programs/"
327 "form1-POST.html", page[2].url().spec()); 327 "form1-POST.html", page[2].url().spec());
328 EXPECT_EQ(ASCIIToUTF16("example form (POST)"), page[2].title()); 328 EXPECT_EQ(ASCIIToUTF16("example form (POST)"), page[2].title());
329 EXPECT_EQ(history::SOURCE_FIREFOX_IMPORTED, visit_source); 329 EXPECT_EQ(history::SOURCE_FIREFOX_IMPORTED, visit_source);
330 ++history_count_; 330 ++history_count_;
331 } 331 }
332 332
333 virtual void AddBookmarks(const std::vector<BookmarkEntry>& bookmarks, 333 virtual void AddBookmarks(const std::vector<BookmarkEntry>& bookmarks,
334 const string16& top_level_folder_name) OVERRIDE { 334 const string16& top_level_folder_name) OVERRIDE {
335
336 ASSERT_LE(bookmark_count_ + bookmarks.size(), 335 ASSERT_LE(bookmark_count_ + bookmarks.size(),
337 arraysize(kFirefox3Bookmarks)); 336 arraysize(kFirefox3Bookmarks));
338 // Importer should import the FF favorites the same as the list, in the same 337 // Importer should import the FF favorites the same as the list, in the same
339 // order. 338 // order.
340 for (size_t i = 0; i < bookmarks.size(); ++i) { 339 for (size_t i = 0; i < bookmarks.size(); ++i) {
341 EXPECT_NO_FATAL_FAILURE( 340 EXPECT_NO_FATAL_FAILURE(
342 TestEqualBookmarkEntry(bookmarks[i], 341 TestEqualBookmarkEntry(bookmarks[i],
343 kFirefox3Bookmarks[bookmark_count_])) << i; 342 kFirefox3Bookmarks[bookmark_count_])) << i;
344 ++bookmark_count_; 343 ++bookmark_count_;
345 } 344 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 429
431 importer::SourceProfile source_profile; 430 importer::SourceProfile source_profile;
432 source_profile.importer_type = importer::TYPE_FIREFOX3; 431 source_profile.importer_type = importer::TYPE_FIREFOX3;
433 source_profile.app_path = app_path_; 432 source_profile.app_path = app_path_;
434 source_profile.source_path = profile_path_; 433 source_profile.source_path = profile_path_;
435 434
436 int items = importer::HISTORY | importer::PASSWORDS | importer::FAVORITES; 435 int items = importer::HISTORY | importer::PASSWORDS | importer::FAVORITES;
437 if (import_search_plugins) 436 if (import_search_plugins)
438 items = items | importer::SEARCH_ENGINES; 437 items = items | importer::SEARCH_ENGINES;
439 438
440 // TODO(gab): Use ExternalProcessImporterHost on both Windows and Linux. 439 // TODO(gab): Use ExternalProcessImporterHost on Linux as well.
441 scoped_refptr<ImporterHost> host; 440 scoped_refptr<ImporterHost> host;
442 #if defined(OS_MACOSX) 441 #if defined(OS_MACOSX) || defined(OS_WIN)
443 host = new ExternalProcessImporterHost; 442 host = new ExternalProcessImporterHost;
444 #else 443 #else
445 host = new ImporterHost; 444 host = new ImporterHost;
446 #endif 445 #endif
447 host->SetObserver(observer); 446 host->SetObserver(observer);
448 host->StartImportSettings(source_profile, browser()->profile(), 447 host->StartImportSettings(source_profile, browser()->profile(),
449 items, make_scoped_refptr(writer)); 448 items, make_scoped_refptr(writer));
450 MessageLoop::current()->Run(); 449 MessageLoop::current()->Run();
451 } 450 }
452 451
(...skipping 22 matching lines...) Expand all
475 LOG(ERROR) << L"Missing internal test data"; 474 LOG(ERROR) << L"Missing internal test data";
476 return; 475 return;
477 } 476 }
478 ASSERT_TRUE(file_util::CopyDirectory(data_path, search_engine_path, false)); 477 ASSERT_TRUE(file_util::CopyDirectory(data_path, search_engine_path, false));
479 478
480 importer::SourceProfile source_profile; 479 importer::SourceProfile source_profile;
481 source_profile.importer_type = importer::TYPE_FIREFOX2; 480 source_profile.importer_type = importer::TYPE_FIREFOX2;
482 source_profile.app_path = app_path_; 481 source_profile.app_path = app_path_;
483 source_profile.source_path = profile_path_; 482 source_profile.source_path = profile_path_;
484 483
485 // TODO(gab): Use ExternalProcessImporterHost on both Windows and Linux. 484 // TODO(gab): Use ExternalProcessImporterHost on Linux as well.
486 scoped_refptr<ImporterHost> host; 485 scoped_refptr<ImporterHost> host;
487 #if defined(OS_MACOSX) 486 #if defined(OS_MACOSX) || defined(OS_WIN)
488 host = new ExternalProcessImporterHost; 487 host = new ExternalProcessImporterHost;
489 #else 488 #else
490 host = new ImporterHost; 489 host = new ImporterHost;
491 #endif 490 #endif
492 FirefoxObserver* observer = new FirefoxObserver(); 491 FirefoxObserver* observer = new FirefoxObserver();
493 host->SetObserver(observer); 492 host->SetObserver(observer);
494 host->StartImportSettings( 493 host->StartImportSettings(
495 source_profile, 494 source_profile,
496 browser()->profile(), 495 browser()->profile(),
497 importer::HISTORY | importer::PASSWORDS | 496 importer::HISTORY | importer::PASSWORDS |
(...skipping 10 matching lines...) Expand all
508 } 507 }
509 508
510 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, 509 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest,
511 MAYBE_IMPORTER(Firefox35Importer)) { 510 MAYBE_IMPORTER(Firefox35Importer)) {
512 bool import_search_engines = false; 511 bool import_search_engines = false;
513 scoped_refptr<Firefox3Observer> observer( 512 scoped_refptr<Firefox3Observer> observer(
514 new Firefox3Observer(import_search_engines)); 513 new Firefox3Observer(import_search_engines));
515 Firefox3xImporterBrowserTest("firefox35_profile", observer.get(), 514 Firefox3xImporterBrowserTest("firefox35_profile", observer.get(),
516 observer.get(), import_search_engines); 515 observer.get(), import_search_engines);
517 } 516 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698