blob: 9a5dd818e069a52fe5ee7463ddda6817c80022e8 [file] [log] [blame]
[email protected]24f111a2012-09-23 04:51:041// Copyright (c) 2012 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit586acc5fe2008-07-26 22:42:524
[email protected]978df342009-11-24 06:21:535#include "base/base64.h"
[email protected]24f111a2012-09-23 04:51:046
initial.commit586acc5fe2008-07-26 22:42:527#include "testing/gtest/include/gtest/gtest.h"
8
[email protected]24f111a2012-09-23 04:51:049namespace base {
initial.commit586acc5fe2008-07-26 22:42:5210
11TEST(Base64Test, Basic) {
12 const std::string kText = "hello world";
13 const std::string kBase64Text = "aGVsbG8gd29ybGQ=";
14
[email protected]24f111a2012-09-23 04:51:0415 std::string encoded;
16 std::string decoded;
initial.commit586acc5fe2008-07-26 22:42:5217 bool ok;
18
[email protected]24f111a2012-09-23 04:51:0419 ok = Base64Encode(kText, &encoded);
initial.commit586acc5fe2008-07-26 22:42:5220 EXPECT_TRUE(ok);
21 EXPECT_EQ(kBase64Text, encoded);
22
[email protected]24f111a2012-09-23 04:51:0423 ok = Base64Decode(encoded, &decoded);
initial.commit586acc5fe2008-07-26 22:42:5224 EXPECT_TRUE(ok);
25 EXPECT_EQ(kText, decoded);
26}
[email protected]24f111a2012-09-23 04:51:0427
28} // namespace base