blob: 9b23194ccf6587f20fafe549bfe97756a20dacaf [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]33fca122013-12-11 01:48:5019 Base64Encode(kText, &encoded);
initial.commit586acc5fe2008-07-26 22:42:5220 EXPECT_EQ(kBase64Text, encoded);
21
[email protected]24f111a2012-09-23 04:51:0422 ok = Base64Decode(encoded, &decoded);
initial.commit586acc5fe2008-07-26 22:42:5223 EXPECT_TRUE(ok);
24 EXPECT_EQ(kText, decoded);
25}
[email protected]24f111a2012-09-23 04:51:0426
27} // namespace base