OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/os_crypt/ie7_password_win.h" | 5 #include "components/os_crypt/ie7_password_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "base/macros.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 | 13 |
13 TEST(IE7PasswordTest, GetUserPassword) { | 14 TEST(IE7PasswordTest, GetUserPassword) { |
14 // This is the unencrypted values of my keys under Storage2. | 15 // This is the unencrypted values of my keys under Storage2. |
15 // The passwords have been manually changed to abcdef... but the size remains | 16 // The passwords have been manually changed to abcdef... but the size remains |
16 // the same. | 17 // the same. |
17 const unsigned char kData1[] = | 18 const unsigned char kData1[] = |
18 "\x0c\x00\x00\x00\x38\x00\x00\x00\x2c\x00\x00\x00" | 19 "\x0c\x00\x00\x00\x38\x00\x00\x00\x2c\x00\x00\x00" |
19 "\x57\x49\x43\x4b\x18\x00\x00\x00\x02\x00\x00\x00" | 20 "\x57\x49\x43\x4b\x18\x00\x00\x00\x02\x00\x00\x00" |
20 "\x67\x00\x72\x00\x01\x00\x00\x00\x00\x00\x00\x00" | 21 "\x67\x00\x72\x00\x01\x00\x00\x00\x00\x00\x00\x00" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 std::vector<ie7_password::DecryptedCredentials> credentials; | 82 std::vector<ie7_password::DecryptedCredentials> credentials; |
82 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data, &credentials)); | 83 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data, &credentials)); |
83 ASSERT_EQ(3u, credentials.size()); | 84 ASSERT_EQ(3u, credentials.size()); |
84 EXPECT_EQ(L"qwer", credentials[0].username); | 85 EXPECT_EQ(L"qwer", credentials[0].username); |
85 EXPECT_EQ(L"qwerty", credentials[0].password); | 86 EXPECT_EQ(L"qwerty", credentials[0].password); |
86 EXPECT_EQ(L"asdf", credentials[1].username); | 87 EXPECT_EQ(L"asdf", credentials[1].username); |
87 EXPECT_EQ(L"asdfgh", credentials[1].password); | 88 EXPECT_EQ(L"asdfgh", credentials[1].password); |
88 EXPECT_EQ(L"zxcv", credentials[2].username); | 89 EXPECT_EQ(L"zxcv", credentials[2].username); |
89 EXPECT_EQ(L"zxcvbn", credentials[2].password); | 90 EXPECT_EQ(L"zxcvbn", credentials[2].password); |
90 } | 91 } |
OLD | NEW |