OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/proximity_auth/base64url.h" | 5 #include "components/proximity_auth/base64url.h" |
Ilya Sherman
2015/04/08 18:24:32
Here too.
Tim Song
2015/04/08 21:31:38
Done.
| |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace proximity_auth { | 10 namespace proximity_auth { |
11 | 11 |
12 TEST(ProximityAuthBase64UrlTest, EncodeRegularString) { | 12 TEST(ProximityAuthBase64UrlTest, EncodeRegularString) { |
13 const std::string input = "Hello world!"; | 13 const std::string input = "Hello world!"; |
14 const std::string expected_output = "SGVsbG8gd29ybGQh"; | 14 const std::string expected_output = "SGVsbG8gd29ybGQh"; |
15 | 15 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 ASSERT_TRUE(Base64UrlDecode(encoded, &decoded)); | 58 ASSERT_TRUE(Base64UrlDecode(encoded, &decoded)); |
59 | 59 |
60 // Decoded strings that encode to special characters are non-printable, so, | 60 // Decoded strings that encode to special characters are non-printable, so, |
61 // for ease of testing, just compare the web-safe and non-web-safe encodings. | 61 // for ease of testing, just compare the web-safe and non-web-safe encodings. |
62 std::string non_web_safe_encoded; | 62 std::string non_web_safe_encoded; |
63 base::Base64Encode(decoded, &non_web_safe_encoded); | 63 base::Base64Encode(decoded, &non_web_safe_encoded); |
64 EXPECT_EQ("/+Y=", non_web_safe_encoded); | 64 EXPECT_EQ("/+Y=", non_web_safe_encoded); |
65 } | 65 } |
66 | 66 |
67 } // namespace proximity_auth | 67 } // namespace proximity_auth |
OLD | NEW |