summaryrefslogtreecommitdiff
path: root/testing
AgeCommit message (Collapse)Author
2018-10-24Be more particular about FX objects constructed from JSTom Sepez
This is back-filling some more error cases from the work from a few weeks ago. Replaces a lambda with a static CallHandler() method since the verbosity was increasing. It gets invoked if you try to make a new FXJS object from the javascript side, rather than the C++ side. Making such an object is a little tricky, since we don't give these functions names in V8, but they can be obtained via constructor property from an instance of the object. Change-Id: Ibca686e75338ac54d08a114f36f930cd424a1eb5 Reviewed-on: https://pdfium-review.googlesource.com/c/44534 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-23Test color.convert() and equal() from JS (and fix comparison logic).Tom Sepez
Currently, color.equal(a, b) may not give the same result as color.equal(b, a) since arg1 is converted to be the type of arg2, and some of these conversions lose information. Instead promote to the type with the most components in the hope of preserving the most information. Better error message when there are the right number of parameters but the types are wrong. Change-Id: I1d93fa29db4fb65e0f7c07c3ba7d9ca87ebf7bc9 Reviewed-on: https://pdfium-review.googlesource.com/c/44413 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-23Split field.in into field_properties.in and field_methods.inTom Sepez
Matches the conventions of the other JavaScript tests. Change-Id: I9dc41e3964220db03f57b9ab30289e0c19b042da Reviewed-on: https://pdfium-review.googlesource.com/c/44531 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-22Modernize app.* JS method tests.chromium/3590Tom Sepez
Also add several missing cases. Change-Id: I38aa1fdacf839975249957267ffb121ad609aec5 Reviewed-on: https://pdfium-review.googlesource.com/c/44430 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-22Consolidate app_*.in tests into app_methods.inTom Sepez
One file per method is excessive. Change-Id: I02e3e9dffd2fc2d98f77f15a4669bd15c0119dd3 Reviewed-on: https://pdfium-review.googlesource.com/c/44412 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-22Add missing property to event_properties.inTom Sepez
Change-Id: I63c2f2c416d3270061fcffd0c9d0a82c10de88d2 Reviewed-on: https://pdfium-review.googlesource.com/c/44411 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-22Call last uncovered document methods.Tom Sepez
Test-only CL. Change-Id: Ica1613c42075adb5fedfef6d66d99095cef08655 Reviewed-on: https://pdfium-review.googlesource.com/c/44410 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-22Add FPDFFormFillEmbeddertest.DocumentAActions.Tom Sepez
Provides coverage for CJS_EventContext::OnDoc_* methods. Change-Id: I65dff8fe5af4a9c11ac8fffabe209ad497586b1c Reviewed-on: https://pdfium-review.googlesource.com/c/44392 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-22Fix timezone inconsistency in document methods test.Tom Sepez
We do this by adding an override that forces GM time on everyone when run from the test harness. Generalize presubmit warnings so that the new function passes. De-duplicate lambda capture in place of static function. Change-Id: I15b34bea558baf1763476b36f0bca76614984107 Reviewed-on: https://pdfium-review.googlesource.com/c/44390 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-19Roll v8/ c623fabe5..604c50c84 (9 commits)Lei Zhang
https://chromium.googlesource.com/v8/v8.git/+log/c623fabe5643..604c50c84e67 Version 7.1.132 Update array_buffer JS test to adjust for https://chromium.googlesource.com/v8/v8/+/5cfe1a6b on Windows for 32-bit and ASAN builds. Change-Id: I7cfea684ab56d4a809989a7f029d7fc013eac372 Reviewed-on: https://pdfium-review.googlesource.com/c/44370 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-18Fully populate JS platform callbacks in pdfium_testTom Sepez
Adjust expected results accordingly. Order functions to match platform member order. Change-Id: I3d5f8e3ef8f532af0891b7fbbc1a8305d1922a75 Reviewed-on: https://pdfium-review.googlesource.com/c/44311 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-18Try assigning more kinds of values to doc propsTom Sepez
Change-Id: I99b28f5f047f9043bd95f76f17970d1979276d63 Reviewed-on: https://pdfium-review.googlesource.com/c/44310 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-18Expand CJS_Document::mail{Doc,Form}() parametersTom Sepez
Use ExpandKeywordParams() rather than ad-hoc processing. Add test case for {} argument. Change-Id: I1f60a87b3995d62f4bead79245a1f58fd31b102e Reviewed-on: https://pdfium-review.googlesource.com/c/44290 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-18Remove PrintParams object.Tom Sepez
The only way to theoretically get one is via doc.getPrintParams(), and it always returns in error. Even if one were returend to JS, there aren't any methods/callbacks to change its properties. Even if there were methods to change its properties, the information it stores doesn't align with what is in the JS spec for this object. Even if it were aligned with the JS spec, the way we check for its presence as the ninth parameter in CJS_Document::print() doesn't match the way its use is documented in the spec as the sole first parameter. Instead implement the older, simpler behaviour as spec'd prior to 6.0, and toss this enhancement altogether. Move function to check the result of ExpandKeywordParams() to js_define.h so other files can use it. Update comment in that file to remove reference to deprecated enum. Expand test for API and introduce callback to log parameters. Change-Id: I047e2be0d2afbad91d6b58c6c74bbea083fed330 Reviewed-on: https://pdfium-review.googlesource.com/c/44271 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-18Do more IWYU in fxjs/.Lei Zhang
Change-Id: I778085c6e21904e697d5899a93f4e4e9fca92478 Reviewed-on: https://pdfium-review.googlesource.com/c/44272 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-18Forward declare some fxjs/ classes.Lei Zhang
And remove unnecessary fxjs/ #includes in header files. Change-Id: If89dd2717b6ba93dbb7493e8ca80d78deaa64b06 Reviewed-on: https://pdfium-review.googlesource.com/c/44270 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-18Remove a few V8 includes from header files.Lei Zhang
Change-Id: I087c4e712aa87f99ada4ef515f5b361037a5dae0 Reviewed-on: https://pdfium-review.googlesource.com/c/44257 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-18Push/pop the graphics state stack when flattening.Lei Zhang
When FPDFPage_Flatten() manipulates a content stream, it replaces the content stream with a content stream array. The first element in the array is the original content stream and the second element in the array is the flattened annotations content. To make sure the original content stream's graphics state stack does not affect the flattened annotations, FPDFPage_Flatten() rewrites the original content stream to be: q $contents Q When FPDFPage_Flatten() manipulates a content stream array, it just appends the flattened annotations as a new element in the array. This may result in graphics state stack leaking out. To fix this, wrap the content stream array to be: ["q", $content1, ..., $contentN, "Q"] And then append the flattened annotations. BUG=chromium:896366 Change-Id: Ic6499e39eb4c9f1fe45d037622bf02be724b6cae Reviewed-on: https://pdfium-review.googlesource.com/c/44252 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-18Add JavaScript tests for event API.Tom Sepez
Change-Id: Ic62fd1c6e55e6db5864e124fe3ba50e05b0020e1 Reviewed-on: https://pdfium-review.googlesource.com/c/44210 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-18Add JavaScript public methods tests.Tom Sepez
Still very preliminary. Alphabetize table in .cpp file to match test. Bug: pdfium:1028 Change-Id: Ia3b646507e1a2ec384bf59893cd1d74c2a4b2456 Reviewed-on: https://pdfium-review.googlesource.com/c/43980 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-17Fix typo in coverage_report.py.Lei Zhang
BUG=pdfium:1174 Change-Id: I4ade5c52f505690d14683cb094cc13c6fd9441f4 Reviewed-on: https://pdfium-review.googlesource.com/c/44173 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-16Make {A85,RunLength}Encode()'s buffer out parameter a unique_ptr.Lei Zhang
Change-Id: I3f06ea7ed39c8a8fff57e07f14ff6c21bedbc028 Reviewed-on: https://pdfium-review.googlesource.com/c/43998 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Split pdfium_embeddertests sources.chromium/3582Lei Zhang
Move foo_embeddertest.cpp to the same BUILD.gn file as foo.cpp. Set up dependencies to make pdfium_embeddertests pass gn check. Change-Id: If1fe67c261960c35c344c1047950cd7fdb32c4a1 Reviewed-on: https://pdfium-review.googlesource.com/c/43997 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Split pdfium_unittests sources.Lei Zhang
Move foo_unittest.cpp to the same BUILD.gn file as foo.cpp. Set up dependencies to make pdfium_unittests pass gn check. Change-Id: Id9f649d5d0c76fe4254f3887778516abb75fcbce Reviewed-on: https://pdfium-review.googlesource.com/c/43995 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Clone dict before iteration in CJS_Document::get_infoTom Sepez
Bug: 895152 Change-Id: I678350841892f88a5d580b58a33a639a1b6ec305 Reviewed-on: https://pdfium-review.googlesource.com/c/44050 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-13Make testing/ pass gn check.Lei Zhang
Change-Id: Ifb2d60bf3c2d86a105705196d65e318081cefe4e Reviewed-on: https://pdfium-review.googlesource.com/c/43981 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-12Add setters/getters for BleedBox and TrimBox.xlou
Since BleedBox and TrimBox are supported according to PDF specification, hence added setters and getters to get the value if exists. Bug:894655 Change-Id: I3c2600450f07665241a4724457a7cbc4282941ed Reviewed-on: https://pdfium-review.googlesource.com/c/43977 Commit-Queue: Shirleen Lou <xlou@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-12Beef up coverage in CJS_Field.Tom Sepez
Still a long way to go, but hit the easy ones first. Alphabetize property names in cjs_field.cpp file. Change-Id: I1ede770a1e159d464287775cf9e19cbaf9f2a62f Reviewed-on: https://pdfium-review.googlesource.com/c/43978 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-12Beef up CJS_Document method coverage.Tom Sepez
Also alphabetize mailDoc method position in .cpp file. Change-Id: Ifb53e9a6f5f165bb41b865d51dae15e3bc84c4c7 Reviewed-on: https://pdfium-review.googlesource.com/c/43972 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-12Add test for CJS_Annot JS callbacks.Tom Sepez
Change-Id: I8ef9bb333e786e833faca75566730a5b441d63c2 Reviewed-on: https://pdfium-review.googlesource.com/c/43830 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-12Remove more unnecessary includes and do IWYU as needed.Lei Zhang
Also move some implementations out of headers. Change-Id: I321fc26970c440d874b135bd28e8bc8156b9afee Reviewed-on: https://pdfium-review.googlesource.com/c/43890 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-12Move core/fdrm/crypto/* to core/fdrm/.Lei Zhang
core/fdrm/ currently only contains the crypto directory. Change-Id: I68f4a38e7098f8a3bdc19764bc1ec78c28a386c9 Reviewed-on: https://pdfium-review.googlesource.com/c/43945 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-12Split constants and testing build rules into their own BUILD.gn files.Lei Zhang
Change-Id: I3a100e1f009f18ee06959edf47d189d1bfdcb25a Reviewed-on: https://pdfium-review.googlesource.com/c/43944 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-10-12Add test for CJS_Color properties.Tom Sepez
Return a more precise error in one case. Change-Id: I21e4ef6b30be5f44d35922640643bffb9cb4b5e4 Reviewed-on: https://pdfium-review.googlesource.com/c/43950 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-12Add tests for CJS_Console methods.Tom Sepez
Change-Id: Ie534b26d8241e889ad9cdca942e142cddca44bf4 Reviewed-on: https://pdfium-review.googlesource.com/c/43933 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-12Add minimal pixel test for a rendering bug.Lei Zhang
The test is suppressed because it currently renders incorrectly. BUG=pdfium:632 Change-Id: Ie780e2128ef3a0bcf5f7d57b164ae38f03b1e9fd Reviewed-on: https://pdfium-review.googlesource.com/c/43090 Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-11Add functions to get/set ArtBox.chromium/3578xlou
There are PDFs that use ArtBox. In some use cases, user may scale a page, scale up/down MediaBox and CropBox. So if ArtBox exists, it needs to be scaled as well. Bug:409670 Change-Id: I78ac7afa66942352277f856514bdd9b15dda270b Reviewed-on: https://pdfium-review.googlesource.com/c/43931 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Shirleen Lou <xlou@chromium.org>
2018-10-11Enable jumbo support for PDFium fuzzers.Lei Zhang
Make fuzzer helpers that are mutually exclusive use the same name for their global variables. If any target tries to include both, the jumbo build will likely fail. BUG=pdfium:964 Change-Id: Idadbc86ff990bf1e8c7cfb3500f1f191a96432db Reviewed-on: https://pdfium-review.googlesource.com/c/43850 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-11Fix double V8 initialization with fuzzers.Lei Zhang
Commit 95860d7 added some new fuzzers, but they try to use both the generic fuzzer's initialization code, as well as their own custom initialization code. Add a new "pdfium_public_fuzzer" GN template for these new fuzzers, so they use their own initialization code rather than the generic one. BUG=chromium:894053 TBR=tsepez@chromium.org Change-Id: I6110a199e1c64d7c0632f9966e146fd316b757ae Reviewed-on: https://pdfium-review.googlesource.com/c/43832 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-10Use optipng to optimize expected .pngs when regenerating them.Henrique Nakashima
Bug: pdfium:1127 Change-Id: I5371ecf6f704761320a021fbee07a79839fb80b7 Reviewed-on: https://pdfium-review.googlesource.com/c/43810 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-10-10Create embeddertests for other kinds of actions.Tom Sepez
Change-Id: Ia4619be65e2ab8ee4bf19ba9608c1cc94594ba89 Reviewed-on: https://pdfium-review.googlesource.com/c/43812 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-10Catch SSL errors when fetching Gold JSON data.Lei Zhang
Also increase timeout value when retrying. Change-Id: I14dd3f76fd1a7555c3a5e1bd8c7bf8f214bc8ec0 Reviewed-on: https://pdfium-review.googlesource.com/c/43616 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-09Do IWYU for retain_ptr.h and unowned_ptr.hLei Zhang
Change-Id: I2897feee27f80c85f0328f0b220ae5be93686170 Reviewed-on: https://pdfium-review.googlesource.com/c/43610 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-09Copy some fuzzer code from Chromium into PDFium.Lei Zhang
These came from Chromium's pdf/pdfium/fuzzer directory. The code has been modified to be buildable in standalone PDFium and modernized. Change-Id: Ia4ddad4a164f798689af4b9f92d41d635901dccb Reviewed-on: https://pdfium-review.googlesource.com/c/43530 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-09Do IWYU for ptr_util.h.Lei Zhang
Change-Id: Ib96a66eb47bea791f061e1d6da8aadad8037a99d Reviewed-on: https://pdfium-review.googlesource.com/c/43609 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-04Change |virtual ~Foo(){}| to |virtual ~Foo()=default;|chromium/3571Tom Sepez
Otherwise code coverage flags the empty body as unreachable. Change-Id: Iee1d9a876d68276529c70d9b8c7a28276f271767 Reviewed-on: https://pdfium-review.googlesource.com/c/43514 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-03Reland "Make potentially dangerous Actions require a user click."Henrique Nakashima
This is a reland of 9d784c291714b703b16185e69860a3797de85b6c https://chromium-review.googlesource.com/c/chromium/src/+/1244367 was submitted changing the test that broke with this CL to not depend on PDF OpenActions anymore. Original change's description: > Make potentially dangerous Actions require a user click. > > URI and SubmitForm actions are only handled if the event was > ButtonUp or ButtonDown. > > Bug: 851821 > Change-Id: If6eb0ff44f6d62ac6df50b552c0bdc582885ab5d > Reviewed-on: https://pdfium-review.googlesource.com/42731 > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Reviewed-by: Ryan Harrison <rharrison@chromium.org> Bug: 851821 Change-Id: Iaf9c399059590f0f1a050ac450e08ee60a8d5a38 Reviewed-on: https://pdfium-review.googlesource.com/43410 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-10-02Remove unneeded cfgas_fontmgr.h includes.Lei Zhang
Fix IWYU issues in affected files. Change-Id: I92c145348549d2d0f0e066e134e649b3b958e068 Reviewed-on: https://pdfium-review.googlesource.com/c/43313 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-02Remove ability to delete annot in CJS_Document::removeField()Tom Sepez
This path has only been present under XFA, and has resulted in several bugs, including the referenced one. There is a breakage in some XFA functionality, but I'm not confident we can do this without re-engineering all of fpdfsdk widget ownership. Bug: 891210 Change-Id: I5aa158fa5359b1c8338046eefb25fb25df9ace48 Reviewed-on: https://pdfium-review.googlesource.com/c/43311 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-02Fix nits in gold.py.Lei Zhang
Change-Id: I4a47a3d7c7a66de08217dc33d5f6f324e3e6a41c Reviewed-on: https://pdfium-review.googlesource.com/43312 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>