| OLD | NEW |
| 1 // Copyright (c) 2006-2008 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 "base/base64.h" | 5 #include "base/base64.h" |
| 6 |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 8 |
| 8 namespace { | 9 namespace base { |
| 9 | |
| 10 class Base64Test : public testing::Test { | |
| 11 }; | |
| 12 | |
| 13 } // namespace | |
| 14 | 10 |
| 15 TEST(Base64Test, Basic) { | 11 TEST(Base64Test, Basic) { |
| 16 const std::string kText = "hello world"; | 12 const std::string kText = "hello world"; |
| 17 const std::string kBase64Text = "aGVsbG8gd29ybGQ="; | 13 const std::string kBase64Text = "aGVsbG8gd29ybGQ="; |
| 18 | 14 |
| 19 std::string encoded, decoded; | 15 std::string encoded; |
| 16 std::string decoded; |
| 20 bool ok; | 17 bool ok; |
| 21 | 18 |
| 22 ok = base::Base64Encode(kText, &encoded); | 19 ok = Base64Encode(kText, &encoded); |
| 23 EXPECT_TRUE(ok); | 20 EXPECT_TRUE(ok); |
| 24 EXPECT_EQ(kBase64Text, encoded); | 21 EXPECT_EQ(kBase64Text, encoded); |
| 25 | 22 |
| 26 ok = base::Base64Decode(encoded, &decoded); | 23 ok = Base64Decode(encoded, &decoded); |
| 27 EXPECT_TRUE(ok); | 24 EXPECT_TRUE(ok); |
| 28 EXPECT_EQ(kText, decoded); | 25 EXPECT_EQ(kText, decoded); |
| 29 } | 26 } |
| 27 |
| 28 } // namespace base |
| OLD | NEW |