From 8953baf1e0a47d7b1ad2008e8e14ecc74269416a Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 18 Oct 2018 21:42:20 +0000 Subject: Expand CJS_Document::mail{Doc,Form}() parameters 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 Reviewed-by: Lei Zhang --- testing/resources/javascript/document_methods.in | 16 ++++++++++++++-- .../resources/javascript/document_methods_expected.txt | 12 ++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'testing') diff --git a/testing/resources/javascript/document_methods.in b/testing/resources/javascript/document_methods.in index bb7af748d8..be4bf63b64 100644 --- a/testing/resources/javascript/document_methods.in +++ b/testing/resources/javascript/document_methods.in @@ -260,10 +260,16 @@ function testMailDoc() { // TODO(tsepez): test with no permissions. // Success cases. - expect('this.mailDoc(true)', undefined); + expect('this.mailDoc()', undefined); expect('this.mailDoc(false, "user@example.com", "cc@example.com", ' + '"bcc@example.com", "Lottery Winner", "You won the lottery!")', undefined); + expect('this.mailDoc({})', undefined); + expect('this.mailDoc({"bUI": false, "cTo": "user@example.com", ' + + '"cCc": "cc@example.com", "cBcc": "bcc@example.com", ' + + '"cSubject": "LotteryWinner", "cMsg": "You won the lottery!", ' + + '"bogus": "yes"})', + undefined); } function testMailForm() { @@ -273,10 +279,16 @@ function testMailForm() { // TODO(tsepez): test with no permissions. // Success cases. - expect('this.mailForm(true)', undefined); + expect('this.mailForm()', undefined); expect('this.mailForm(false, "user@example.com", "cc@example.com", ' + '"bcc@example.com", "Lottery Winner", "You won the lottery!")', undefined); + expect('this.mailForm({})', undefined); + expect('this.mailForm({"bUI": false, "cTo": "user@example.com", ' + + '"cCc": "cc@example.com", "cBcc": "bcc@example.com", ' + + '"cSubject": "LotteryWinner", "cMsg": "You won the lottery!", ' + + '"bogus": "yes"})', + undefined); } function testPrint() { diff --git a/testing/resources/javascript/document_methods_expected.txt b/testing/resources/javascript/document_methods_expected.txt index e39690ba45..d4daf995c4 100644 --- a/testing/resources/javascript/document_methods_expected.txt +++ b/testing/resources/javascript/document_methods_expected.txt @@ -109,14 +109,22 @@ Alert: PASS: this.gotoNamedDest(1, 2) threw error Document.gotoNamedDest: Incorr Alert: PASS: this.gotoNamedDest("chicago") threw error Document.gotoNamedDest: Object no longer exists. Alert: PASS: typeof this.mailDoc = function Mail Msg: 1, to=, cc=, bcc=, subject=, body= -Alert: PASS: this.mailDoc(true) = undefined +Alert: PASS: this.mailDoc() = 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.mailDoc(false, "user@example.com", "cc@example.com", "bcc@example.com", "Lottery Winner", "You won the lottery!") = undefined +Mail Msg: 1, to=, cc=, bcc=, subject=, body= +Alert: PASS: this.mailDoc({}) = undefined +Mail Msg: 0, to=user@example.com, cc=cc@example.com, bcc=bcc@example.com, subject=LotteryWinner, body=You won the lottery! +Alert: PASS: this.mailDoc({"bUI": false, "cTo": "user@example.com", "cCc": "cc@example.com", "cBcc": "bcc@example.com", "cSubject": "LotteryWinner", "cMsg": "You won the lottery!", "bogus": "yes"}) = undefined Alert: PASS: typeof this.mailForm = function Mail Msg: 1, to=, cc=, bcc=, subject=, body= -Alert: PASS: this.mailForm(true) = undefined +Alert: PASS: this.mailForm() = 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 +Mail Msg: 1, to=, cc=, bcc=, subject=, body= +Alert: PASS: this.mailForm({}) = undefined +Mail Msg: 0, to=user@example.com, cc=cc@example.com, bcc=bcc@example.com, subject=LotteryWinner, body=You won the lottery! +Alert: PASS: this.mailForm({"bUI": false, "cTo": "user@example.com", "cCc": "cc@example.com", "cBcc": "bcc@example.com", "cSubject": "LotteryWinner", "cMsg": "You won the lottery!", "bogus": "yes"}) = undefined Alert: PASS: typeof this.print = function Doc Print: 1, 0, 0, 0, 0, 0, 0, 0 Alert: PASS: this.print() = undefined -- cgit v1.2.3