summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfdoc_embeddertest.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-02-08 17:22:39 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-02-08 17:22:39 +0000
commit75c81710b1d193b59d5b38142bb926959346f7ea (patch)
tree814b91fec0f7a7b09c93b230e9f0663a76e05d27 /fpdfsdk/fpdfdoc_embeddertest.cpp
parentb0fb8cc23c0ae555726f873101961676f96f6f07 (diff)
downloadpdfium-75c81710b1d193b59d5b38142bb926959346f7ea.tar.xz
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 <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfdoc_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdfdoc_embeddertest.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/fpdfsdk/fpdfdoc_embeddertest.cpp b/fpdfsdk/fpdfdoc_embeddertest.cpp
index abe3d8c646..7cd27751e7 100644
--- a/fpdfsdk/fpdfdoc_embeddertest.cpp
+++ b/fpdfsdk/fpdfdoc_embeddertest.cpp
@@ -146,7 +146,7 @@ TEST_F(FPDFDocEmbeddertest, BUG_680376) {
TEST_F(FPDFDocEmbeddertest, ActionGetFilePath) {
EXPECT_TRUE(OpenDocument("launch_action.pdf"));
- FPDF_PAGE page = FPDF_LoadPage(document(), 0);
+ FPDF_PAGE page = LoadPage(0);
ASSERT_TRUE(page);
// The target action is nearly the size of the whole page.
@@ -165,7 +165,7 @@ TEST_F(FPDFDocEmbeddertest, ActionGetFilePath) {
EXPECT_EQ(bufsize, FPDFAction_GetFilePath(action, buf, bufsize));
EXPECT_EQ(std::string(kExpectedResult), std::string(buf));
- FPDF_ClosePage(page);
+ UnloadPage(page);
}
TEST_F(FPDFDocEmbeddertest, NoBookmarks) {