1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "chrome/browser/sync/util/data_encryption.h" 6 7 #include <string> 8 #include <vector> 9 10 #include "testing/gtest/include/gtest/gtest.h" 11 12 using std::string; 13 using std::vector; 14 15 namespace { 16 17 TEST(DataEncryption, TestEncryptDecryptOfSampleString) { 18 vector<uint8> example(EncryptData("example")); 19 ASSERT_FALSE(example.empty()); 20 string result; 21 ASSERT_TRUE(DecryptData(example, &result)); 22 ASSERT_TRUE(result == "example"); 23 } 24 25 TEST(DataEncryption, TestDecryptFailure) { 26 vector<uint8> example(0, 0); 27 string result; 28 ASSERT_FALSE(DecryptData(example, &result)); 29 } 30 31 } // namespace 32