summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/basic_embeddertest.cpp19
-rw-r--r--testing/embedder_test.cpp8
-rw-r--r--testing/embedder_test.h4
3 files changed, 9 insertions, 22 deletions
diff --git a/testing/basic_embeddertest.cpp b/testing/basic_embeddertest.cpp
deleted file mode 100644
index 210fabd71a..0000000000
--- a/testing/basic_embeddertest.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) 2015 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "embedder_test.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-class BasicEmbeddertest : public EmbedderTest {
-};
-
-TEST_F(BasicEmbeddertest, GetPageCount) {
- EXPECT_TRUE(OpenDocument("testing/resources/about_blank.pdf"));
- EXPECT_EQ(1, GetPageCount());
-}
-
-TEST_F(BasicEmbeddertest, GetFirstPageNum) {
- EXPECT_TRUE(OpenDocument("testing/resources/about_blank.pdf"));
- EXPECT_EQ(0, GetFirstPageNum());
-}
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index 7b8498345a..e823347ef1 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -195,6 +195,9 @@ void EmbedderTest::SetUp() {
void EmbedderTest::TearDown() {
FPDF_CloseDocument(document_);
FPDFAvail_Destroy(avail_);
+ if (loader_) {
+ delete loader_;
+ }
if (file_contents_) {
free(file_contents_);
}
@@ -206,11 +209,10 @@ bool EmbedderTest::OpenDocument(const std::string& filename) {
return false;
}
- TestLoader loader(file_contents_, file_length_);
-
+ loader_ = new TestLoader(file_contents_, file_length_);
file_access_.m_FileLen = static_cast<unsigned long>(file_length_);
file_access_.m_GetBlock = Get_Block;
- file_access_.m_Param = &loader;
+ file_access_.m_Param = loader_;
file_avail_.version = 1;
file_avail_.IsDataAvail = Is_Data_Avail;
diff --git a/testing/embedder_test.h b/testing/embedder_test.h
index b127eadbde..48ea415e19 100644
--- a/testing/embedder_test.h
+++ b/testing/embedder_test.h
@@ -14,6 +14,8 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "v8/include/v8.h"
+class TestLoader;
+
// This class is used to load a PDF document, and then run programatic
// API tests against it.
class EmbedderTest : public ::testing::Test {
@@ -21,6 +23,7 @@ class EmbedderTest : public ::testing::Test {
EmbedderTest() :
document_(nullptr),
avail_(nullptr),
+ loader_(nullptr),
file_length_(0),
file_contents_(nullptr) {
memset(&hints_, 0, sizeof(hints_));
@@ -70,6 +73,7 @@ class EmbedderTest : public ::testing::Test {
FX_FILEAVAIL file_avail_;
v8::StartupData natives_;
v8::StartupData snapshot_;
+ TestLoader* loader_;
size_t file_length_;
char* file_contents_;
};