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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 // The following test verifies proper detection of authentication scheme in | 57 // The following test verifies proper detection of authentication scheme in |
58 // firefox's signons db. We insert two entries into moz_logins table. The first | 58 // firefox's signons db. We insert two entries into moz_logins table. The first |
59 // has httpRealm column filled with non-empty string, therefore resulting | 59 // has httpRealm column filled with non-empty string, therefore resulting |
60 // PasswordForm should have SCHEME_BASIC in scheme. The second entry has NULL | 60 // PasswordForm should have SCHEME_BASIC in scheme. The second entry has NULL |
61 // httpRealm, so it should produce a SCHEME_HTML PasswordForm. | 61 // httpRealm, so it should produce a SCHEME_HTML PasswordForm. |
62 TEST(FirefoxImporterTest, MAYBE_NSS(FirefoxNSSDecryptorDeduceAuthScheme)) { | 62 TEST(FirefoxImporterTest, MAYBE_NSS(FirefoxNSSDecryptorDeduceAuthScheme)) { |
63 base::ScopedTempDir temp_dir; | 63 base::ScopedTempDir temp_dir; |
64 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 64 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
65 base::FilePath signons_path = temp_dir.path().AppendASCII("signons.sqlite"); | 65 base::FilePath signons_path = |
| 66 temp_dir.GetPath().AppendASCII("signons.sqlite"); |
66 sql::Connection db_conn; | 67 sql::Connection db_conn; |
67 | 68 |
68 ASSERT_TRUE(db_conn.Open(signons_path)); | 69 ASSERT_TRUE(db_conn.Open(signons_path)); |
69 | 70 |
70 ASSERT_TRUE(db_conn.Execute( | 71 ASSERT_TRUE(db_conn.Execute( |
71 "CREATE TABLE moz_logins (id INTEGER PRIMARY KEY, hostname TEXT NOT " | 72 "CREATE TABLE moz_logins (id INTEGER PRIMARY KEY, hostname TEXT NOT " |
72 "NULL, httpRealm TEXT, formSubmitURL TEXT, usernameField TEXT NOT NULL," | 73 "NULL, httpRealm TEXT, formSubmitURL TEXT, usernameField TEXT NOT NULL," |
73 "passwordField TEXT NOT NULL, encryptedUsername TEXT NOT NULL," | 74 "passwordField TEXT NOT NULL, encryptedUsername TEXT NOT NULL," |
74 "encryptedPassword TEXT NOT NULL, guid TEXT, encType INTEGER," | 75 "encryptedPassword TEXT NOT NULL, guid TEXT, encType INTEGER," |
75 "timeCreated INTEGER, timeLastUsed INTEGER, timePasswordChanged " | 76 "timeCreated INTEGER, timeLastUsed INTEGER, timePasswordChanged " |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ASSERT_TRUE(decryptor_proxy.Setup(nss_path)); | 108 ASSERT_TRUE(decryptor_proxy.Setup(nss_path)); |
108 | 109 |
109 ASSERT_TRUE(decryptor_proxy.DecryptorInit(nss_path, db_path)); | 110 ASSERT_TRUE(decryptor_proxy.DecryptorInit(nss_path, db_path)); |
110 std::vector<autofill::PasswordForm> forms = | 111 std::vector<autofill::PasswordForm> forms = |
111 decryptor_proxy.ParseSignons(signons_path); | 112 decryptor_proxy.ParseSignons(signons_path); |
112 | 113 |
113 ASSERT_EQ(2u, forms.size()); | 114 ASSERT_EQ(2u, forms.size()); |
114 EXPECT_EQ(autofill::PasswordForm::SCHEME_BASIC, forms[0].scheme); | 115 EXPECT_EQ(autofill::PasswordForm::SCHEME_BASIC, forms[0].scheme); |
115 EXPECT_EQ(autofill::PasswordForm::SCHEME_HTML, forms[1].scheme); | 116 EXPECT_EQ(autofill::PasswordForm::SCHEME_HTML, forms[1].scheme); |
116 } | 117 } |
OLD | NEW |