summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorChris Palmer <palmer@chromium.org>2017-04-06 14:45:39 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-06 23:40:27 +0000
commit2b797295d6851b3189bcb38c5994074f36453865 (patch)
tree90f119d1b1bff860e265c13919e19410282b6bda /xfa
parent8a24b25ee0b08128b28dfae0ee86b8348a51b40b (diff)
downloadpdfium-2b797295d6851b3189bcb38c5994074f36453865.tar.xz
Fix unit tests to initialize PartitionAlloc.
Tests need to be subclasses of FPDF_Test. BUG=pdfium:700 Change-Id: I317ec2c49567e58cb57c6222e387574226f594b3 Reviewed-on: https://pdfium-review.googlesource.com/3890 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Chris Palmer <palmer@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/css/cfde_cssdeclaration_unittest.cpp7
-rw-r--r--xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp11
-rw-r--r--xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp33
-rw-r--r--xfa/fxfa/cxfa_ffapp_unittest.cpp (renamed from xfa/fxfa/cxfa_ffapp_unitest.cpp)9
-rw-r--r--xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp5
-rw-r--r--xfa/fxfa/parser/xfa_utils_unittest.cpp7
6 files changed, 45 insertions, 27 deletions
diff --git a/xfa/fde/css/cfde_cssdeclaration_unittest.cpp b/xfa/fde/css/cfde_cssdeclaration_unittest.cpp
index 48a3c72c39..80cd72c4d3 100644
--- a/xfa/fde/css/cfde_cssdeclaration_unittest.cpp
+++ b/xfa/fde/css/cfde_cssdeclaration_unittest.cpp
@@ -5,8 +5,11 @@
#include "xfa/fde/css/cfde_cssdeclaration.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/test_support.h"
-TEST(CFDE_CSSDecalration, HexEncodingParsing) {
+class CFDE_CSSDecalrationTest : public pdfium::FPDF_Test {};
+
+TEST_F(CFDE_CSSDecalrationTest, HexEncodingParsing) {
FX_ARGB color;
// Length value invalid.
@@ -42,7 +45,7 @@ TEST(CFDE_CSSDecalration, HexEncodingParsing) {
EXPECT_EQ(60, FXARGB_B(color));
}
-TEST(CFDE_CSSDecalration, RGBEncodingParsing) {
+TEST_F(CFDE_CSSDecalrationTest, RGBEncodingParsing) {
FX_ARGB color;
// Invalid input for rgb() syntax.
diff --git a/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp b/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp
index 2864c842ad..077fb54e93 100644
--- a/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp
+++ b/xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp
@@ -7,9 +7,12 @@
#include "xfa/fde/css/cfde_cssvaluelistparser.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/test_support.h"
#include "third_party/base/ptr_util.h"
-TEST(CFDE_CSSValueListParser, rgb_short) {
+class CFDE_CSSValueListParserTest : public pdfium::FPDF_Test {};
+
+TEST_F(CFDE_CSSValueListParserTest, rgb_short) {
FDE_CSSPrimitiveType type;
const wchar_t* start;
int32_t len;
@@ -40,7 +43,7 @@ TEST(CFDE_CSSValueListParser, rgb_short) {
EXPECT_FALSE(parser->NextValue(type, start, len));
}
-TEST(CFDE_CSSValueListParser, number_parsing) {
+TEST_F(CFDE_CSSValueListParserTest, number_parsing) {
FDE_CSSPrimitiveType type;
const wchar_t* start;
int32_t len;
@@ -82,7 +85,7 @@ TEST(CFDE_CSSValueListParser, number_parsing) {
EXPECT_EQ(L"43a1.12.34", CFX_WideString(start, len));
}
-TEST(CFDE_CSSValueListParser, string_parsing) {
+TEST_F(CFDE_CSSValueListParserTest, string_parsing) {
FDE_CSSPrimitiveType type;
const wchar_t* start;
int32_t len;
@@ -105,7 +108,7 @@ TEST(CFDE_CSSValueListParser, string_parsing) {
EXPECT_EQ(L"standalone", CFX_WideString(start, len));
}
-TEST(CFDE_CSSValueListParser, multiparsing) {
+TEST_F(CFDE_CSSValueListParserTest, multiparsing) {
FDE_CSSPrimitiveType type;
const wchar_t* start;
int32_t len;
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
index e54b2cecaf..66f4bbf928 100644
--- a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
+++ b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
@@ -7,9 +7,12 @@
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/test_support.h"
#include "xfa/fgas/crt/ifgas_stream.h"
-TEST(CFDE_XMLSyntaxParser, CData) {
+class CFDE_XMLSyntaxParserTest : public pdfium::FPDF_Test {};
+
+TEST_F(CFDE_XMLSyntaxParserTest, CData) {
const wchar_t* input =
L"<script contentType=\"application/x-javascript\">\n"
L" <![CDATA[\n"
@@ -54,7 +57,7 @@ TEST(CFDE_XMLSyntaxParser, CData) {
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST(CFDE_XMLSyntaxParser, CDataWithInnerScript) {
+TEST_F(CFDE_XMLSyntaxParserTest, CDataWithInnerScript) {
const wchar_t* input =
L"<script contentType=\"application/x-javascript\">\n"
L" <![CDATA[\n"
@@ -101,7 +104,7 @@ TEST(CFDE_XMLSyntaxParser, CDataWithInnerScript) {
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST(CFDE_XMLSyntaxParser, ArrowBangArrow) {
+TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangArrow) {
const wchar_t* input =
L"<script contentType=\"application/x-javascript\">\n"
L" <!>\n"
@@ -135,7 +138,7 @@ TEST(CFDE_XMLSyntaxParser, ArrowBangArrow) {
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST(CFDE_XMLSyntaxParser, ArrowBangBracketArrow) {
+TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangBracketArrow) {
const wchar_t* input =
L"<script contentType=\"application/x-javascript\">\n"
L" <![>\n"
@@ -164,7 +167,7 @@ TEST(CFDE_XMLSyntaxParser, ArrowBangBracketArrow) {
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST(CFDE_XMLSyntaxParser, IncompleteCData) {
+TEST_F(CFDE_XMLSyntaxParserTest, IncompleteCData) {
const wchar_t* input =
L"<script contentType=\"application/x-javascript\">\n"
L" <![CDATA>\n"
@@ -193,7 +196,7 @@ TEST(CFDE_XMLSyntaxParser, IncompleteCData) {
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST(CFDE_XMLSyntaxParser, UnClosedCData) {
+TEST_F(CFDE_XMLSyntaxParserTest, UnClosedCData) {
const wchar_t* input =
L"<script contentType=\"application/x-javascript\">\n"
L" <![CDATA[\n"
@@ -222,7 +225,7 @@ TEST(CFDE_XMLSyntaxParser, UnClosedCData) {
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST(CFDE_XMLSyntaxParser, EmptyCData) {
+TEST_F(CFDE_XMLSyntaxParserTest, EmptyCData) {
const wchar_t* input =
L"<script contentType=\"application/x-javascript\">\n"
L" <![CDATA[]]>\n"
@@ -258,7 +261,7 @@ TEST(CFDE_XMLSyntaxParser, EmptyCData) {
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST(CFDE_XMLSyntaxParser, Comment) {
+TEST_F(CFDE_XMLSyntaxParserTest, Comment) {
const wchar_t* input =
L"<script contentType=\"application/x-javascript\">\n"
L" <!-- A Comment -->\n"
@@ -291,7 +294,7 @@ TEST(CFDE_XMLSyntaxParser, Comment) {
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST(CFDE_XMLSyntaxParser, IncorrectCommentStart) {
+TEST_F(CFDE_XMLSyntaxParserTest, IncorrectCommentStart) {
const wchar_t* input =
L"<script contentType=\"application/x-javascript\">\n"
L" <!- A Comment -->\n"
@@ -324,7 +327,7 @@ TEST(CFDE_XMLSyntaxParser, IncorrectCommentStart) {
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST(CFDE_XMLSyntaxParser, CommentEmpty) {
+TEST_F(CFDE_XMLSyntaxParserTest, CommentEmpty) {
const wchar_t* input =
L"<script contentType=\"application/x-javascript\">\n"
L" <!---->\n"
@@ -357,7 +360,7 @@ TEST(CFDE_XMLSyntaxParser, CommentEmpty) {
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST(CFDE_XMLSyntaxParser, CommentThreeDash) {
+TEST_F(CFDE_XMLSyntaxParserTest, CommentThreeDash) {
const wchar_t* input =
L"<script contentType=\"application/x-javascript\">\n"
L" <!--->\n"
@@ -384,7 +387,7 @@ TEST(CFDE_XMLSyntaxParser, CommentThreeDash) {
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST(CFDE_XMLSyntaxParser, CommentTwoDash) {
+TEST_F(CFDE_XMLSyntaxParserTest, CommentTwoDash) {
const wchar_t* input =
L"<script contentType=\"application/x-javascript\">\n"
L" <!-->\n"
@@ -411,7 +414,7 @@ TEST(CFDE_XMLSyntaxParser, CommentTwoDash) {
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST(CFDE_XMLSyntaxParser, Entities) {
+TEST_F(CFDE_XMLSyntaxParserTest, Entities) {
const wchar_t* input =
L"<script contentType=\"application/x-javascript\">"
L"&#66;"
@@ -445,7 +448,7 @@ TEST(CFDE_XMLSyntaxParser, Entities) {
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST(CFDE_XMLSyntaxParser, EntityOverflowHex) {
+TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowHex) {
const wchar_t* input =
L"<script contentType=\"application/x-javascript\">"
L"&#xaDBDFFFFF;"
@@ -476,7 +479,7 @@ TEST(CFDE_XMLSyntaxParser, EntityOverflowHex) {
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST(CFDE_XMLSyntaxParser, EntityOverflowDecimal) {
+TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowDecimal) {
const wchar_t* input =
L"<script contentType=\"application/x-javascript\">"
L"&#2914910205;"
diff --git a/xfa/fxfa/cxfa_ffapp_unitest.cpp b/xfa/fxfa/cxfa_ffapp_unittest.cpp
index e8accdfeb2..4d65ccbb2f 100644
--- a/xfa/fxfa/cxfa_ffapp_unitest.cpp
+++ b/xfa/fxfa/cxfa_ffapp_unittest.cpp
@@ -11,9 +11,12 @@
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fxcrt/fx_memory.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/test_support.h"
#include "third_party/base/ptr_util.h"
-TEST(CXFAFileRead, NoStreams) {
+class CXFAFileReadTest : public pdfium::FPDF_Test {};
+
+TEST_F(CXFAFileReadTest, NoStreams) {
std::vector<CPDF_Stream*> streams;
CFX_RetainPtr<IFX_SeekableReadStream> fileread =
MakeSeekableReadStream(streams);
@@ -24,7 +27,7 @@ TEST(CXFAFileRead, NoStreams) {
EXPECT_EQ(0xbd, output_buffer[0]);
}
-TEST(CXFAFileRead, EmptyStreams) {
+TEST_F(CXFAFileReadTest, EmptyStreams) {
std::vector<CPDF_Stream*> streams;
auto stream1 = pdfium::MakeUnique<CPDF_Stream>();
streams.push_back(stream1.get());
@@ -37,7 +40,7 @@ TEST(CXFAFileRead, EmptyStreams) {
EXPECT_EQ(0xbd, output_buffer[0]);
}
-TEST(CXFAFileRead, NormalStreams) {
+TEST_F(CXFAFileReadTest, NormalStreams) {
std::vector<CPDF_Stream*> streams;
auto stream1 = pdfium::MakeUnique<CPDF_Stream>();
auto stream2 = pdfium::MakeUnique<CPDF_Stream>();
diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp
index 7826d9b53c..a2c7f1b878 100644
--- a/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp
+++ b/xfa/fxfa/fm2js/xfa_simpleexpression_unittest.cpp
@@ -8,10 +8,13 @@
#include <utility>
#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/test_support.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fxfa/fm2js/xfa_lexer.h"
-TEST(FMCallExpression, more_than_32_arguments) {
+class FMCallExpressionTest : public pdfium::FPDF_Test {};
+
+TEST_F(FMCallExpressionTest, more_than_32_arguments) {
// Use sign as it has 3 object parameters at positions 0, 5, and 6.
auto exp = pdfium::MakeUnique<CXFA_FMIdentifierExpression>(0, L"sign");
diff --git a/xfa/fxfa/parser/xfa_utils_unittest.cpp b/xfa/fxfa/parser/xfa_utils_unittest.cpp
index c39ed69306..e4dd09419e 100644
--- a/xfa/fxfa/parser/xfa_utils_unittest.cpp
+++ b/xfa/fxfa/parser/xfa_utils_unittest.cpp
@@ -8,9 +8,12 @@
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/test_support.h"
#include "third_party/base/ptr_util.h"
-TEST(XfaUtilsImp, XFA_MapRotation) {
+class XfaUtilsImpTest : public pdfium::FPDF_Test {};
+
+TEST_F(XfaUtilsImpTest, XFA_MapRotation) {
struct TestCase {
int input;
int expected_output;
@@ -26,7 +29,7 @@ TEST(XfaUtilsImp, XFA_MapRotation) {
}
}
-class XFANodeIteratorTest : public testing::Test {
+class XFANodeIteratorTest : public pdfium::FPDF_Test {
public:
class Node {
public: