summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-01-23Fix test naming in previous commit.Tom Sepez
The embeddertests binary should have source files ending in _embeddertest, not _unittest. TBR=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/871093004
2015-01-23Fix null crash in CheckTrailer.Tom Sepez
We are making checks in the incorrect order. Also adds two test cases, one for the this crash, and another for the original issue that motivated the patch. Original Patch by Bo at https://codereview.chromium.org/866003003/ BUG=450871 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/872563002
2015-01-22Add pdfium_embeddertests to BUILD.gnTom Sepez
This brings BUILD.gn into equivalence with pdfium.gyp. Blocked on https://codereview.chromium.org/851283006/ R=thestig@chromium.org Review URL: https://codereview.chromium.org/871453004
2015-01-22Fix build of pdfium_embeddertest under V8_USE_EXTERNAL_STARTUP_DATA.Tom Sepez
Currently, this is a difference between the standalone pdfium environment vs. pdfium as part of a chromium checkout. Locating the external data files is a nusiance when you don't have the binary's argv[0] line, so we create a new main that preserves this for us. R=thestig@chromium.org Review URL: https://codereview.chromium.org/851283006
2015-01-22Use IPDF_DataAvail interface to hide CPDF_DataAvail.Tom Sepez
Currently, no callers go through the Interface, which makes having a separate interface class kind of pointless. After converting callers away from using the CPDF_DataAvail concrete class, it can be moved from the header to the .cpp file. R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/873523002
2015-01-22Add API tests: NamedDestsByName, DestGetPageIndex.Tom Sepez
This also adds a fpdfdoc_embeddertest.cpp to keep the test file name matching with the API call under test. R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/812933004
2015-01-21Add tests for GetNamedDests() API.Tom Sepez
Follow-on work from patch at https://codereview.chromium.org/845643008. This incorporates that patch, plus adds tests for it and similar conditions. A few changes are introduced to correct expected behaviour. This also incoprorates Deepak's fix in https://codereview.chromium.org/845643008/ This incorporates a formerly unlanded tool to generate small valid PDF files from template input, which is needed to cover all the error cases here. See https://codereview.chromium.org/791993006/ BUG=450133 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/837723009
2015-01-21Use signed long for FPDF_GetNamedDest buffer length.Bo Xu
Need to have return value -1 indicating insufficient buffer. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/862163002
2015-01-21Simplify UTF16LE_Encode and add unittest.Bo Xu
Previously, UTF16LE_Encode take an optional flag to indicate if the returned byte string has trailing zeros. In fact, no where needs the flag to be false. So just get rid of it so callers won't misuse. The bug is found by https://codereview.chromium.org/837723009 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/860973002
2015-01-16Fix missing call to destroy library in embedder test.chromium/2289chromium/2288chromium/2287chromium/2286chromium/2285chromium/2284chromium/2283chromium/2282Tom Sepez
This was somehow lost along the way to creating embedder tests. Presumably this silently leaks in origin/master, but triggers an assert under XFA. Fixing this on master is a pre-requisite for merging all the embedder test code onto XFA. TBR=jam@chromium.org Review URL: https://codereview.chromium.org/856773003
2015-01-16Follow-on to pdfium_embeddertests.Tom Sepez
This includes: - Fix TestLoader lifetime. - Rename test file to match the equivalent .cpp under test - Re-organize a few tests to avoid duplicate loading - add tests for a few additional functions. R=jam@chromium.org Review URL: https://codereview.chromium.org/857483005
2015-01-15Allow FPDFBookmark_GetFirstChild to return the top level bookmarkTom Sepez
Previously when passing a NULL bookmark to FPDFBookmark_GetFirstChild it returned NULL instead of returning the top level bookmark. This change removes the early exit in this case allowing the top level bookmark to be retrieved. BUG=https://code.google.com/p/pdfium/issues/detail?id=110 R=bo_xu@foxitsoftware.com, tsepez@chromium.org Review URL: https://codereview.chromium.org/847243005
2015-01-15Create first pdfium embedder test.Tom Sepez
BUG=https://code.google.com/p/pdfium/issues/detail?id=62 R=jam@chromium.org Review URL: https://codereview.chromium.org/827733006
2015-01-15Land patch from issue 854603005 at patchset 1 (http://crrev.com/854603005#ps1)chromium/2281chromium/2280chromium/2279chromium/2278Tom Sepez
on behalf of qsr@ TBR=qsr@chromium.org Review URL: https://codereview.chromium.org/852983003
2015-01-14Ensure unittests are built when building all.John Abd-El-Malek
R=scottmg@chromium.org Review URL: https://codereview.chromium.org/849113002
2015-01-14Fix v8 external snapshot code for Windows.chromium/2277Ross McIlroy
Needed to land https://codereview.chromium.org/826083004/. BUG=421063, 439661 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/848443002 Patch from Ross McIlroy <rmcilroy@chromium.org>.
2015-01-12Merge to master: Fix include paths for pdfium_unittests under chromium checkoutTom Sepez
Orignal CL at https://codereview.chromium.org/852493002/ TBR=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/849603003
2015-01-10Add APIs for getting bookmarks and named destinations.Bo Xu
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/834703002
2015-01-09Check for NULL pointers in CJBig2_SymbolDict::DeepCopy().chromium/2276chromium/2275chromium/2274chromium/2273Lei Zhang
BUG=445475 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/837093002
2015-01-09Add pdfium_unittests to BUILD.gnTom Sepez
Brings GN build up to sync with GYP build for this test binary. R=thestig@chromium.org Review URL: https://codereview.chromium.org/840343005
2015-01-09Only request C++11 when compiling C++ code.Bruce Dawson
Linux pdfium builds have 215 warnings of this form: command line option -std=gnu++11 is valid for C++/ObjC++ but not for C The obvious fix is to not request C++11 for C compilations. The only complication was the the switch we are using is actually gnu++0x, not gnu++11. BUG=https://code.google.com/p/pdfium/issues/detail?id=102 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/839163002
2015-01-09Fix -Wnon-virtual-dtor compiler warnings.Tom Sepez
This is done by explicitly adding a virtual dtor to interface classes, since the cost is small given that there are already virtual functions. The exceptions are for classes that have a Release() or Delete() method, in which case it is non-virtual and protected to indicate that the virtual class is never the deletion point. BUG= R=brucedawson@chromium.org, thestig@chromium.org Review URL: https://codereview.chromium.org/810883005
2015-01-08Land: Protect against a seg fault in CPDF_StructElementImpl constructor.Tom Sepez
patch from issue 680873002 at patchset 40001 (http://crrev.com/680873002#ps40001) TBR=jam@chromium.org Review URL: https://codereview.chromium.org/841943003
2015-01-07Finish unit test for CFX_ByteStringC class.Tom Sepez
This fixes a few cut-n-paste errors in the previous version, plus adds more corner cases. The implementation is fixed to handle a few of these that failed. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/808553013
2015-01-07Add ostream helpers for FX String classes.Tom Sepez
This allows integration with the gtest EXPECT_* macros. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/837843002
2015-01-06Resolve all but two VC++ build warnings in pdfium.Bruce Dawson
pdfium builds on Win32 have about 85 warnings (250 in the XFA branch, totaling over 480 lines!), mostly from four lines in a header file and a warning that should be disabled. This change resolves all but two of them and turns on warning-as-errors. Bugs have been filed for the two remaining warnings: https://code.google.com/p/pdfium/issues/detail?id=100 the 64-bit warnings: https://code.google.com/p/pdfium/issues/detail?id=101 and the Linux warnings: https://code.google.com/p/pdfium/issues/detail?id=102 The fix to the double->float truncation bugs will also improve code-generation. R=bo_xu@foxitsoftware.com, scottmg@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/792953005
2015-01-05Cleanup: Get rid of CRLF line endings.Lei Zhang
R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/837533003
2015-01-05Re-enable pdfium_unittests.chromium/2271chromium/2270chromium/2269Tom Sepez
In order for the standalone pdfium build to succeed, DEPS is updated to pull in gtest, and a stub gtest.gyp file is provided (which is unused under a chromium checkout). R=brucedawson@chromium.org, thakis@chromium.org Review URL: https://codereview.chromium.org/835233002
2015-01-05Update externs in unicodenormalization.cpp to not have array sizes.Lei Zhang
This is a follow-up to f9640495. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/825983004
2015-01-05Get rid of g_timeMap global object.Bruce Dawson
g_timeMap is a global variable with a constructor and destructor so it must be removed. BUG=441899 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/832703003
2015-01-05Fix an array size mismatch.Lei Zhang
The g_UnicodeData_Normalization_Map2 array is initialized with a size of 1724 in core\src\fpdftext\unicodenormalizationdata.cpp but its size is 1734 (+10) in core\src\fpdftext\unicodenormalization.cpp, 1724 seems to be the real size (i.e. there's 1724 values in the initialization list). BUG=446057 Original Author: sebmarchand@chromium.org Original CL: https://codereview.chromium.org/837523002/ Review URL: https://codereview.chromium.org/812843004
2015-01-05Remove run-time calculation of hash constants in pdfium.Bruce Dawson
PDFium static initializers must go. Static initializers are prohibited by the style guide. They have negative consequences including increased startup time (from pulling in additional code pages) and reduced sharing of data pages (since the variables can't go in the read-only data segment). This change uses a template struct and typed enums to reproduce JS_CalcHash at run-time. An unsigned long long constant and masking with 0xFFFFFFFF are used to avoid compile errors due to integer overflow of compile-time constants. The HashVerify class is used to check the results, necessary since none of the functions in global.cpp are called when pdfium_test.exe runs. const_expr would be a much cleaner way to implement this change but it is not yet widely supported. On the Windows release build this reduces the code size (.text virtual size) by 0x240 (576) bytes, the .data section by 0x20 bytes (for eight unsigned globals), and the .rdata section by 0x20 bytes (the unneeded string savings, minus the eight unsigned globals now being there). BUG=441899 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/792043005
2015-01-05Get rid of fifteen copies of m_sTimeMap and their initializers.Bruce Dawson
m_sTimeMap is a global variable with a constructor and destructor, which is not allowed. This change moves it to a function with a static pointer so that it is constructed on demand and then leaked, thus avoiding having startup and shutdown code. This also fixes a worrisome bug caused by having m_sTimeMap defined in a header file. Because m_sTimeMap was defined (and marked as static) in a header file there were fifteen separate copies of it, one for each source file which included the header file. This could easily lead to bugs because a timer that was added from one source file would be invisible to other source files. Each instance of m_sTimeMap added four entries to the dump-static-initializers.py report, for a total of sixty, so this fix significantly cleans up that report. BUG=441899 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/831903002
2015-01-05Clean up bookmark related codes.Bo Xu
Remove CPDF_Dictionary*() operator in CPDF_Bookmark class. Unify naming conventions and coding styles. Change some functions to const. Change the name of function argument to |pDict| for FPDF_xxx type variable. This makes the code more clear and gives better variable naming R=tsepez@chromium.org Review URL: https://codereview.chromium.org/828203002
2015-01-05Remove static declared SymbolDictCache.Bo Xu
This is a follow up CL on https://codereview.chromium.org/761313004/ BUG=https://code.google.com/p/pdfium/issues/detail?id=93 R=brucedawson@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/828183002
2015-01-05In windows printing, convert src bitmap to dest bitmap using CompositeBitmap.Bo Xu
When dealing with transparency, the printing procedure will generate a bitmap first, then draw this bitmap in windows DC. The format of source bitmap is argb, but the destination bitmap is rgb. Simply doing memcpy will lose the alpha channel information, so CompositeBitmap function is needed. BUG=412908 R=vitalybuka@chromium.org Review URL: https://codereview.chromium.org/826633002
2015-01-02Remove g_NaN global variable and its constructor.Bruce Dawson
Doing the type conversion on demand is just as efficient as doing it at startup time, and makes for more efficient startup. Also mark g_nan as const, to reduce .data section size and enforce desired semantics. BUG=441899 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/788143009
2014-12-30Get rid of FX_LPCSTR cast.Bo Xu
Follow up on https://codereview.chromium.org/733693003 R=brucedawson@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/809993004
2014-12-29Revert build of pdfium_unittests.Tom Sepez
Buildbot fails with the recent changes. Review URL: https://codereview.chromium.org/796243003
2014-12-29Fix pdfium buildbot build breakage from 336991d.Tom Sepez
Looks like some dependencies were missing during the run at http://build.chromium.org/p/client.pdfium/builders/linux/builds/31/steps/gyp_pdfium/logs/stdio TBR=brucedawson@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/833503003
2014-12-29Create pdfium_unittests binary.Tom Sepez
PDFium has not yet had a unit-tests binary, so introduce one based on the typical gtest framework. Also provide a small initial test fragment for fxcrt strings for instructional purposes. Naturally, doing so kicked out one corner case that isn't handled, we'll fix that in a separate patch. This is a small part of the testing strategy tracking bug. BUG=https://code.google.com/p/pdfium/issues/detail?id=62 R=brucedawson@chromium.org, palmer@chromium.org Review URL: https://codereview.chromium.org/831653002
2014-12-19Refactor some code in CPDF_TextPage::ProcessTextObject().Lei Zhang
Fix a memory leak while we are at it. R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/813153002
2014-12-19Fix new third_party/BUILD.gn to use the right build configuration.Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/817813004
2014-12-19Set the freetype options missing in the recent update.Bo Xu
Turn on the FT_CONFIG_OPTION_SUBPIXEL_RENDERING to enable sub-pixel rendering. Also undef some other options to match what they look like before. BUG=444243 R=thestig@chromium.org Review URL: https://codereview.chromium.org/789163008
2014-12-19Add the license back to ftmodule.h after the freetype 2.5.4 upgrade.Lei Zhang
Review URL: https://codereview.chromium.org/815333002
2014-12-19Transform font size to user space for valid text size comparison.Bo Xu
BUG=438441 R=thestig@chromium.org Review URL: https://codereview.chromium.org/816153002
2014-12-19Update freetype to 2.5.4.Bo Xu
Put freetype into third_party directory, cleaning up header files. Previously freetype header files are in core/src/fxge/freetype and core/include/thirdparties. There were also multiple fx_freetype.h. This patch removes the additional Foxit wrapper to make further update easier. Notice, for original freetype source code, the following files are modified and need to be updated accordingly in future update: third_party/freetype/include/config/ftmodule.h third_party/freetype/include/config/ftoption.h BUG=407341 R=thestig@chromium.org Review URL: https://codereview.chromium.org/815103002
2014-12-19Fix a few windows compile warningschromium/2268chromium/2267chromium/2266chromium/2265chromium/2264chromium/2263chromium/2262chromium/2261chromium/2260chromium/2259chromium/2258chromium/2257chromium/2256Bo Xu
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/817753002
2014-12-18Cleanup: Refactor some code into its own function in fpdf_text_int.cpp.Lei Zhang
Also use stdlib algorithms in a few places. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/810223003
2014-12-18Merge: Fix obvious compilation breakage on win32 in previous version.Tom Sepez
TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/814903002 Review URL: https://codereview.chromium.org/816743002