summaryrefslogtreecommitdiff
path: root/testing/embedder_test.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-02-05 21:13:51 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-02-05 21:13:51 +0000
commit0729be26d745e2ea713908eb9040e2be7c40c96b (patch)
tree87d3010e209b5b46d8632145c882a0d0d2ef7e40 /testing/embedder_test.cpp
parent3355f459ecd2207c0cd1719c2cdafa15eea87bf6 (diff)
downloadpdfium-0729be26d745e2ea713908eb9040e2be7c40c96b.tar.xz
Make EmbedderTest class member style consistent.
The class started with |foo_bar_| but now has a mixture of |foo_bar_| and |m_FooBar|. Change them all to |foo_bar_|. While making this change, also initialize the members in the header when possible. Change-Id: I202ff5dc5e945175ad4da2f3245724f3493aa8aa Reviewed-on: https://pdfium-review.googlesource.com/25390 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'testing/embedder_test.cpp')
-rw-r--r--testing/embedder_test.cpp57
1 files changed, 26 insertions, 31 deletions
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index b434353bd9..d7f4376b24 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -49,17 +49,8 @@ int GetBitmapBytesPerPixel(FPDF_BITMAP bitmap) {
} // namespace
EmbedderTest::EmbedderTest()
- : default_delegate_(new EmbedderTest::Delegate()),
- document_(nullptr),
- form_handle_(nullptr),
- avail_(nullptr),
- external_isolate_(nullptr),
- loader_(nullptr),
- file_length_(0),
- file_contents_(nullptr) {
- memset(&file_access_, 0, sizeof(file_access_));
- delegate_ = default_delegate_.get();
-
+ : default_delegate_(pdfium::MakeUnique<EmbedderTest::Delegate>()),
+ delegate_(default_delegate_.get()) {
FPDF_FILEWRITE::version = 1;
FPDF_FILEWRITE::WriteBlock = WriteBlockCallback;
}
@@ -80,7 +71,7 @@ void EmbedderTest::SetUp() {
info->FSDK_UnSupport_Handler = UnsupportedHandlerTrampoline;
FSDK_SetUnSpObjProcessHandler(info);
- m_SavedDocument = nullptr;
+ saved_document_ = nullptr;
}
void EmbedderTest::TearDown() {
@@ -129,9 +120,12 @@ bool EmbedderTest::OpenDocumentWithOptions(const std::string& filename,
EXPECT_TRUE(!loader_);
loader_ = new TestLoader(file_contents_.get(), file_length_);
+
+ memset(&file_access_, 0, sizeof(file_access_));
file_access_.m_FileLen = static_cast<unsigned long>(file_length_);
file_access_.m_GetBlock = TestLoader::GetBlock;
file_access_.m_Param = loader_;
+
fake_file_access_ = pdfium::MakeUnique<FakeFileAccess>(&file_access_);
return OpenDocumentHelper(password, must_linearize, fake_file_access_.get(),
&document_, &avail_, &form_handle_);
@@ -301,43 +295,43 @@ void EmbedderTest::UnloadPage(FPDF_PAGE page) {
FPDF_DOCUMENT EmbedderTest::OpenSavedDocument(const char* password) {
memset(&saved_file_access_, 0, sizeof(saved_file_access_));
- saved_file_access_.m_FileLen = m_String.size();
+ saved_file_access_.m_FileLen = data_string_.size();
saved_file_access_.m_GetBlock = GetBlockFromString;
- saved_file_access_.m_Param = &m_String;
+ saved_file_access_.m_Param = &data_string_;
saved_fake_file_access_ =
pdfium::MakeUnique<FakeFileAccess>(&saved_file_access_);
EXPECT_TRUE(OpenDocumentHelper(password, false, saved_fake_file_access_.get(),
- &m_SavedDocument, &m_SavedAvail,
- &m_SavedForm));
- return m_SavedDocument;
+ &saved_document_, &saved_avail_,
+ &saved_form_handle_));
+ return saved_document_;
}
void EmbedderTest::CloseSavedDocument() {
- ASSERT(m_SavedDocument);
+ ASSERT(saved_document_);
- FPDFDOC_ExitFormFillEnvironment(m_SavedForm);
- FPDF_CloseDocument(m_SavedDocument);
- FPDFAvail_Destroy(m_SavedAvail);
+ FPDFDOC_ExitFormFillEnvironment(saved_form_handle_);
+ FPDF_CloseDocument(saved_document_);
+ FPDFAvail_Destroy(saved_avail_);
- m_SavedForm = nullptr;
- m_SavedDocument = nullptr;
- m_SavedAvail = nullptr;
+ saved_form_handle_ = nullptr;
+ saved_document_ = nullptr;
+ saved_avail_ = nullptr;
}
FPDF_PAGE EmbedderTest::LoadSavedPage(int page_number) {
- ASSERT(m_SavedDocument);
+ ASSERT(saved_document_);
- EXPECT_LT(page_number, FPDF_GetPageCount(m_SavedDocument));
- FPDF_PAGE page = FPDF_LoadPage(m_SavedDocument, page_number);
+ EXPECT_LT(page_number, FPDF_GetPageCount(saved_document_));
+ FPDF_PAGE page = FPDF_LoadPage(saved_document_, page_number);
ASSERT(page);
return page;
}
FPDF_BITMAP EmbedderTest::RenderSavedPage(FPDF_PAGE page) {
- return RenderPageWithFlags(page, m_SavedForm, 0);
+ return RenderPageWithFlags(page, saved_form_handle_, 0);
}
void EmbedderTest::CloseSavedPage(FPDF_PAGE page) {
@@ -349,10 +343,11 @@ void EmbedderTest::VerifySavedRendering(FPDF_PAGE page,
int width,
int height,
const char* md5) {
- ASSERT(m_SavedDocument);
+ ASSERT(saved_document_);
ASSERT(page);
- FPDF_BITMAP new_bitmap = RenderPageWithFlags(page, m_SavedForm, FPDF_ANNOT);
+ FPDF_BITMAP new_bitmap =
+ RenderPageWithFlags(page, saved_form_handle_, FPDF_ANNOT);
CompareBitmap(new_bitmap, width, height, md5);
FPDFBitmap_Destroy(new_bitmap);
}
@@ -479,7 +474,7 @@ int EmbedderTest::WriteBlockCallback(FPDF_FILEWRITE* pFileWrite,
const void* data,
unsigned long size) {
EmbedderTest* pThis = static_cast<EmbedderTest*>(pFileWrite);
- pThis->m_String.append(static_cast<const char*>(data), size);
+ pThis->data_string_.append(static_cast<const char*>(data), size);
return 1;
}