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