From 75c81710b1d193b59d5b38142bb926959346f7ea Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 8 Feb 2018 17:22:39 +0000 Subject: Do more page load/unload checks in EmbedderTest. - Keep track of pages in a single map when calling LoadPage(). It is simpler and performance is not crucial as the number of loaded pages is usually very small. - Verify UnloadPage() is only called for loaded pages. - Verify there are no loaded pages in TearDown(). - Verify RenderLoadedPage methods are only rendering loaded pages. - Fix pages that are using FPDF_LoadPage() and FPDF_ClosePage() when they should be using LoadPage() and UnloadPage(). - Disallow calling LoadPage() for the same page number repeatedly. No caller does this and it makes verification in UnloadPage() harder. Change-Id: I58878ea8ade21dde28f1bbebd3a3304ce677561d Reviewed-on: https://pdfium-review.googlesource.com/25550 Reviewed-by: dsinclair Commit-Queue: Lei Zhang --- fpdfsdk/fpdf_structtree_embeddertest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fpdfsdk/fpdf_structtree_embeddertest.cpp') diff --git a/fpdfsdk/fpdf_structtree_embeddertest.cpp b/fpdfsdk/fpdf_structtree_embeddertest.cpp index 7ca81f7b2e..b638cdc315 100644 --- a/fpdfsdk/fpdf_structtree_embeddertest.cpp +++ b/fpdfsdk/fpdf_structtree_embeddertest.cpp @@ -71,7 +71,7 @@ TEST_F(FPDFStructTreeEmbeddertest, GetAltText) { EXPECT_EQ(nullptr, ggchild_element); FPDF_StructTree_Close(struct_tree); - FPDF_ClosePage(page); + UnloadPage(page); } TEST_F(FPDFStructTreeEmbeddertest, GetMarkedContentID) { @@ -87,7 +87,7 @@ TEST_F(FPDFStructTreeEmbeddertest, GetMarkedContentID) { EXPECT_EQ(0, FPDF_StructElement_GetMarkedContentID(element)); FPDF_StructTree_Close(struct_tree); - FPDF_ClosePage(page); + UnloadPage(page); } TEST_F(FPDFStructTreeEmbeddertest, GetType) { @@ -116,5 +116,5 @@ TEST_F(FPDFStructTreeEmbeddertest, GetType) { WideString::FromUTF16LE(buffer, FXSYS_len(kExpected))); FPDF_StructTree_Close(struct_tree); - FPDF_ClosePage(page); + UnloadPage(page); } -- cgit v1.2.3