summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-05-15 15:13:25 -0700
committerLei Zhang <thestig@chromium.org>2015-05-15 15:13:25 -0700
commit61ffad8df484ab9b3f7d2f5519ec470fbc023b88 (patch)
tree0bc082f49a3961df5138928ee84f4a47eb1de4c7 /fpdfsdk/src
parent9f6f34892fdfff87c49a9df4c1e34790c0fa1272 (diff)
downloadpdfium-61ffad8df484ab9b3f7d2f5519ec470fbc023b88.tar.xz
Fix leaks in the embedder tests themselves.
Also change EmbedderTest::TearDown() to match the destruction order in Chromium's PDF code. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1138143003
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/fpdfformfill_embeddertest.cpp1
-rw-r--r--fpdfsdk/src/fpdftext_embeddertest.cpp8
-rw-r--r--fpdfsdk/src/fpdfview_embeddertest.cpp1
3 files changed, 8 insertions, 2 deletions
diff --git a/fpdfsdk/src/fpdfformfill_embeddertest.cpp b/fpdfsdk/src/fpdfformfill_embeddertest.cpp
index 7c3988c445..b4cc111a00 100644
--- a/fpdfsdk/src/fpdfformfill_embeddertest.cpp
+++ b/fpdfsdk/src/fpdfformfill_embeddertest.cpp
@@ -24,4 +24,5 @@ TEST_F(FPDFFormFillEmbeddertest, FirstTest) {
EXPECT_TRUE(OpenDocument("testing/resources/hello_world.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_NE(nullptr, page);
+ UnloadPage(page);
}
diff --git a/fpdfsdk/src/fpdftext_embeddertest.cpp b/fpdfsdk/src/fpdftext_embeddertest.cpp
index 394e1a96b3..8384a41944 100644
--- a/fpdfsdk/src/fpdftext_embeddertest.cpp
+++ b/fpdfsdk/src/fpdftext_embeddertest.cpp
@@ -36,7 +36,7 @@ TEST_F(FPDFTextEmbeddertest, Text) {
FPDF_TEXTPAGE textpage = FPDFText_LoadPage(page);
EXPECT_NE(nullptr, textpage);
- const char expected[] = "Hello, world!\r\nGoodbye, world!";
+ static const char expected[] = "Hello, world!\r\nGoodbye, world!";
unsigned short fixed_buffer[128];
memset(fixed_buffer, 0xbd, sizeof(fixed_buffer));
@@ -134,6 +134,7 @@ TEST_F(FPDFTextEmbeddertest, Text) {
EXPECT_EQ(0xbdbd, fixed_buffer[10]);
FPDFText_ClosePage(textpage);
+ UnloadPage(page);
}
TEST_F(FPDFTextEmbeddertest, TextSearch) {
@@ -239,6 +240,7 @@ TEST_F(FPDFTextEmbeddertest, TextSearch) {
FPDFText_FindClose(search);
FPDFText_ClosePage(textpage);
+ UnloadPage(page);
}
// Test that the page has characters despite a bad stream length.
@@ -252,6 +254,7 @@ TEST_F(FPDFTextEmbeddertest, StreamLengthPastEndOfFile) {
EXPECT_EQ(13, FPDFText_CountChars(textpage));
FPDFText_ClosePage(textpage);
+ UnloadPage(page);
}
TEST_F(FPDFTextEmbeddertest, WebLinks) {
@@ -277,7 +280,7 @@ TEST_F(FPDFTextEmbeddertest, WebLinks) {
EXPECT_EQ(25, FPDFLink_GetURL(pagelink, 0, nullptr, 0));
EXPECT_EQ(26, FPDFLink_GetURL(pagelink, 1, nullptr, 0));
- const char expected_url[] = "http://example.com?q=foo";
+ static const char expected_url[] = "http://example.com?q=foo";
unsigned short fixed_buffer[128];
// Retrieve a link with too small a buffer. Buffer will not be
@@ -358,4 +361,5 @@ TEST_F(FPDFTextEmbeddertest, WebLinks) {
FPDFLink_CloseWebLinks(pagelink);
FPDFText_ClosePage(textpage);
+ UnloadPage(page);
}
diff --git a/fpdfsdk/src/fpdfview_embeddertest.cpp b/fpdfsdk/src/fpdfview_embeddertest.cpp
index f885aa663a..cc0aa1f818 100644
--- a/fpdfsdk/src/fpdfview_embeddertest.cpp
+++ b/fpdfsdk/src/fpdfview_embeddertest.cpp
@@ -194,6 +194,7 @@ TEST_F(FPDFViewEmbeddertest, Crasher_452455) {
EXPECT_TRUE(OpenDocument("testing/resources/bug_452455.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_NE(nullptr, page);
+ UnloadPage(page);
}
TEST_F(FPDFViewEmbeddertest, Crasher3) {