Implement FakeFileAccess.

Update embedder tests to simulate unavailable data and download requests.

Change-Id: I634fa89d2a0c859243e849752936da87568909f4
Reviewed-on: https://pdfium-review.googlesource.com/11890
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: dsinclair <dsinclair@chromium.org>
diff --git a/testing/embedder_test.h b/testing/embedder_test.h
index 878e50b..be89c2a 100644
--- a/testing/embedder_test.h
+++ b/testing/embedder_test.h
@@ -14,6 +14,7 @@
 #include "public/fpdf_formfill.h"
 #include "public/fpdf_save.h"
 #include "public/fpdfview.h"
+#include "testing/fake_file_access.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/test_support.h"
 
@@ -116,9 +117,7 @@
  protected:
   bool OpenDocumentHelper(const char* password,
                           bool must_linearize,
-                          FX_FILEAVAIL* file_avail,
-                          FX_DOWNLOADHINTS* hints,
-                          FPDF_FILEACCESS* file_access,
+                          FakeFileAccess* network_simulator,
                           FPDF_DOCUMENT* document,
                           FPDF_AVAIL* avail,
                           FPDF_FORMHANDLE* form_handle);
@@ -151,14 +150,14 @@
   void CloseSaved();
   void TestAndCloseSaved(int width, int height, const char* md5);
 
+  void SetWholeFileAvailable();
+
   Delegate* delegate_;
   std::unique_ptr<Delegate> default_delegate_;
   FPDF_DOCUMENT document_;
   FPDF_FORMHANDLE form_handle_;
   FPDF_AVAIL avail_;
-  FX_DOWNLOADHINTS hints_;
-  FPDF_FILEACCESS file_access_;
-  FX_FILEAVAIL file_avail_;
+  FPDF_FILEACCESS file_access_;  // must outlive avail_.
 #ifdef PDF_ENABLE_V8
   v8::Platform* platform_;
 #endif  // PDF_ENABLE_V8
@@ -172,6 +171,10 @@
   FPDF_PAGE m_SavedPage;
   FPDF_FORMHANDLE m_SavedForm;
   FPDF_AVAIL m_SavedAvail;
+  FPDF_FILEACCESS saved_file_access_;  // must outlive m_SavedAvail.
+  std::unique_ptr<FakeFileAccess> fake_file_access_;  // must outlive avail_.
+  std::unique_ptr<FakeFileAccess>
+      saved_fake_file_access_;  // must outlive m_SavedAvail.
 
  private:
   static void UnsupportedHandlerTrampoline(UNSUPPORT_INFO*, int type);