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 // The order of these includes is important. | 5 // The order of these includes is important. |
6 #include <windows.h> | 6 #include <windows.h> |
7 #include <unknwn.h> | 7 #include <unknwn.h> |
8 #include <intshcut.h> | 8 #include <intshcut.h> |
9 #include <propvarutil.h> | 9 #include <propvarutil.h> |
10 #include <shlguid.h> | 10 #include <shlguid.h> |
11 #include <shlobj.h> | 11 #include <shlobj.h> |
12 #include <stddef.h> | 12 #include <stddef.h> |
13 #include <stdint.h> | 13 #include <stdint.h> |
14 #include <urlhist.h> | 14 #include <urlhist.h> |
15 | 15 |
16 #include <algorithm> | 16 #include <algorithm> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "base/bind.h" | 19 #include "base/bind.h" |
20 #include "base/compiler_specific.h" | 20 #include "base/compiler_specific.h" |
21 #include "base/files/file_util.h" | 21 #include "base/files/file_util.h" |
22 #include "base/files/scoped_temp_dir.h" | 22 #include "base/files/scoped_temp_dir.h" |
23 #include "base/macros.h" | 23 #include "base/macros.h" |
24 #include "base/message_loop/message_loop.h" | 24 #include "base/message_loop/message_loop.h" |
| 25 #include "base/run_loop.h" |
25 #include "base/stl_util.h" | 26 #include "base/stl_util.h" |
26 #include "base/strings/string16.h" | 27 #include "base/strings/string16.h" |
27 #include "base/strings/string_util.h" | 28 #include "base/strings/string_util.h" |
28 #include "base/strings/utf_string_conversions.h" | 29 #include "base/strings/utf_string_conversions.h" |
29 #include "base/win/registry.h" | 30 #include "base/win/registry.h" |
30 #include "base/win/scoped_comptr.h" | 31 #include "base/win/scoped_comptr.h" |
31 #include "base/win/scoped_propvariant.h" | 32 #include "base/win/scoped_propvariant.h" |
32 #include "base/win/windows_version.h" | 33 #include "base/win/windows_version.h" |
33 #include "chrome/browser/importer/external_process_importer_host.h" | 34 #include "chrome/browser/importer/external_process_importer_host.h" |
34 #include "chrome/browser/importer/importer_progress_observer.h" | 35 #include "chrome/browser/importer/importer_progress_observer.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 | 515 |
515 importer::SourceProfile source_profile; | 516 importer::SourceProfile source_profile; |
516 source_profile.importer_type = importer::TYPE_IE; | 517 source_profile.importer_type = importer::TYPE_IE; |
517 source_profile.source_path = temp_dir_.path(); | 518 source_profile.source_path = temp_dir_.path(); |
518 | 519 |
519 host->StartImportSettings( | 520 host->StartImportSettings( |
520 source_profile, | 521 source_profile, |
521 browser()->profile(), | 522 browser()->profile(), |
522 importer::HISTORY | importer::PASSWORDS | importer::FAVORITES, | 523 importer::HISTORY | importer::PASSWORDS | importer::FAVORITES, |
523 observer); | 524 observer); |
524 base::MessageLoop::current()->Run(); | 525 base::RunLoop().Run(); |
525 | 526 |
526 // Cleans up. | 527 // Cleans up. |
527 url_history_stg2->DeleteUrl(kIEIdentifyUrl, 0); | 528 url_history_stg2->DeleteUrl(kIEIdentifyUrl, 0); |
528 url_history_stg2->DeleteUrl(kIECacheItemUrl, 0); | 529 url_history_stg2->DeleteUrl(kIECacheItemUrl, 0); |
529 url_history_stg2.Release(); | 530 url_history_stg2.Release(); |
530 } | 531 } |
531 | 532 |
532 IN_PROC_BROWSER_TEST_F(IEImporterBrowserTest, | 533 IN_PROC_BROWSER_TEST_F(IEImporterBrowserTest, |
533 IEImporterMalformedFavoritesRegistry) { | 534 IEImporterMalformedFavoritesRegistry) { |
534 // Sets up a favorites folder. | 535 // Sets up a favorites folder. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 | 593 |
593 importer::SourceProfile source_profile; | 594 importer::SourceProfile source_profile; |
594 source_profile.importer_type = importer::TYPE_IE; | 595 source_profile.importer_type = importer::TYPE_IE; |
595 source_profile.source_path = temp_dir_.path(); | 596 source_profile.source_path = temp_dir_.path(); |
596 | 597 |
597 host->StartImportSettings( | 598 host->StartImportSettings( |
598 source_profile, | 599 source_profile, |
599 browser()->profile(), | 600 browser()->profile(), |
600 importer::FAVORITES, | 601 importer::FAVORITES, |
601 observer); | 602 observer); |
602 base::MessageLoop::current()->Run(); | 603 base::RunLoop().Run(); |
603 } | 604 } |
604 } | 605 } |
605 | 606 |
606 IN_PROC_BROWSER_TEST_F(IEImporterBrowserTest, IE7ImporterPasswordsTest) { | 607 IN_PROC_BROWSER_TEST_F(IEImporterBrowserTest, IE7ImporterPasswordsTest) { |
607 // Starts to import the IE7 passwords. | 608 // Starts to import the IE7 passwords. |
608 // Deletes itself. | 609 // Deletes itself. |
609 ExternalProcessImporterHost* host = new ExternalProcessImporterHost; | 610 ExternalProcessImporterHost* host = new ExternalProcessImporterHost; |
610 TestObserver* observer = new TestObserver(importer::PASSWORDS, | 611 TestObserver* observer = new TestObserver(importer::PASSWORDS, |
611 TestObserver::IE7); | 612 TestObserver::IE7); |
612 host->set_observer(observer); | 613 host->set_observer(observer); |
613 | 614 |
614 base::string16 key_path(importer::GetIE7PasswordsKey()); | 615 base::string16 key_path(importer::GetIE7PasswordsKey()); |
615 base::win::RegKey key; | 616 base::win::RegKey key; |
616 ASSERT_EQ(ERROR_SUCCESS, | 617 ASSERT_EQ(ERROR_SUCCESS, |
617 key.Create(HKEY_CURRENT_USER, key_path.c_str(), KEY_WRITE)); | 618 key.Create(HKEY_CURRENT_USER, key_path.c_str(), KEY_WRITE)); |
618 key.WriteValue(L"Test1", 1); | 619 key.WriteValue(L"Test1", 1); |
619 | 620 |
620 importer::SourceProfile source_profile; | 621 importer::SourceProfile source_profile; |
621 source_profile.importer_type = importer::TYPE_IE; | 622 source_profile.importer_type = importer::TYPE_IE; |
622 source_profile.source_path = temp_dir_.path(); | 623 source_profile.source_path = temp_dir_.path(); |
623 | 624 |
624 host->StartImportSettings( | 625 host->StartImportSettings( |
625 source_profile, | 626 source_profile, |
626 browser()->profile(), | 627 browser()->profile(), |
627 importer::PASSWORDS, | 628 importer::PASSWORDS, |
628 observer); | 629 observer); |
629 base::MessageLoop::current()->Run(); | 630 base::RunLoop().Run(); |
630 } | 631 } |
631 | 632 |
632 IN_PROC_BROWSER_TEST_F(IEImporterBrowserTest, IEImporterHomePageTest) { | 633 IN_PROC_BROWSER_TEST_F(IEImporterBrowserTest, IEImporterHomePageTest) { |
633 // Starts to import the IE home page. | 634 // Starts to import the IE home page. |
634 // Deletes itself. | 635 // Deletes itself. |
635 ExternalProcessImporterHost* host = new ExternalProcessImporterHost; | 636 ExternalProcessImporterHost* host = new ExternalProcessImporterHost; |
636 TestObserver* observer = new TestObserver(importer::HOME_PAGE, | 637 TestObserver* observer = new TestObserver(importer::HOME_PAGE, |
637 TestObserver::IE6); | 638 TestObserver::IE6); |
638 host->set_observer(observer); | 639 host->set_observer(observer); |
639 | 640 |
640 base::string16 key_path(importer::GetIESettingsKey()); | 641 base::string16 key_path(importer::GetIESettingsKey()); |
641 base::win::RegKey key; | 642 base::win::RegKey key; |
642 ASSERT_EQ(ERROR_SUCCESS, | 643 ASSERT_EQ(ERROR_SUCCESS, |
643 key.Create(HKEY_CURRENT_USER, key_path.c_str(), KEY_WRITE)); | 644 key.Create(HKEY_CURRENT_USER, key_path.c_str(), KEY_WRITE)); |
644 key.WriteValue(L"Start Page", L"http://www.test.com/"); | 645 key.WriteValue(L"Start Page", L"http://www.test.com/"); |
645 | 646 |
646 importer::SourceProfile source_profile; | 647 importer::SourceProfile source_profile; |
647 source_profile.importer_type = importer::TYPE_IE; | 648 source_profile.importer_type = importer::TYPE_IE; |
648 source_profile.source_path = temp_dir_.path(); | 649 source_profile.source_path = temp_dir_.path(); |
649 | 650 |
650 host->StartImportSettings( | 651 host->StartImportSettings( |
651 source_profile, | 652 source_profile, |
652 browser()->profile(), | 653 browser()->profile(), |
653 importer::HOME_PAGE, | 654 importer::HOME_PAGE, |
654 observer); | 655 observer); |
655 base::MessageLoop::current()->Run(); | 656 base::RunLoop().Run(); |
656 } | 657 } |
657 | 658 |
OLD | NEW |