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 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 Firefox3xImporterTest("firefox35_profile", observer.get(), observer.get(), | 491 Firefox3xImporterTest("firefox35_profile", observer.get(), observer.get(), |
492 import_search_engines); | 492 import_search_engines); |
493 } | 493 } |
494 | 494 |
495 // The following 2 tests require the use of the NSSDecryptor, on OSX this needs | 495 // The following 2 tests require the use of the NSSDecryptor, on OSX this needs |
496 // to run in a separate process, so we use a proxy object so we can share the | 496 // to run in a separate process, so we use a proxy object so we can share the |
497 // same test between platforms. | 497 // same test between platforms. |
498 TEST(FirefoxImporterTest, MAYBE_NSS(Firefox2NSS3Decryptor)) { | 498 TEST(FirefoxImporterTest, MAYBE_NSS(Firefox2NSS3Decryptor)) { |
499 base::FilePath nss_path; | 499 base::FilePath nss_path; |
500 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &nss_path)); | 500 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &nss_path)); |
501 #ifdef OS_MACOSX | 501 #if defined(OS_MACOSX) |
502 nss_path = nss_path.AppendASCII("firefox2_nss_mac"); | 502 nss_path = nss_path.AppendASCII("firefox2_nss_mac"); |
503 #else | 503 #else |
504 nss_path = nss_path.AppendASCII("firefox2_nss"); | 504 nss_path = nss_path.AppendASCII("firefox2_nss"); |
505 #endif // !OS_MACOSX | 505 #endif // !OS_MACOSX |
506 base::FilePath db_path; | 506 base::FilePath db_path; |
507 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &db_path)); | 507 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &db_path)); |
508 db_path = db_path.AppendASCII("firefox2_profile"); | 508 db_path = db_path.AppendASCII("firefox2_profile"); |
509 | 509 |
510 FFUnitTestDecryptorProxy decryptor_proxy; | 510 FFUnitTestDecryptorProxy decryptor_proxy; |
511 ASSERT_TRUE(decryptor_proxy.Setup(nss_path)); | 511 ASSERT_TRUE(decryptor_proxy.Setup(nss_path)); |
512 | 512 |
513 ASSERT_TRUE(decryptor_proxy.DecryptorInit(nss_path, db_path)); | 513 ASSERT_TRUE(decryptor_proxy.DecryptorInit(nss_path, db_path)); |
514 EXPECT_EQ(ASCIIToUTF16("hello"), | 514 EXPECT_EQ(ASCIIToUTF16("hello"), |
515 decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECBJ" | 515 decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECBJ" |
516 "M63MpT9rtBAjMCm7qo/EhlA==")); | 516 "M63MpT9rtBAjMCm7qo/EhlA==")); |
517 // Test UTF-16 encoding. | 517 // Test UTF-16 encoding. |
518 EXPECT_EQ(WideToUTF16(L"\x4E2D"), | 518 EXPECT_EQ(WideToUTF16(L"\x4E2D"), |
519 decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECN9" | 519 decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECN9" |
520 "OQ5ZFmhb8BAiFo1Z+fUvaIQ==")); | 520 "OQ5ZFmhb8BAiFo1Z+fUvaIQ==")); |
521 } | 521 } |
522 | 522 |
523 TEST(FirefoxImporterTest, MAYBE_NSS(Firefox3NSS3Decryptor)) { | 523 TEST(FirefoxImporterTest, MAYBE_NSS(Firefox3NSS3Decryptor)) { |
524 base::FilePath nss_path; | 524 base::FilePath nss_path; |
525 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &nss_path)); | 525 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &nss_path)); |
526 #ifdef OS_MACOSX | 526 #if defined(OS_MACOSX) |
527 nss_path = nss_path.AppendASCII("firefox3_nss_mac"); | 527 nss_path = nss_path.AppendASCII("firefox3_nss_mac"); |
528 #else | 528 #else |
529 nss_path = nss_path.AppendASCII("firefox3_nss"); | 529 nss_path = nss_path.AppendASCII("firefox3_nss"); |
530 #endif // !OS_MACOSX | 530 #endif // !OS_MACOSX |
531 base::FilePath db_path; | 531 base::FilePath db_path; |
532 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &db_path)); | 532 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &db_path)); |
533 db_path = db_path.AppendASCII("firefox3_profile"); | 533 db_path = db_path.AppendASCII("firefox3_profile"); |
534 | 534 |
535 FFUnitTestDecryptorProxy decryptor_proxy; | 535 FFUnitTestDecryptorProxy decryptor_proxy; |
536 ASSERT_TRUE(decryptor_proxy.Setup(nss_path)); | 536 ASSERT_TRUE(decryptor_proxy.Setup(nss_path)); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 EXPECT_EQ("http://www.tamurayukari.com/", entry.url.spec()); | 765 EXPECT_EQ("http://www.tamurayukari.com/", entry.url.spec()); |
766 EXPECT_EQ(0U, entry.path.size()); | 766 EXPECT_EQ(0U, entry.path.size()); |
767 entry = *it++; | 767 entry = *it++; |
768 EXPECT_EQ(ASCIIToUTF16("Google"), entry.title); | 768 EXPECT_EQ(ASCIIToUTF16("Google"), entry.title); |
769 EXPECT_EQ("http://www.google.com/", entry.url.spec()); | 769 EXPECT_EQ("http://www.google.com/", entry.url.spec()); |
770 EXPECT_EQ(0U, entry.path.size()); | 770 EXPECT_EQ(0U, entry.path.size()); |
771 } | 771 } |
772 | 772 |
773 importer->Release(); | 773 importer->Release(); |
774 } | 774 } |
OLD | NEW |