summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_document_unittest.cpp
diff options
context:
space:
mode:
authornpm <npm@chromium.org>2016-10-21 09:42:33 -0700
committerCommit bot <commit-bot@chromium.org>2016-10-21 09:42:33 -0700
commitfd5ae3f7cf077d00af0ce3082376f4051c499c5d (patch)
treec50f211d8efca99e9ec17733a776fca854c3f78c /core/fpdfapi/parser/cpdf_document_unittest.cpp
parentef38283688c1ee7c08bcf4204cfb78e09c039782 (diff)
downloadpdfium-fd5ae3f7cf077d00af0ce3082376f4051c499c5d.tar.xz
Revert of Fix loading page using hint tables. (patchset #5 id:80001 of https://codereview.chromium.org/2437773003/ )
Reason for revert: CPDF_DataAvail::IsPageAvail is causing crashes. BUG=chromium:658168, chromium:658170 Original issue's description: > Fix loading page using hint tables. > > When linearized document have hint table, > The FPDFAvail_IsPageAvail return true, but > FPDF_LoadPage return nullptr, for non first pages. > > This happens, bacause document not use hint tables, to load page. > > To fix this, I force save the page's ObjNum in document. > > R=npm, dsinclair > > Committed: https://pdfium.googlesource.com/pdfium/+/ef38283688c1ee7c08bcf4204cfb78e09c039782 TBR=dsinclair@chromium.org,tsepez@chromium.org,thestig@chromium.org,art-snake@yandex-team.ru # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://chromiumcodereview.appspot.com/2442663005
Diffstat (limited to 'core/fpdfapi/parser/cpdf_document_unittest.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_document_unittest.cpp42
1 files changed, 0 insertions, 42 deletions
diff --git a/core/fpdfapi/parser/cpdf_document_unittest.cpp b/core/fpdfapi/parser/cpdf_document_unittest.cpp
deleted file mode 100644
index 128b8d91c4..0000000000
--- a/core/fpdfapi/parser/cpdf_document_unittest.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2016 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.
-
-#include "core/fpdfapi/parser/cpdf_document.h"
-
-#include <memory>
-
-#include "core/fpdfapi/parser/cpdf_parser.h"
-#include "core/fpdfapi/parser/cpdf_dictionary.h"
-#include "core/fxcrt/fx_memory.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-using ScopedDictionary =
- std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>>;
-
-} // namespace
-
-TEST(cpdf_document, UseCachedPageObjNumIfHaveNotPagesDict) {
- // ObjNum can be added in CPDF_DataAvail::IsPageAvail, and PagesDict
- // can be not exists in this case.
- // (case, when hint table is used to page check in CPDF_DataAvail).
- std::unique_ptr<CPDF_Parser> parser(new CPDF_Parser());
- CPDF_Document document(std::move(parser));
- ScopedDictionary dict(new CPDF_Dictionary());
- const int page_count = 100;
- dict->SetIntegerFor("N", page_count);
- document.LoadLinearizedDoc(dict.get());
- ASSERT_EQ(page_count, document.GetPageCount());
- CPDF_Object* page_stub = new CPDF_Dictionary();
- const uint32_t obj_num = document.AddIndirectObject(page_stub);
- const int test_page_num = 33;
-
- EXPECT_FALSE(document.IsPageLoaded(test_page_num));
- EXPECT_EQ(nullptr, document.GetPage(test_page_num));
-
- document.SetPageObjNum(test_page_num, obj_num);
- EXPECT_TRUE(document.IsPageLoaded(test_page_num));
- EXPECT_EQ(page_stub, document.GetPage(test_page_num));
-}