summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfview_embeddertest.cpp
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2017-09-28 18:46:03 +0300
committerChromium commit bot <commit-bot@chromium.org>2017-09-28 15:59:08 +0000
commit0e60b9ef2b79de52ef62101abae2af7292e879b7 (patch)
tree9f71519f2a364ee6702219a44de7fdb1def18cc7 /fpdfsdk/fpdfview_embeddertest.cpp
parent1ca7173cd85adcd58766fc89f95c3dc163efa17a (diff)
downloadpdfium-0e60b9ef2b79de52ef62101abae2af7292e879b7.tar.xz
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>
Diffstat (limited to 'fpdfsdk/fpdfview_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdfview_embeddertest.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/fpdfsdk/fpdfview_embeddertest.cpp b/fpdfsdk/fpdfview_embeddertest.cpp
index 97ba9d7c4c..699fc8a71b 100644
--- a/fpdfsdk/fpdfview_embeddertest.cpp
+++ b/fpdfsdk/fpdfview_embeddertest.cpp
@@ -12,6 +12,23 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/utils/path_service.h"
+namespace {
+
+class MockDownloadHints : public FX_DOWNLOADHINTS {
+ public:
+ static void SAddSegment(FX_DOWNLOADHINTS* pThis, size_t offset, size_t size) {
+ }
+
+ MockDownloadHints() {
+ FX_DOWNLOADHINTS::version = 1;
+ FX_DOWNLOADHINTS::AddSegment = SAddSegment;
+ }
+
+ ~MockDownloadHints() {}
+};
+
+} // namespace
+
TEST(fpdf, CApiTest) {
EXPECT_TRUE(CheckPDFiumCApi());
}
@@ -319,12 +336,13 @@ TEST_F(FPDFViewEmbeddertest, Hang_298) {
// reference loop. Cross references will be rebuilt successfully.
TEST_F(FPDFViewEmbeddertest, CrossRefV4Loop) {
EXPECT_TRUE(OpenDocument("bug_xrefv4_loop.pdf"));
+ MockDownloadHints hints;
// Make sure calling FPDFAvail_IsDocAvail() on this file does not infinite
// loop either. See bug 875.
int ret = PDF_DATA_NOTAVAIL;
while (ret == PDF_DATA_NOTAVAIL)
- ret = FPDFAvail_IsDocAvail(avail_, &hints_);
+ ret = FPDFAvail_IsDocAvail(avail_, &hints);
EXPECT_EQ(PDF_DATA_AVAIL, ret);
}