OLD | NEW |
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 // The order of these includes is important. | 7 // The order of these includes is important. |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <unknwn.h> | 9 #include <unknwn.h> |
10 #include <intshcut.h> | 10 #include <intshcut.h> |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 | 513 |
514 // IUrlHistoryStg2::AddUrl seems to reset the override. Ensure it here. | 514 // IUrlHistoryStg2::AddUrl seems to reset the override. Ensure it here. |
515 StartRegistryOverride(); | 515 StartRegistryOverride(); |
516 | 516 |
517 loop->PostTask(FROM_HERE, base::Bind( | 517 loop->PostTask(FROM_HERE, base::Bind( |
518 &ImporterHost::StartImportSettings, | 518 &ImporterHost::StartImportSettings, |
519 host.get(), | 519 host.get(), |
520 source_profile, | 520 source_profile, |
521 profile_.get(), | 521 profile_.get(), |
522 importer::HISTORY | importer::PASSWORDS | importer::FAVORITES, | 522 importer::HISTORY | importer::PASSWORDS | importer::FAVORITES, |
523 observer, | 523 observer)); |
524 true)); | |
525 loop->Run(); | 524 loop->Run(); |
526 | 525 |
527 // Cleans up. | 526 // Cleans up. |
528 url_history_stg2->DeleteUrl(kIEIdentifyUrl, 0); | 527 url_history_stg2->DeleteUrl(kIEIdentifyUrl, 0); |
529 url_history_stg2.Release(); | 528 url_history_stg2.Release(); |
530 } | 529 } |
531 | 530 |
532 TEST_F(IEImporterTest, IEImporterMalformedFavoritesRegistry) { | 531 TEST_F(IEImporterTest, IEImporterMalformedFavoritesRegistry) { |
533 // Sets up a favorites folder. | 532 // Sets up a favorites folder. |
534 base::win::ScopedCOMInitializer com_init; | 533 base::win::ScopedCOMInitializer com_init; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 importer::SourceProfile source_profile; | 591 importer::SourceProfile source_profile; |
593 source_profile.importer_type = importer::TYPE_IE; | 592 source_profile.importer_type = importer::TYPE_IE; |
594 source_profile.source_path = temp_dir_.path(); | 593 source_profile.source_path = temp_dir_.path(); |
595 | 594 |
596 loop->PostTask(FROM_HERE, base::Bind( | 595 loop->PostTask(FROM_HERE, base::Bind( |
597 &ImporterHost::StartImportSettings, | 596 &ImporterHost::StartImportSettings, |
598 host.get(), | 597 host.get(), |
599 source_profile, | 598 source_profile, |
600 profile_.get(), | 599 profile_.get(), |
601 importer::FAVORITES, | 600 importer::FAVORITES, |
602 observer, | 601 observer)); |
603 true)); | |
604 loop->Run(); | 602 loop->Run(); |
605 } | 603 } |
606 } | 604 } |
607 | 605 |
608 TEST_F(IEImporterTest, IE7Importer) { | 606 TEST_F(IEImporterTest, IE7Importer) { |
609 // This is the unencrypted values of my keys under Storage2. | 607 // This is the unencrypted values of my keys under Storage2. |
610 // The passwords have been manually changed to abcdef... but the size remains | 608 // The passwords have been manually changed to abcdef... but the size remains |
611 // the same. | 609 // the same. |
612 unsigned char data1[] = "\x0c\x00\x00\x00\x38\x00\x00\x00\x2c\x00\x00\x00" | 610 unsigned char data1[] = "\x0c\x00\x00\x00\x38\x00\x00\x00\x2c\x00\x00\x00" |
613 "\x57\x49\x43\x4b\x18\x00\x00\x00\x02\x00\x00\x00" | 611 "\x57\x49\x43\x4b\x18\x00\x00\x00\x02\x00\x00\x00" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data1, &username, | 643 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data1, &username, |
646 &password)); | 644 &password)); |
647 EXPECT_EQ(L"abcdefgh", username); | 645 EXPECT_EQ(L"abcdefgh", username); |
648 EXPECT_EQ(L"abcdefghijkl", password); | 646 EXPECT_EQ(L"abcdefghijkl", password); |
649 | 647 |
650 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data2, &username, | 648 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data2, &username, |
651 &password)); | 649 &password)); |
652 EXPECT_EQ(L"abcdefghi", username); | 650 EXPECT_EQ(L"abcdefghi", username); |
653 EXPECT_EQ(L"abcdefg", password); | 651 EXPECT_EQ(L"abcdefg", password); |
654 } | 652 } |
OLD | NEW |