Index: core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp |
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp |
index f94b431c82f721c4ac349c392bac6bd22b612a24..faaa83dd1967b3c511158fdf1a7d97ded24b31fb 100644 |
--- a/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp |
+++ b/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp |
@@ -16,10 +16,8 @@ TEST(cpdf_syntax_parser, ReadHexString) { |
{ |
// Empty string. |
uint8_t data[] = ""; |
- ScopedFileStream stream(IFX_MemoryStream::Create(data, 0, false)); |
- |
CPDF_SyntaxParser parser; |
- parser.InitParser(stream.get(), 0); |
+ parser.InitParser(IFX_MemoryStream::Create(data, 0, false), 0); |
EXPECT_EQ("", parser.ReadHexString()); |
EXPECT_EQ(0, parser.SavePos()); |
} |
@@ -27,10 +25,8 @@ TEST(cpdf_syntax_parser, ReadHexString) { |
{ |
// Blank string. |
uint8_t data[] = " "; |
- ScopedFileStream stream(IFX_MemoryStream::Create(data, 2, false)); |
- |
CPDF_SyntaxParser parser; |
- parser.InitParser(stream.get(), 0); |
+ parser.InitParser(IFX_MemoryStream::Create(data, 2, false), 0); |
EXPECT_EQ("", parser.ReadHexString()); |
EXPECT_EQ(2, parser.SavePos()); |
} |
@@ -38,10 +34,8 @@ TEST(cpdf_syntax_parser, ReadHexString) { |
{ |
// Skips unknown characters. |
uint8_t data[] = "z12b"; |
- ScopedFileStream stream(IFX_MemoryStream::Create(data, 4, false)); |
- |
CPDF_SyntaxParser parser; |
- parser.InitParser(stream.get(), 0); |
+ parser.InitParser(IFX_MemoryStream::Create(data, 4, false), 0); |
EXPECT_EQ("\x12\xb0", parser.ReadHexString()); |
EXPECT_EQ(4, parser.SavePos()); |
} |
@@ -49,10 +43,8 @@ TEST(cpdf_syntax_parser, ReadHexString) { |
{ |
// Skips unknown characters. |
uint8_t data[] = "*<&*#$^&@1"; |
- ScopedFileStream stream(IFX_MemoryStream::Create(data, 10, false)); |
- |
CPDF_SyntaxParser parser; |
- parser.InitParser(stream.get(), 0); |
+ parser.InitParser(IFX_MemoryStream::Create(data, 10, false), 0); |
EXPECT_EQ("\x10", parser.ReadHexString()); |
EXPECT_EQ(10, parser.SavePos()); |
} |
@@ -60,10 +52,8 @@ TEST(cpdf_syntax_parser, ReadHexString) { |
{ |
// Skips unknown characters. |
uint8_t data[] = "\x80zab"; |
- ScopedFileStream stream(IFX_MemoryStream::Create(data, 4, false)); |
- |
CPDF_SyntaxParser parser; |
- parser.InitParser(stream.get(), 0); |
+ parser.InitParser(IFX_MemoryStream::Create(data, 4, false), 0); |
EXPECT_EQ("\xab", parser.ReadHexString()); |
EXPECT_EQ(4, parser.SavePos()); |
} |
@@ -71,10 +61,8 @@ TEST(cpdf_syntax_parser, ReadHexString) { |
{ |
// Skips unknown characters. |
uint8_t data[] = "\xffzab"; |
- ScopedFileStream stream(IFX_MemoryStream::Create(data, 4, false)); |
- |
CPDF_SyntaxParser parser; |
- parser.InitParser(stream.get(), 0); |
+ parser.InitParser(IFX_MemoryStream::Create(data, 4, false), 0); |
EXPECT_EQ("\xab", parser.ReadHexString()); |
EXPECT_EQ(4, parser.SavePos()); |
} |
@@ -82,10 +70,8 @@ TEST(cpdf_syntax_parser, ReadHexString) { |
{ |
// Regular conversion. |
uint8_t data[] = "1A2b>abcd"; |
- ScopedFileStream stream(IFX_MemoryStream::Create(data, 9, false)); |
- |
CPDF_SyntaxParser parser; |
- parser.InitParser(stream.get(), 0); |
+ parser.InitParser(IFX_MemoryStream::Create(data, 9, false), 0); |
EXPECT_EQ("\x1a\x2b", parser.ReadHexString()); |
EXPECT_EQ(5, parser.SavePos()); |
} |
@@ -93,10 +79,8 @@ TEST(cpdf_syntax_parser, ReadHexString) { |
{ |
// Position out of bounds. |
uint8_t data[] = "12ab>"; |
- ScopedFileStream stream(IFX_MemoryStream::Create(data, 5, false)); |
- |
CPDF_SyntaxParser parser; |
- parser.InitParser(stream.get(), 0); |
+ parser.InitParser(IFX_MemoryStream::Create(data, 5, false), 0); |
parser.RestorePos(5); |
EXPECT_EQ("", parser.ReadHexString()); |
@@ -117,10 +101,8 @@ TEST(cpdf_syntax_parser, ReadHexString) { |
{ |
// Missing ending >. |
uint8_t data[] = "1A2b"; |
- ScopedFileStream stream(IFX_MemoryStream::Create(data, 4, false)); |
- |
CPDF_SyntaxParser parser; |
- parser.InitParser(stream.get(), 0); |
+ parser.InitParser(IFX_MemoryStream::Create(data, 4, false), 0); |
EXPECT_EQ("\x1a\x2b", parser.ReadHexString()); |
EXPECT_EQ(4, parser.SavePos()); |
} |
@@ -128,10 +110,8 @@ TEST(cpdf_syntax_parser, ReadHexString) { |
{ |
// Missing ending >. |
uint8_t data[] = "12abz"; |
- ScopedFileStream stream(IFX_MemoryStream::Create(data, 5, false)); |
- |
CPDF_SyntaxParser parser; |
- parser.InitParser(stream.get(), 0); |
+ parser.InitParser(IFX_MemoryStream::Create(data, 5, false), 0); |
EXPECT_EQ("\x12\xab", parser.ReadHexString()); |
EXPECT_EQ(5, parser.SavePos()); |
} |
@@ -139,10 +119,8 @@ TEST(cpdf_syntax_parser, ReadHexString) { |
{ |
// Uneven number of bytes. |
uint8_t data[] = "1A2>asdf"; |
- ScopedFileStream stream(IFX_MemoryStream::Create(data, 8, false)); |
- |
CPDF_SyntaxParser parser; |
- parser.InitParser(stream.get(), 0); |
+ parser.InitParser(IFX_MemoryStream::Create(data, 8, false), 0); |
EXPECT_EQ("\x1a\x20", parser.ReadHexString()); |
EXPECT_EQ(4, parser.SavePos()); |
} |
@@ -150,10 +128,8 @@ TEST(cpdf_syntax_parser, ReadHexString) { |
{ |
// Uneven number of bytes. |
uint8_t data[] = "1A2zasdf"; |
- ScopedFileStream stream(IFX_MemoryStream::Create(data, 8, false)); |
- |
CPDF_SyntaxParser parser; |
- parser.InitParser(stream.get(), 0); |
+ parser.InitParser(IFX_MemoryStream::Create(data, 8, false), 0); |
EXPECT_EQ("\x1a\x2a\xdf", parser.ReadHexString()); |
EXPECT_EQ(8, parser.SavePos()); |
} |
@@ -161,10 +137,8 @@ TEST(cpdf_syntax_parser, ReadHexString) { |
{ |
// Just ending character. |
uint8_t data[] = ">"; |
- ScopedFileStream stream(IFX_MemoryStream::Create(data, 1, false)); |
- |
CPDF_SyntaxParser parser; |
- parser.InitParser(stream.get(), 0); |
+ parser.InitParser(IFX_MemoryStream::Create(data, 1, false), 0); |
EXPECT_EQ("", parser.ReadHexString()); |
EXPECT_EQ(1, parser.SavePos()); |
} |