summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/embedder_test.cpp4
-rw-r--r--testing/embedder_test.h1
2 files changed, 4 insertions, 1 deletions
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index e4ac4ad2c7..e874640218 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -351,7 +351,9 @@ FPDF_DOCUMENT EmbedderTest::OpenSavedDocument(const char* password) {
memset(&saved_file_access_, 0, sizeof(saved_file_access_));
saved_file_access_.m_FileLen = data_string_.size();
saved_file_access_.m_GetBlock = GetBlockFromString;
- saved_file_access_.m_Param = &data_string_;
+ // Copy data to prevent clearing it before saved document close.
+ saved_document_file_data_ = data_string_;
+ saved_file_access_.m_Param = &saved_document_file_data_;
saved_fake_file_access_ =
pdfium::MakeUnique<FakeFileAccess>(&saved_file_access_);
diff --git a/testing/embedder_test.h b/testing/embedder_test.h
index e8f76c058f..b0dada0341 100644
--- a/testing/embedder_test.h
+++ b/testing/embedder_test.h
@@ -260,6 +260,7 @@ class EmbedderTest : public ::testing::Test,
int GetPageNumberForSavedPage(FPDF_PAGE page) const;
std::string data_string_;
+ std::string saved_document_file_data_;
std::ofstream filestream_;
};