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 "chrome/browser/sync/util/data_encryption.h" | 5 #include "sync/util/data_encryption_win.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 using std::string; | 12 using std::string; |
13 using std::vector; | 13 using std::vector; |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 TEST(SyncDataEncryption, TestEncryptDecryptOfSampleString) { | 17 TEST(SyncDataEncryption, TestEncryptDecryptOfSampleString) { |
18 vector<uint8> example(EncryptData("example")); | 18 vector<uint8> example(EncryptData("example")); |
19 ASSERT_FALSE(example.empty()); | 19 ASSERT_FALSE(example.empty()); |
20 string result; | 20 string result; |
21 ASSERT_TRUE(DecryptData(example, &result)); | 21 ASSERT_TRUE(DecryptData(example, &result)); |
22 ASSERT_TRUE(result == "example"); | 22 ASSERT_TRUE(result == "example"); |
23 } | 23 } |
24 | 24 |
25 TEST(SyncDataEncryption, TestDecryptFailure) { | 25 TEST(SyncDataEncryption, TestDecryptFailure) { |
26 vector<uint8> example(0, 0); | 26 vector<uint8> example(0, 0); |
27 string result; | 27 string result; |
28 ASSERT_FALSE(DecryptData(example, &result)); | 28 ASSERT_FALSE(DecryptData(example, &result)); |
29 } | 29 } |
30 | 30 |
31 } // namespace | 31 } // namespace |
OLD | NEW |