OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "net/base/pem_tokenizer.h" | 5 #include "net/cert/pem_tokenizer.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
11 TEST(PEMTokenizerTest, BasicParsing) { | 11 TEST(PEMTokenizerTest, BasicParsing) { |
12 const char data[] = | 12 const char data[] = |
13 "-----BEGIN EXPECTED-BLOCK-----\n" | 13 "-----BEGIN EXPECTED-BLOCK-----\n" |
14 "TWF0Y2hlc0FjY2VwdGVkQmxvY2tUeXBl\n" | 14 "TWF0Y2hlc0FjY2VwdGVkQmxvY2tUeXBl\n" |
15 "-----END EXPECTED-BLOCK-----\n"; | 15 "-----END EXPECTED-BLOCK-----\n"; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 PEMTokenizer tokenizer(string_piece, accepted_types); | 160 PEMTokenizer tokenizer(string_piece, accepted_types); |
161 EXPECT_TRUE(tokenizer.GetNext()); | 161 EXPECT_TRUE(tokenizer.GetNext()); |
162 | 162 |
163 EXPECT_EQ("BLOCK-ONE", tokenizer.block_type()); | 163 EXPECT_EQ("BLOCK-ONE", tokenizer.block_type()); |
164 EXPECT_EQ("EncodedDataTwo", tokenizer.data()); | 164 EXPECT_EQ("EncodedDataTwo", tokenizer.data()); |
165 | 165 |
166 EXPECT_FALSE(tokenizer.GetNext()); | 166 EXPECT_FALSE(tokenizer.GetNext()); |
167 } | 167 } |
168 | 168 |
169 } // namespace net | 169 } // namespace net |
OLD | NEW |