Add move ctor to nonstd::unique_ptr.
[pdfium.git] / testing / embedder_test.h
index 0ac68d5..f490f82 100644 (file)
@@ -5,6 +5,7 @@
 #ifndef TESTING_EMBEDDER_TEST_H_
 #define TESTING_EMBEDDER_TEST_H_
 
+#include <map>
 #include <string>
 
 #include "../public/fpdf_dataavail.h"
@@ -25,14 +26,16 @@ class EmbedderTest : public ::testing::Test,
  public:
   class Delegate {
    public:
-    virtual ~Delegate() { }
+    virtual ~Delegate() {}
 
     // Equivalent to UNSUPPORT_INFO::FSDK_UnSupport_Handler().
-    virtual void UnsupportedHandler(int type) { }
+    virtual void UnsupportedHandler(int type) {}
 
     // Equivalent to IPDF_JSPLATFORM::app_alert().
-    virtual int Alert(FPDF_WIDESTRING message, FPDF_WIDESTRING title,
-                      int type, int icon) {
+    virtual int Alert(FPDF_WIDESTRING message,
+                      FPDF_WIDESTRING title,
+                      int type,
+                      int icon) {
       return 0;
     }
 
@@ -40,7 +43,15 @@ class EmbedderTest : public ::testing::Test,
     virtual int SetTimer(int msecs, TimerCallback fn) { return 0; }
 
     // Equivalent to FPDF_FORMFILLINFO::FFI_KillTimer().
-    virtual void KillTimer(int id) { }
+    virtual void KillTimer(int id) {}
+
+    // Equivalent to FPDF_FORMFILLINFO::FFI_GetPage().
+    virtual FPDF_PAGE GetPage(FPDF_FORMHANDLE form_handle,
+                              FPDF_DOCUMENT document,
+                              int page_index);
+
+   private:
+    std::map<int, FPDF_PAGE> m_pageMap;
   };
 
   EmbedderTest();
@@ -70,6 +81,10 @@ class EmbedderTest : public ::testing::Test,
   // Load a specific page of the open document.
   virtual FPDF_PAGE LoadPage(int page_number);
 
+  // Load a specific page of the open document using delegate_->GetPage.
+  // delegate_->GetPage also caches loaded page.
+  virtual FPDF_PAGE LoadAndCachePage(int page_number);
+
   // Convert a loaded page into a bitmap.
   virtual FPDF_BITMAP RenderPage(FPDF_PAGE page);
 
@@ -95,11 +110,18 @@ class EmbedderTest : public ::testing::Test,
 
  private:
   static void UnsupportedHandlerTrampoline(UNSUPPORT_INFO*, int type);
-  static int AlertTrampoline(IPDF_JSPLATFORM* plaform, FPDF_WIDESTRING message,
-                             FPDF_WIDESTRING title, int type, int icon);
-  static int SetTimerTrampoline(FPDF_FORMFILLINFO* info, int msecs,
+  static int AlertTrampoline(IPDF_JSPLATFORM* plaform,
+                             FPDF_WIDESTRING message,
+                             FPDF_WIDESTRING title,
+                             int type,
+                             int icon);
+  static int SetTimerTrampoline(FPDF_FORMFILLINFO* info,
+                                int msecs,
                                 TimerCallback fn);
   static void KillTimerTrampoline(FPDF_FORMFILLINFO* info, int id);
+  static FPDF_PAGE GetPageTrampoline(FPDF_FORMFILLINFO* info,
+                                     FPDF_DOCUMENT document,
+                                     int page_index);
 };
 
 #endif  // TESTING_EMBEDDER_TEST_H_