• K Moon's avatar
    Serialize LayoutOptions to DocumentDimensions · 23d56446
    K Moon authored
    Add ToVar() and FromVar() methods to DocumentLayout::Options, allowing
    serialization to and from a pp::Var. This serialization is then used to
    pass layout options (such as default page orientation) to and from
    JavaScript (via the "documentDimensions" message).
    
    pp::Var is non-trivial to unit test, due to dependencies on the
    browser's PPAPI interfaces. Instead, this change adds 2 browser_tests,
    PDFExtensionTest.Layout3 and PDFExtensionTest.Layout4. Each runs the
    same layout_test.js suite over two slightly different test PDF files,
    test-layout3.pdf (with 3 pages) and test-layout4.pdf (with 4 pages).
    
    There's currently no coverage of deserialization, as we're not doing
    anything with the layout options sent back from JavaScript yet. We'll
    start using FromVar() in an upcoming CL (such as crrev.com/c/1747170).
    
    Bug: 885110
    Change-Id: I8c93b74062576ee07445070e0b4a82f0f861a82e
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1830398Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
    Commit-Queue: K Moon <kmoon@chromium.org>
    Auto-Submit: K Moon <kmoon@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#702324}
    23d56446
pdf_extension_test.cc 99.7 KB