Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: testing/pdfium_test_embedder.h

Issue 827733006: Create first pdfium embedder test. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Add second simple test. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: testing/pdfium_test_embedder.h
diff --git a/testing/pdfium_test_embedder.h b/testing/pdfium_test_embedder.h
new file mode 100644
index 0000000000000000000000000000000000000000..427a1a22361db32a911a92f60c0c6c8b253420d8
--- /dev/null
+++ b/testing/pdfium_test_embedder.h
@@ -0,0 +1,59 @@
+// 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.
+
+#ifndef TESTING_PDFIUM_TEST_EMBEDDER_H_
+#define TESTING_PDFIUM_TEST_EMBEDDER_H_
+
+#include <string>
+
+#include "../core/include/fxcrt/fx_system.h"
+#include "../fpdfsdk/include/fpdf_dataavail.h"
+#include "../fpdfsdk/include/fpdfformfill.h"
+#include "../fpdfsdk/include/fpdfview.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "v8/include/v8.h"
+
+class PDFiumTestEmbedder : public ::testing::Test {
jam 2015/01/13 19:21:18 nit: add documentation about what this class is us
Tom Sepez 2015/01/15 21:24:40 Done.
+ public:
+ PDFiumTestEmbedder() :
+ document_(nullptr),
+ avail_(nullptr),
+ file_length_(0),
+ file_contents_(nullptr) {
+ memset(&hints_, '\0', sizeof(hints_));
+ memset(&file_access_, '\0', sizeof(file_access_));
+ memset(&file_avail_, '\0', sizeof(file_avail_));
+ }
+
+ virtual ~PDFiumTestEmbedder() { }
+
+ void SetUp() override;
+ void TearDown() override;
+
+ FPDF_DOCUMENT document() { return document_; }
+
+ virtual bool OpenDocument(const std::string& filename);
jam 2015/01/13 19:21:18 nit: add documentation for these methods
Tom Sepez 2015/01/15 21:24:40 Done.
+ virtual FPDF_FORMHANDLE SetFormFillEnvironment();
+ virtual void ClearFormFillEnvironment(FPDF_FORMHANDLE form);
+ virtual void DoOpenActions(FPDF_FORMHANDLE form);
+ virtual int GetFirstPageNum();
+ virtual int GetPageCount();
+ virtual FPDF_PAGE LoadPage(int page_number, FPDF_FORMHANDLE form);
+ virtual FPDF_BITMAP RenderPage(FPDF_PAGE page, FPDF_FORMHANDLE form);
+ virtual void UnloadPage(FPDF_PAGE page, FPDF_FORMHANDLE form);
+
+ private:
+ FPDF_DOCUMENT document_;
+ FPDF_AVAIL avail_;
+ FX_DOWNLOADHINTS hints_;
+ FPDF_FILEACCESS file_access_;
+ FX_FILEAVAIL file_avail_;
+ v8::StartupData natives_;
+ v8::StartupData snapshot_;
+ size_t file_length_;
+ char* file_contents_;
+};
+
+#endif // TESTING_PDFIUM_TEST_EMBEDDER_H_
+

Powered by Google App Engine
This is Rietveld 408576698