summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-10-18 21:39:40 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-18 21:39:40 +0000
commit0e5bab1b8402b65fa09a36a2b141bbf22291f822 (patch)
treee6d714f10fc9c552ea043073d17047f969f28f13 /testing
parentae2aec8712aa4c52454737467869b9d256baa05f (diff)
downloadpdfium-0e5bab1b8402b65fa09a36a2b141bbf22291f822.tar.xz
Remove PrintParams object.
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>
Diffstat (limited to 'testing')
-rw-r--r--testing/resources/javascript/document_methods.in6
-rw-r--r--testing/resources/javascript/document_methods_expected.txt8
2 files changed, 14 insertions, 0 deletions
diff --git a/testing/resources/javascript/document_methods.in b/testing/resources/javascript/document_methods.in
index 0188d7c237..bb7af748d8 100644
--- a/testing/resources/javascript/document_methods.in
+++ b/testing/resources/javascript/document_methods.in
@@ -284,6 +284,12 @@ function testPrint() {
expect('typeof this.print', 'function');
// TODO(tsepez): test success cases.
+ expect('this.print()', undefined);
+ expect('this.print(false, 1, 10, true, true, true, true, true)', undefined);
+ expect('this.print({})', undefined);
+ expect('this.print({"bUi": false, "nStart": 42, "nEnd": 17, ' +
+ '"bSilent": true, "bShrinkToFit": true, "bPrintAsImage": true, ' +
+ '"bReverse": true, "bAnnotations": true, "bogus": "yes"})', undefined);
}
function testRemoveField() {
diff --git a/testing/resources/javascript/document_methods_expected.txt b/testing/resources/javascript/document_methods_expected.txt
index 01bf0ed0bd..e39690ba45 100644
--- a/testing/resources/javascript/document_methods_expected.txt
+++ b/testing/resources/javascript/document_methods_expected.txt
@@ -118,6 +118,14 @@ Alert: PASS: this.mailForm(true) = undefined
Mail Msg: 0, to=user@example.com, cc=cc@example.com, bcc=bcc@example.com, subject=Lottery Winner, body=You won the lottery!
Alert: PASS: this.mailForm(false, "user@example.com", "cc@example.com", "bcc@example.com", "Lottery Winner", "You won the lottery!") = undefined
Alert: PASS: typeof this.print = function
+Doc Print: 1, 0, 0, 0, 0, 0, 0, 0
+Alert: PASS: this.print() = undefined
+Doc Print: 0, 1, 10, 1, 1, 1, 1, 1
+Alert: PASS: this.print(false, 1, 10, true, true, true, true, true) = undefined
+Doc Print: 1, 0, 0, 0, 0, 0, 0, 0
+Alert: PASS: this.print({}) = undefined
+Doc Print: 1, 42, 17, 1, 1, 1, 1, 1
+Alert: PASS: this.print({"bUi": false, "nStart": 42, "nEnd": 17, "bSilent": true, "bShrinkToFit": true, "bPrintAsImage": true, "bReverse": true, "bAnnotations": true, "bogus": "yes"}) = undefined
Alert: PASS: typeof this.removeField = function
Alert: PASS: this.removeField() threw error Document.removeField: Incorrect number of parameters passed to function.
Alert: PASS: typeof this.resetForm = function