summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfformfill_embeddertest.cpp
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-07-05 11:55:35 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-05 17:08:57 +0000
commit3ff54008a163eea3158a7c107595daf79ccc7d44 (patch)
treef460b4f50863e65922799970208bf93bd845a7d8 /fpdfsdk/fpdfformfill_embeddertest.cpp
parentfb00ec2af390ccfe8f5e81f49b9113e044f5e5ad (diff)
downloadpdfium-3ff54008a163eea3158a7c107595daf79ccc7d44.tar.xz
Allow EmbedderTest to test saving
This CL adds helper methods for EmbedderTest to save. This means that TestSaver is no longer needed and all the methods it uses are moved to the EmbedderTest. Change-Id: I740f29699bfd8c6b570cb1fd85e7aab9bc1d3f6f Reviewed-on: https://pdfium-review.googlesource.com/7171 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfformfill_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdfformfill_embeddertest.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/fpdfsdk/fpdfformfill_embeddertest.cpp b/fpdfsdk/fpdfformfill_embeddertest.cpp
index 7779ed25a7..83e560a60c 100644
--- a/fpdfsdk/fpdfformfill_embeddertest.cpp
+++ b/fpdfsdk/fpdfformfill_embeddertest.cpp
@@ -20,7 +20,7 @@
using testing::_;
using testing::Return;
-class FPDFFormFillEmbeddertest : public EmbedderTest, public TestSaver {
+class FPDFFormFillEmbeddertest : public EmbedderTest {
protected:
void TypeTextIntoTextfield(FPDF_PAGE page,
int num_chars,
@@ -366,26 +366,11 @@ TEST_F(FPDFFormFillEmbeddertest, FormText) {
EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
- // Close everything
+ // Close page
UnloadPage(page);
- FPDFDOC_ExitFormFillEnvironment(form_handle_);
- FPDF_CloseDocument(document_);
}
// Check saved document
- std::string new_file = GetString();
- FPDF_FILEACCESS file_access;
- memset(&file_access, 0, sizeof(file_access));
- file_access.m_FileLen = new_file.size();
- file_access.m_GetBlock = GetBlockFromString;
- file_access.m_Param = &new_file;
- document_ = FPDF_LoadCustomDocument(&file_access, nullptr);
- SetupFormFillEnvironment();
- EXPECT_EQ(1, FPDF_GetPageCount(document_));
- std::unique_ptr<void, FPDFPageDeleter> new_page(FPDF_LoadPage(document_, 0));
- ASSERT_TRUE(new_page.get());
- std::unique_ptr<void, FPDFBitmapDeleter> new_bitmap(
- RenderPage(new_page.get()));
- CompareBitmap(new_bitmap.get(), 300, 300, md5_3);
+ TestAndCloseSaved(300, 300, md5_3);
}
TEST_F(FPDFFormFillEmbeddertest, GetSelectedTextEmptyAndBasicKeyboard) {