summaryrefslogtreecommitdiff
path: root/testing/embedder_test.cpp
AgeCommit message (Collapse)Author
2018-09-24Revert "Make potentially dangerous Actions require a user click."Henrique Nakashima
This reverts commit 9d784c291714b703b16185e69860a3797de85b6c. Reason for revert: Roll into chromium is stuck, this is a potential culprit. 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> TBR=tsepez@chromium.org,hnakashima@chromium.org,rharrison@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 851821 Change-Id: I6f1bc0a02f65a24fbd49d53526b985f8a4ea0b4f Reviewed-on: https://pdfium-review.googlesource.com/42990 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-09-20Make potentially dangerous Actions require a user click.Henrique Nakashima
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>
2018-08-16Add a way to save a barcode generated bitmap to a .png.Henrique Nakashima
This is useful for debugging and validation purposes. The hashes that are in BarcodeTest are not necessarily for valid outputs. This CL refactors the code in embedder_test.png that already does this, moving it to testing/utils where unit tests can access it too. Bug: pdfium:1135 Change-Id: I6f1d70a4e133f8f04dbe52646087f99c448e95f8 Reviewed-on: https://pdfium-review.googlesource.com/40152 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-08-14Remove more default arg = nullptr cases.Tom Sepez
Bring in line with standards. Remove argument entirely for mac code that is always nullptr. Change-Id: I0710bdbd51fc0bc2e1d428ef44976be39a631147 Reviewed-on: https://pdfium-review.googlesource.com/40091 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-12Reland "Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream()."Artem Strygin
This is a reland of 77f15f7883638a4ced131d74c053af10a5970ce9 Original change's description: > Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream(). > > Allow sub-streams created from an IFX_SeekableReadStream to provide > stream data without copying memory. > The data will only reside in the top-level stream. > > For example: > For file > http://www.major-landrover.ru/upload/attachments/f/9/f96aab07dab04ae89c8a509ec1ef2b31.pdf > (18 Mb) > > The memory usage is reduced by ~13 Mb. > > Change-Id: I2595c014d0fbe1fdd181cc04965cfd7d901c2d88 > Reviewed-on: https://pdfium-review.googlesource.com/35930 > Commit-Queue: Art Snake <art-snake@yandex-team.ru> > Reviewed-by: dsinclair <dsinclair@chromium.org> Change-Id: I4c4d5dcf42ff44784468ac7a7c302df509fc804d Reviewed-on: https://pdfium-review.googlesource.com/37313 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-07-06Revert "Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream()."Henrique Nakashima
This reverts commit 77f15f7883638a4ced131d74c053af10a5970ce9. Reason for revert: Causes crbug.com/860210 Bug: chromium:860210 Original change's description: > Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream(). > > Allow sub-streams created from an IFX_SeekableReadStream to provide > stream data without copying memory. > The data will only reside in the top-level stream. > > For example: > For file > http://www.major-landrover.ru/upload/attachments/f/9/f96aab07dab04ae89c8a509ec1ef2b31.pdf > (18 Mb) > > The memory usage is reduced by ~13 Mb. > > Change-Id: I2595c014d0fbe1fdd181cc04965cfd7d901c2d88 > Reviewed-on: https://pdfium-review.googlesource.com/35930 > Commit-Queue: Art Snake <art-snake@yandex-team.ru> > Reviewed-by: dsinclair <dsinclair@chromium.org> TBR=tsepez@chromium.org,dsinclair@chromium.org,art-snake@yandex-team.ru # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: I947fca17052765935a952a4f25ca48f6599c4af9 Reviewed-on: https://pdfium-review.googlesource.com/37210 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-07-03Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream().Artem Strygin
Allow sub-streams created from an IFX_SeekableReadStream to provide stream data without copying memory. The data will only reside in the top-level stream. For example: For file http://www.major-landrover.ru/upload/attachments/f/9/f96aab07dab04ae89c8a509ec1ef2b31.pdf (18 Mb) The memory usage is reduced by ~13 Mb. Change-Id: I2595c014d0fbe1fdd181cc04965cfd7d901c2d88 Reviewed-on: https://pdfium-review.googlesource.com/35930 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-06-06Embedder tests can write saved PDFs to a file for debugging.Henrique Nakashima
Before calling a method that use EmbedderTest as FPDF_FILEWRITE (usually calling FPDF_SaveAsCopy()), call: OpenPDFFileForWrite("Filename.pdf"); After the write, close the stream with: ClosePDFFileForWrite(); Change-Id: Id1e7f778a9ff2b2b5bf976d49b485d5cb15f94bd Reviewed-on: https://pdfium-review.googlesource.com/34150 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-06-05Revert "Convert (void) to static_cast<void> in C++ code"Ryan Harrison
This reverts commit 80c6ab7b99bcbd7b940f78dc0cac52c30249f59c. Reason for revert: (void) idiom is prevalent through out C++ code. Original change's description: > Convert (void) to static_cast<void> in C++ code > > Converting instances of old C-style void casts to suppress return > values to use C++ style static cases. There are a few examples of > (void) that remain, since they are in C code, and the third_party/ > instances are not touched at all. > > Change-Id: I72b3fc0e1d713db669b76135e03d1cf87873a2fe > Reviewed-on: https://pdfium-review.googlesource.com/33790 > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> > Commit-Queue: Ryan Harrison <rharrison@chromium.org> TBR=thestig@chromium.org,tsepez@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org,rharrison@chromium.org Change-Id: Ib6cc021c97cb1ea7c71b90346fa9b500659f565d No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/33890 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-06-04Convert (void) to static_cast<void> in C++ codechromium/3450Ryan Harrison
Converting instances of old C-style void casts to suppress return values to use C++ style static cases. There are a few examples of (void) that remain, since they are in C code, and the third_party/ instances are not touched at all. Change-Id: I72b3fc0e1d713db669b76135e03d1cf87873a2fe Reviewed-on: https://pdfium-review.googlesource.com/33790 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-04-25Introduce ScopedFPDF types in public/cpp/fpdf_scopers.hTom Sepez
Applies std::remove_ptr to the public API types so that we can deduce a correct unique ptr type no matter how that API might change away from void* usage. Creates shorter names for std::unique_ptr<std::remove_pointer<>, ...> Change-Id: I04a0ff43cb7d5a4d3867939a53a54c9cef00db86 Reviewed-on: https://pdfium-review.googlesource.com/31292 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-23Disable JavaScript entirely if no JSPlatform passed by embedder.Tom Sepez
Allows run-time selection of whether to permit JS inside PDF. Previously, this was a link-time decision only. This requires a little more caution before we decide that we have the CJS_Runtime, and not the CJS_RuntimeStub in a few casts. Adds a kDisableJavaScript option to the form fill embeddertests. Adds a --disable-javascript flag to the pdfium_test executable. Also adds a --disable-xfa flag while we're at it. Change-Id: I8d8ac95f6474459cadba9a60572fbb342e984646 Reviewed-on: https://pdfium-review.googlesource.com/31090 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-03-02Make EmbedderTest::WriteBitmapToPng() work with grayscale images.chromium/3362chromium/3361chromium/3360Lei Zhang
Change-Id: I88d350171e2b18dc7776d17e845b55c361845721 Reviewed-on: https://pdfium-review.googlesource.com/27811 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-12Get rid of EmbedderTest::RenderPageWithFlagsDeprecated().Lei Zhang
Change-Id: I653619faa61181137795bb3675418fd8d0945d25 Reviewed-on: https://pdfium-review.googlesource.com/25590 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-09Get rid of EmbedderTest::RenderPageDeprecated().Lei Zhang
Change-Id: I8c6d813e488b2612a85fb1973382f979728df563 Reviewed-on: https://pdfium-review.googlesource.com/25571 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-08Do page load/unload checks in EmbedderTest for saved pages.chromium/3344Lei Zhang
Change-Id: I9286b24957f9d96da10869098eb0e04991bd6571 Reviewed-on: https://pdfium-review.googlesource.com/25570 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-08Do more page load/unload checks in EmbedderTest.Lei Zhang
- Keep track of pages in a single map when calling LoadPage(). It is simpler and performance is not crucial as the number of loaded pages is usually very small. - Verify UnloadPage() is only called for loaded pages. - Verify there are no loaded pages in TearDown(). - Verify RenderLoadedPage methods are only rendering loaded pages. - Fix pages that are using FPDF_LoadPage() and FPDF_ClosePage() when they should be using LoadPage() and UnloadPage(). - Disallow calling LoadPage() for the same page number repeatedly. No caller does this and it makes verification in UnloadPage() harder. Change-Id: I58878ea8ade21dde28f1bbebd3a3304ce677561d Reviewed-on: https://pdfium-review.googlesource.com/25550 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-07Clean up RenderPage methods in EmbedderTest.Lei Zhang
Add replacement methods that make themselves clear as to what they are rendering, and return unique_ptrs to help prevent leakage. Mark existing methods deprecated. Change-Id: I9055407e614dfbe765428fb32a7da64df3418d1d Reviewed-on: https://pdfium-review.googlesource.com/25470 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-05Make EmbedderTest class member style consistent.Lei Zhang
The class started with |foo_bar_| but now has a mixture of |foo_bar_| and |m_FooBar|. Change them all to |foo_bar_|. While making this change, also initialize the members in the header when possible. Change-Id: I202ff5dc5e945175ad4da2f3245724f3493aa8aa Reviewed-on: https://pdfium-review.googlesource.com/25390 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-01-17Pass ios_base::binary so WriteBitmapToPng works on Windows.Henrique Nakashima
Bug: pdfium:981 Change-Id: I87d750cd8de079dfc61923fee58af42518f5b6d1 Reviewed-on: https://pdfium-review.googlesource.com/23090 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-01-16Add WriteBitmapToPng to EmbedderTest.Henrique Nakashima
This is a util method to output the png to a file for visually validating the result of an embedder test. Once validated, the md5 can be considered correct. Bug: pdfium:981 Change-Id: I544dfbf2e85295e6ca2cdf48d1bc3f0bd5f415e9 Reviewed-on: https://pdfium-review.googlesource.com/22990 Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-01-12Use enum for tracking form field typesRyan Harrison
Within PDFium use enum class for better type safety when working with form field types. These values will still be converted to ints as part of the public API, since that is the existing API. This work is preperation for extending the number of form field types to have more specific entries for XFA. BUG=pdfium:952,chromium:763129,chromium:592758 Change-Id: Ie6c29f02ae22be782ff36eb87d27f1a4bf2c099e Reviewed-on: https://pdfium-review.googlesource.com/22742 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-01-08Initialize V8 once in embedder testsDan Sinclair
This CL moves the initialization of the V8 platform to happen in the GTest environment so it's only run once. This takes the CFXJSE_FormCalcContextEmbedderTest Debug time from ~25s to ~19s on my local machine. Bug: pdfium:928 Change-Id: Ie8c27606721e7056de42e7d9474b0621f1e7212f Reviewed-on: https://pdfium-review.googlesource.com/22070 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-20Avoid default arguments in EmbedderTest::OpenDocument().chromium/3300Lei Zhang
Default arguments are banned on virtual functions. Remove default arguments and rename OpenDocument() to OpenDocumentWithOptions(). Add wrappers for OpenDocumentWithOptions() to call it with sensible options. Change-Id: I4955d88cf77a7eab1771692ea3d6a18260b52900 Reviewed-on: https://pdfium-review.googlesource.com/21891 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-11-10Add FPDFSaveEmbedderTest.SaveLinearizedDocchromium/3267chromium/3266Henrique Nakashima
Bug: pdfium:614 Change-Id: I3c6cd16dfe0ac5db66cc9e996d3f4e74a5d9d716 Reviewed-on: https://pdfium-review.googlesource.com/18251 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-11-10Stop using m_SavedPage in embedder tests.chromium/3265Henrique Nakashima
Change-Id: Id53f57085fecfe331c8cbfa6bb372b5ea5044442 Reviewed-on: https://pdfium-review.googlesource.com/18332 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-10-18Fix rounding of colour valuesDan Sinclair
This CL fixes rounding issues with the colour values when written then read from path objects. Bug: pdfium:919 Change-Id: I8ab33706f1c7d81c3ec755706b1a613cf2a557b3 Reviewed-on: https://pdfium-review.googlesource.com/16270 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-18Refactor HasXFAField into HasFormInfoRyan Harrison
The existing API is too restrictive for collection the metrics information that we want. Specifically it only tells us if there are XFA forms in the document, but not AcroForms. This refactoring makes the method more general, so that non-XFA information is provided also. This change in semantics of the return value required some changes at the call sites of the API. BUG=chromium:775519 Change-Id: Id421c66c09b47196c252c64cdc2c711ca1911de0 Reviewed-on: https://pdfium-review.googlesource.com/16210 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-17Convert XFA Doc Types to be more preciseRyan Harrison
The existing types are PDF, Dynamic & Static, which are poorly named since they don't really convey the fundamental differences between the types. "PDF" is confusing because PDFium only handles PDFs, and "Dynamic" & "Static" describe what a form may do, not how it is specified or some other fundamental difference. The terms "Dynamic" and "Static" were especially confusing, since XFAF documents must be static by definition, whereas full XFA documents can be either dynamic or static, depending on whether or not they change their layout. The types have been renamed to be clear that they are talking about the type of PDF document being described. "PDF" becomes "None", since this is used to indicate that there are no XFA forms in the document. "Dynamic" becomes "Full", since this indicates that the entire XFA spec is being used for the forms, specifically display layout is in the XML. "Static" has become "ForegroundOnly", since the form is specified using the XFAF (XFA Foreground) subset of the spec. The terms Full & Foreground come from the XFA spec. I would have preferred XFAF to have a different name, since it is the display/foreground layer that isn't XFA when using it. BUG=pdfium:917 Change-Id: I4335958c4a11d77d3bbe63b93602dd5bc14acb57 Reviewed-on: https://pdfium-review.googlesource.com/16010 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-28Implement FakeFileAccess.Artem Strygin
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>
2017-08-03APIs and tests for extracting bitmaps from image objectsJane Liu
Added FPDFImageObj_GetBitmap() that returns the bitmap of an image object, and a FPDFBitmap_GetFormat() that returns the format of a bitmap. * Fixed a small bitmap conversion bug in cfx_dibsource.cpp. * Enabled EmbedderTest::CompareBitmap() to support different formats of bitmaps. * Added an embedder test and a test PDF file with images of many different formats. Bug=pdfium:677 Change-Id: I6a72f9d969cf5f3577db9400ca33197c213622ed Reviewed-on: https://pdfium-review.googlesource.com/9690 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-07-13Add Embeddertest for password after savingchromium/3157Nicolas Pena
This CL allows TestSaved to open password-protected and linearized documents properly. It also adds a test with one such document. BUG= pdfium:787 Change-Id: Ie0da7f290711505fb208794afdc737c36e84dd3c Reviewed-on: https://pdfium-review.googlesource.com/7034 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-05Allow EmbedderTest to test savingNicolas Pena
This CL adds helper methods for EmbedderTest to save. This means that TestSaver is no longer needed and all the methods it uses are moved to the EmbedderTest. Change-Id: I740f29699bfd8c6b570cb1fd85e7aab9bc1d3f6f Reviewed-on: https://pdfium-review.googlesource.com/7171 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-06-29Basic APIs and tests for extracting and setting annotation pathsJane Liu
1. Added APIs for retrieving existing annotation paths and setting annotation paths. * Added an embedder test testing all the new functions. Bug=pdfium:737 Change-Id: Ic451bcd3be488261baf2182549c4238b887b219e Reviewed-on: https://pdfium-review.googlesource.com/6676 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-22Minor change to AP generation logicJane Liu
Current behavior: Our CPVT_GenerateAP::Generate*AP() functions do not get called as long as the annotation dictionary has an "AP" entry. Problem: We always need the "N" entry in AP dictionary to display an annotation. Even though the spec requires "AP" dictionary to have an "N" entry for normal mode appearance, in case of a malformed pdf with "AP" but without "N" in "AP", we won't be able to display the annotation at all. Fix: Always check if "AP" has "N" entry to decide whether AP needs to be generated. If not, then we still need to generate AP, and add to the AP dictionary under the key "N". Bug=pdfium:778 Change-Id: Icf0c6a681b3c8c22b0b67bf8d16ce6fefdc2c45b Reviewed-on: https://pdfium-review.googlesource.com/6692 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-06-19Added EmbedderTest::RenderPageWithFlags()Jane Liu
Currently, in embedder tests, pages can only be rendered with no flags specified. With the addition of annotation APIs and corresponding embedder tests, it is helpful to add a test method to allow flags to be passed in when rendering pages in embedder tests. This CL adds such a method. Bug=pdfium:737 Change-Id: I277831cb2e228154e9a65b078a241b8e61220664 Reviewed-on: https://pdfium-review.googlesource.com/6711 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-06-13Allow zero length streams when parsing.chromium/3130Dan Sinclair
It's possible to create a stream of length 0 in a PDF document. Currently the code will early exit and return a nullptr. This causes issues when you want to print the given PDF as the FPDF_ImportPages code ends up only generating up to the zero length object. This CL allows creating streams with length 0 and updates the PDF saving code to output a blank stream. Bug: chromium:732380 Change-Id: I44182ba4aaac7c51284b002ba01bbc34b6bcf9e0 Reviewed-on: https://pdfium-review.googlesource.com/6490 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-18Adding fm2js embedder testsDan Sinclair
This Cl adds the basis of the test framework to execute the javascript produced by CXFA_FM2JSContext and verify the results are correct. Change-Id: Ie46625b7e27ca0808e9cc41fdc00b7c0a212837d Reviewed-on: https://pdfium-review.googlesource.com/5651 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-02Change BarcodeTest to render to bitmaps.Lei Zhang
BarcodeTest renders to bitmaps verifies their checksums. Add some commonly used checksumming code to testing/test_support.h, and use it in tests that have duplicate code. Change-Id: I4a440674ff1084685b5d89576d967333da458a8a Reviewed-on: https://pdfium-review.googlesource.com/4618 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-03-27Remove old test expectations after the Mac 10.12 upgrade.Lei Zhang
BUG=chromium:703912 Change-Id: I5b4e582afc95b845e8e5e7a4e14581127c18de2d Reviewed-on: https://pdfium-review.googlesource.com/3193 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-22Fix Mac tests on 10.12Nicolas Pena
md5's with text are changed, so need to allow both the previous and the new one. Pixel tests with text also fail on 10.12, so suppressing those. Found many unexpected successes, so will unsuppress those once all bots are 10.12 BUG=chromium:703912 Change-Id: I6b34aa2f581eb8ea705f3876960b49c89e249347 Reviewed-on: https://pdfium-review.googlesource.com/3144 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2016-12-19Relax the EncryptMetadata check.chromium/2957tsepez
BUG=pdfium:644 Review-Url: https://codereview.chromium.org/2581873002
2016-11-21Check dimensions and content of bitmaps in EmbedderTests.chromium/2927thestig
Review-Url: https://codereview.chromium.org/2514173002
2016-10-06Fixup MSan embeddertestsDan Sinclair
The embeddertests were closing the document before the formfill environment. This caused a use-after-free as we try to use the document during formfill destruction. This Cl fixes the destruction order in the embedder tests. As well, a few guards are put in place to keep the system from crashing if the wrong destruction order is called. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/2398063002 .
2016-09-07Cleanup page when unloading in embedder testsdsinclair
When unloading a page in the embedder tests we need to cleanup the internal page map so if we load the page a second time we don't get a previously unloaded page. Review-Url: https://codereview.chromium.org/2322523002
2016-08-23Fix page leaks in an embedder testweili
Embedder test's delegate function GetPage() calls FPDF_LoadPage() to load a page which may be already loaded by embedder test itself. Thus the page's ref count is increased unnecessarily. This causes the page to be leaked. Fix this by putting the page map in embedder test class and guarantee the page is loaded only once. Also, fix leaks in this embedder tests by unloading the loaded pages to properly release the resource. BUG=pdfium:242 Review-Url: https://codereview.chromium.org/2258333002
2016-06-27Fix memory leaks with V8 startup data.thestig
Review-Url: https://codereview.chromium.org/2068563002
2016-06-22Fix memory leaks in EmbedderTest::OpenDocument().thestig
EmbedderTest::OpenDocument() does not gracefully handle the case of being called twice in a given test case. So avoid doing that. Review-Url: https://codereview.chromium.org/2088093002
2016-06-09Roll V8 and its deps and update ICU initialization callchromium/2764jochen
R=machenbach@chromium.org,thestig@chromium.org BUG= Review-Url: https://codereview.chromium.org/2053603002
2016-05-31Fix V8 isolate setup in embedder tests and roll V8 to 055bfa7.jochen
R=thestig@chromium.org BUG= Review-Url: https://codereview.chromium.org/2019383002