diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-12-13 18:05:38 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-12-13 18:05:38 +0000 |
commit | e03171e52ec4232369ab3b46e11d3a0abe1eb630 (patch) | |
tree | 6a57f6a0948032e6ec387c22d8b462215e6ca1e4 /xfa/fxfa/cxfa_textparser_unittest.cpp | |
parent | 8bbfdf2fca7197a0eccfef7b6fc27c590a44e7f7 (diff) | |
parent | 326d96bf5d52fdcf790b467b13f58ba3df3e81e4 (diff) | |
download | pdfium-e03171e52ec4232369ab3b46e11d3a0abe1eb630.tar.gz |
Merge cherrypicks of ['googleplex-android-review.googlesource.com/23916086'] into udc-platform-release.android-platform-14.0.0_r8android-platform-14.0.0_r7android-platform-14.0.0_r6android-platform-14.0.0_r5android-platform-14.0.0_r4android14-platform-release
Change-Id: If925f85c6a039b56ff549fd5327795f57b9cd12c
Diffstat (limited to 'xfa/fxfa/cxfa_textparser_unittest.cpp')
-rw-r--r-- | xfa/fxfa/cxfa_textparser_unittest.cpp | 58 |
1 files changed, 33 insertions, 25 deletions
diff --git a/xfa/fxfa/cxfa_textparser_unittest.cpp b/xfa/fxfa/cxfa_textparser_unittest.cpp index 5198638f0..298362e97 100644 --- a/xfa/fxfa/cxfa_textparser_unittest.cpp +++ b/xfa/fxfa/cxfa_textparser_unittest.cpp @@ -1,40 +1,48 @@ -// Copyright 2016 PDFium Authors. All rights reserved. +// Copyright 2016 The PDFium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "xfa/fxfa/cxfa_textparser.h" +#include "fxjs/gc/heap.h" +#include "testing/fxgc_unittest.h" #include "testing/gtest/include/gtest/gtest.h" +#include "v8/include/cppgc/heap.h" class CXFA_TestTextParser final : public CXFA_TextParser { public: - CXFA_TestTextParser() : CXFA_TextParser() {} + CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED; private: + CXFA_TestTextParser() = default; + // Add test cases as friends to access protected member functions. - FRIEND_TEST(CXFA_TextParser, TagValidate); + FRIEND_TEST(CXFATextParserTest, TagValidate); }; -TEST(CXFA_TextParser, TagValidate) { - CXFA_TestTextParser parser; - EXPECT_TRUE(parser.TagValidate(L"br")); - EXPECT_TRUE(parser.TagValidate(L"Br")); - EXPECT_TRUE(parser.TagValidate(L"BR")); - EXPECT_TRUE(parser.TagValidate(L"a")); - EXPECT_TRUE(parser.TagValidate(L"b")); - EXPECT_TRUE(parser.TagValidate(L"i")); - EXPECT_TRUE(parser.TagValidate(L"p")); - EXPECT_TRUE(parser.TagValidate(L"li")); - EXPECT_TRUE(parser.TagValidate(L"ol")); - EXPECT_TRUE(parser.TagValidate(L"ul")); - EXPECT_TRUE(parser.TagValidate(L"sub")); - EXPECT_TRUE(parser.TagValidate(L"sup")); - EXPECT_TRUE(parser.TagValidate(L"span")); - EXPECT_TRUE(parser.TagValidate(L"body")); - EXPECT_TRUE(parser.TagValidate(L"html")); - - EXPECT_FALSE(parser.TagValidate(L"")); - EXPECT_FALSE(parser.TagValidate(L"tml")); - EXPECT_FALSE(parser.TagValidate(L"xhtml")); - EXPECT_FALSE(parser.TagValidate(L"htmlx")); +class CXFATextParserTest : public FXGCUnitTest {}; + +TEST_F(CXFATextParserTest, TagValidate) { + auto* parser = cppgc::MakeGarbageCollected<CXFA_TestTextParser>( + heap()->GetAllocationHandle()); + EXPECT_TRUE(parser->TagValidate(L"br")); + EXPECT_TRUE(parser->TagValidate(L"Br")); + EXPECT_TRUE(parser->TagValidate(L"BR")); + EXPECT_TRUE(parser->TagValidate(L"a")); + EXPECT_TRUE(parser->TagValidate(L"b")); + EXPECT_TRUE(parser->TagValidate(L"i")); + EXPECT_TRUE(parser->TagValidate(L"p")); + EXPECT_TRUE(parser->TagValidate(L"li")); + EXPECT_TRUE(parser->TagValidate(L"ol")); + EXPECT_TRUE(parser->TagValidate(L"ul")); + EXPECT_TRUE(parser->TagValidate(L"sub")); + EXPECT_TRUE(parser->TagValidate(L"sup")); + EXPECT_TRUE(parser->TagValidate(L"span")); + EXPECT_TRUE(parser->TagValidate(L"body")); + EXPECT_TRUE(parser->TagValidate(L"html")); + + EXPECT_FALSE(parser->TagValidate(L"")); + EXPECT_FALSE(parser->TagValidate(L"tml")); + EXPECT_FALSE(parser->TagValidate(L"xhtml")); + EXPECT_FALSE(parser->TagValidate(L"htmlx")); } |