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

Unified Diff: chrome/browser/importer/firefox_importer_unittest.cc

Issue 174259: Recommit "Bring up Firefox Password Import Unittest on OS X." (Closed)
Patch Set: Created 11 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/importer/firefox_importer_unittest.cc
diff --git a/chrome/browser/importer/firefox_importer_unittest.cc b/chrome/browser/importer/firefox_importer_unittest.cc
index 1c0af23600b248e8d4b4109fc97e28e5000dbea3..e7e9470e8f3eae3332d4d99461ea4a15ee9db7de 100644
--- a/chrome/browser/importer/firefox_importer_unittest.cc
+++ b/chrome/browser/importer/firefox_importer_unittest.cc
@@ -8,46 +8,61 @@
#include "base/file_util.h"
#include "base/path_service.h"
#include "chrome/browser/importer/firefox2_importer.h"
+#include "chrome/browser/importer/firefox_importer_unittest_utils.h"
#include "chrome/browser/importer/firefox_importer_utils.h"
#include "chrome/browser/importer/nss_decryptor.h"
#include "chrome/common/chrome_paths.h"
using base::Time;
-// TODO(jeremy): Port NSSDecryptor to OSX and enable these tests.
-#if !defined(OS_MACOSX)
+// The following 2 tests require the use of the NSSDecryptor, on OSX this needs
+// to run in a separate process, so we use a proxy object so we can share the
+// same test between platforms.
TEST(FirefoxImporterTest, Firefox2NSS3Decryptor) {
std::wstring nss_path;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &nss_path));
+#ifdef OS_MACOSX
+ file_util::AppendToPath(&nss_path, L"firefox2_nss_mac");
+#else
file_util::AppendToPath(&nss_path, L"firefox2_nss");
+#endif // !OS_MACOSX
std::wstring db_path;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &db_path));
file_util::AppendToPath(&db_path, L"firefox2_profile");
- NSSDecryptor decryptor;
- EXPECT_TRUE(decryptor.Init(nss_path, db_path));
- EXPECT_EQ(L"hello", decryptor.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAE"
+
+ FFUnitTestDecryptorProxy decryptor_proxy;
+ ASSERT_TRUE(decryptor_proxy.Setup(nss_path));
+
+ EXPECT_TRUE(decryptor_proxy.DecryptorInit(nss_path, db_path));
+ EXPECT_EQ(L"hello", decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAE"
"wFAYIKoZIhvcNAwcECBJM63MpT9rtBAjMCm7qo/EhlA=="));
// Test UTF-16 encoding.
- EXPECT_EQ(L"\x4E2D", decryptor.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAE"
+ EXPECT_EQ(L"\x4E2D", decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAE"
"wFAYIKoZIhvcNAwcECN9OQ5ZFmhb8BAiFo1Z+fUvaIQ=="));
}
TEST(FirefoxImporterTest, Firefox3NSS3Decryptor) {
std::wstring nss_path;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &nss_path));
+#ifdef OS_MACOSX
+ file_util::AppendToPath(&nss_path, L"firefox3_nss_mac");
+#else
file_util::AppendToPath(&nss_path, L"firefox3_nss");
+#endif // !OS_MACOSX
std::wstring db_path;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &db_path));
file_util::AppendToPath(&db_path, L"firefox3_profile");
- NSSDecryptor decryptor;
- EXPECT_TRUE(decryptor.Init(nss_path, db_path));
- EXPECT_EQ(L"hello", decryptor.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAE"
+
+ FFUnitTestDecryptorProxy decryptor_proxy;
+ ASSERT_TRUE(decryptor_proxy.Setup(nss_path));
+
+ EXPECT_TRUE(decryptor_proxy.DecryptorInit(nss_path, db_path));
+ EXPECT_EQ(L"hello", decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAE"
"wFAYIKoZIhvcNAwcECKajtRg4qFSHBAhv9luFkXgDJA=="));
// Test UTF-16 encoding.
- EXPECT_EQ(L"\x4E2D", decryptor.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAE"
+ EXPECT_EQ(L"\x4E2D", decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAE"
"wFAYIKoZIhvcNAwcECLWqqiccfQHWBAie74hxnULxlw=="));
}
-#endif // !OS_MACOSX
TEST(FirefoxImporterTest, Firefox2BookmarkParse) {
bool result;
« no previous file with comments | « chrome/browser/importer/firefox3_importer.h ('k') | chrome/browser/importer/firefox_importer_unittest_messages_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698