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

Unified Diff: core/fpdfapi/parser/cpdf_document_unittest.cpp

Issue 2466023002: Unify some code (Closed)
Patch Set: Fix review issues. Created 4 years, 1 month 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: core/fpdfapi/parser/cpdf_document_unittest.cpp
diff --git a/core/fpdfapi/parser/cpdf_document_unittest.cpp b/core/fpdfapi/parser/cpdf_document_unittest.cpp
index 9336626f45989be83afd6f10b4dfd305df8f35f4..b305cd100e72b688fcb46358edc8e9a9a531ff7d 100644
--- a/core/fpdfapi/parser/cpdf_document_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_document_unittest.cpp
@@ -9,6 +9,7 @@
#include "core/fpdfapi/cpdf_modulemgr.h"
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
+#include "core/fpdfapi/parser/cpdf_linearized.h"
#include "core/fpdfapi/parser/cpdf_parser.h"
#include "core/fxcrt/fx_memory.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -79,6 +80,11 @@ class CPDF_TestDocumentForPages : public CPDF_Document {
std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>>
m_pOwnedRootDict;
};
+
+class TestLinearized : public CPDF_Linearized {
+ public:
+ TestLinearized(CPDF_Dictionary* dict) : CPDF_Linearized(dict) {}
Lei Zhang 2016/11/04 23:02:15 add "explicit"
snake 2016/11/04 23:27:36 Done.
+};
} // namespace
class cpdf_document_test : public testing::Test {
@@ -121,10 +127,12 @@ TEST_F(cpdf_document_test, UseCachedPageObjNumIfHaveNotPagesDict) {
// can be not exists in this case.
// (case, when hint table is used to page check in CPDF_DataAvail).
CPDF_Document document(pdfium::MakeUnique<CPDF_Parser>());
- ScopedDictionary dict(new CPDF_Dictionary());
+ UniqueDictionary dict(new CPDF_Dictionary());
Lei Zhang 2016/11/04 23:02:15 pdfium::MakeUnique<CPDF_Dictionary>()
snake 2016/11/04 23:27:36 CPDF_Dictionary should use custom deleter.
+ dict->SetBooleanFor("Linearized", true);
const int page_count = 100;
dict->SetIntegerFor("N", page_count);
- document.LoadLinearizedDoc(dict.get());
+ TestLinearized linearized(dict.get());
+ document.LoadLinearizedDoc(&linearized);
ASSERT_EQ(page_count, document.GetPageCount());
CPDF_Object* page_stub = new CPDF_Dictionary();
const uint32_t obj_num = document.AddIndirectObject(page_stub);

Powered by Google App Engine
This is Rietveld 408576698