OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium 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 <limits> | 5 #include <limits> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "core/fpdfapi/fpdf_parser/cpdf_parser.h" | 8 #include "core/fpdfapi/fpdf_parser/cpdf_parser.h" |
9 #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" | 9 #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" |
10 #include "core/fxcrt/include/fx_ext.h" | 10 #include "core/fxcrt/fx_ext.h" |
11 #include "core/fxcrt/include/fx_stream.h" | 11 #include "core/fxcrt/fx_stream.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "testing/utils/path_service.h" | 13 #include "testing/utils/path_service.h" |
14 | 14 |
15 TEST(cpdf_syntax_parser, ReadHexString) { | 15 TEST(cpdf_syntax_parser, ReadHexString) { |
16 { | 16 { |
17 // Empty string. | 17 // Empty string. |
18 uint8_t data[] = ""; | 18 uint8_t data[] = ""; |
19 ScopedFileStream stream(FX_CreateMemoryStream(data, 0, FALSE)); | 19 ScopedFileStream stream(FX_CreateMemoryStream(data, 0, FALSE)); |
20 | 20 |
21 CPDF_SyntaxParser parser; | 21 CPDF_SyntaxParser parser; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // Just ending character. | 162 // Just ending character. |
163 uint8_t data[] = ">"; | 163 uint8_t data[] = ">"; |
164 ScopedFileStream stream(FX_CreateMemoryStream(data, 1, FALSE)); | 164 ScopedFileStream stream(FX_CreateMemoryStream(data, 1, FALSE)); |
165 | 165 |
166 CPDF_SyntaxParser parser; | 166 CPDF_SyntaxParser parser; |
167 parser.InitParser(stream.get(), 0); | 167 parser.InitParser(stream.get(), 0); |
168 EXPECT_EQ("", parser.ReadHexString()); | 168 EXPECT_EQ("", parser.ReadHexString()); |
169 EXPECT_EQ(1, parser.SavePos()); | 169 EXPECT_EQ(1, parser.SavePos()); |
170 } | 170 } |
171 } | 171 } |
OLD | NEW |