blob: 1d11b1eb10850b3168b6dcbcbbc04f1c58c7f37b [file] [log] [blame]
license.botbf09a502008-08-24 00:55:551// Copyright (c) 2006-2008 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.
initial.commit586acc5fe2008-07-26 22:42:524
[email protected]978df342009-11-24 06:21:535#include "base/base64.h"
initial.commit586acc5fe2008-07-26 22:42:526#include "testing/gtest/include/gtest/gtest.h"
7
8namespace {
9
10class Base64Test : public testing::Test {
11};
12
13} // namespace
14
15TEST(Base64Test, Basic) {
16 const std::string kText = "hello world";
17 const std::string kBase64Text = "aGVsbG8gd29ybGQ=";
18
19 std::string encoded, decoded;
20 bool ok;
21
[email protected]978df342009-11-24 06:21:5322 ok = base::Base64Encode(kText, &encoded);
initial.commit586acc5fe2008-07-26 22:42:5223 EXPECT_TRUE(ok);
24 EXPECT_EQ(kBase64Text, encoded);
25
[email protected]978df342009-11-24 06:21:5326 ok = base::Base64Decode(encoded, &decoded);
initial.commit586acc5fe2008-07-26 22:42:5227 EXPECT_TRUE(ok);
28 EXPECT_EQ(kText, decoded);
29}