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 <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "components/webdata/encryptor/ie7_password.h" | 12 #include "components/webdata/encryptor/ie7_password.h" |
13 | 13 |
14 TEST(IEImporterTest, IE7Importer) { | 14 TEST(IE7PasswordTest, GetUserPassword) { |
15 // This is the unencrypted values of my keys under Storage2. | 15 // This is the unencrypted values of my keys under Storage2. |
16 // 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 |
17 // the same. | 17 // the same. |
18 unsigned char data1[] = "\x0c\x00\x00\x00\x38\x00\x00\x00\x2c\x00\x00\x00" | 18 unsigned char data1[] = "\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" | 19 "\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" | 20 "\x67\x00\x72\x00\x01\x00\x00\x00\x00\x00\x00\x00" |
21 "\x00\x00\x00\x00\x4e\xfa\x67\x76\x22\x94\xc8\x01" | 21 "\x00\x00\x00\x00\x4e\xfa\x67\x76\x22\x94\xc8\x01" |
22 "\x08\x00\x00\x00\x12\x00\x00\x00\x4e\xfa\x67\x76" | 22 "\x08\x00\x00\x00\x12\x00\x00\x00\x4e\xfa\x67\x76" |
23 "\x22\x94\xc8\x01\x0c\x00\x00\x00\x61\x00\x62\x00" | 23 "\x22\x94\xc8\x01\x0c\x00\x00\x00\x61\x00\x62\x00" |
24 "\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00" | 24 "\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00" |
(...skipping 26 matching lines...) Expand all Loading... |
51 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data1, &username, | 51 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data1, &username, |
52 &password)); | 52 &password)); |
53 EXPECT_EQ(L"abcdefgh", username); | 53 EXPECT_EQ(L"abcdefgh", username); |
54 EXPECT_EQ(L"abcdefghijkl", password); | 54 EXPECT_EQ(L"abcdefghijkl", password); |
55 | 55 |
56 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data2, &username, | 56 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data2, &username, |
57 &password)); | 57 &password)); |
58 EXPECT_EQ(L"abcdefghi", username); | 58 EXPECT_EQ(L"abcdefghi", username); |
59 EXPECT_EQ(L"abcdefg", password); | 59 EXPECT_EQ(L"abcdefg", password); |
60 } | 60 } |
OLD | NEW |