diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-10-12 20:27:15 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-12 20:27:15 +0000 |
commit | 305bf6b818d4c3de8fe066dd736424f2e75b55b3 (patch) | |
tree | 0489e863ac0ecc1dd2178b2896678b16d0c62e48 /testing/resources/javascript/document_methods.in | |
parent | 995374a5df93181bbdfb75a808c76c7efed45dcd (diff) | |
download | pdfium-305bf6b818d4c3de8fe066dd736424f2e75b55b3.tar.xz |
Beef up CJS_Document method coverage.
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>
Diffstat (limited to 'testing/resources/javascript/document_methods.in')
-rw-r--r-- | testing/resources/javascript/document_methods.in | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/testing/resources/javascript/document_methods.in b/testing/resources/javascript/document_methods.in index 66d5484f67..0188d7c237 100644 --- a/testing/resources/javascript/document_methods.in +++ b/testing/resources/javascript/document_methods.in @@ -187,7 +187,11 @@ function testGetNthFieldName() { // Argument can not be negative. expectError('this.getNthFieldName(-1)'); - // TODO(tsepez): test success cases. + // Argument can not be huge. + expectError('this.getNthFieldName(400000)'); + + // TODO(tsepez): add field object so this case works. + expectError('this.getNthFieldName(0)'); } function testGetPageNthWord() { @@ -229,29 +233,37 @@ function testGetPageNumWords() { } function testGetPrintParams() { - // Method is present. - expect('typeof this.getPrintParams', 'function'); + // Method is present. + expect('typeof this.getPrintParams', 'function'); - // TODO(tsepez): test success cases. + // Method always returns in error. + expectError('this.getPrintParams()'); + expectError('this.getPrintParams(42)'); } function testGotoNamedDest() { - // Method is present. - expect('typeof this.gotoNamedDest', 'function'); + // Method is present. + expect('typeof this.gotoNamedDest', 'function'); - // Method needs exactly one argument. - expectError('this.gotoNamedDest()'); - expectError('this.gotoNamedDest(1, 2)'); + // Method needs exactly one argument. + expectError('this.gotoNamedDest()'); + expectError('this.gotoNamedDest(1, 2)'); - // TODO(tonikitoo): test success cases. + // TODO(tsepez): add actual named dest matching this. + expectError('this.gotoNamedDest("chicago")'); } function testMailDoc() { - // Method is present. - expect('typeof this.mailDoc', 'function'); + // Method is present. + expect('typeof this.mailDoc', 'function'); // TODO(tsepez): test with no permissions. - // TODO(tsepez): test success cases. + + // Success cases. + expect('this.mailDoc(true)', undefined); + expect('this.mailDoc(false, "user@example.com", "cc@example.com", ' + + '"bcc@example.com", "Lottery Winner", "You won the lottery!")', + undefined); } function testMailForm() { @@ -259,7 +271,12 @@ function testMailForm() { expect('typeof this.mailForm', 'function'); // TODO(tsepez): test with no permissions. - // TODO(tsepez): test success cases. + + // Success cases. + expect('this.mailForm(true)', undefined); + expect('this.mailForm(false, "user@example.com", "cc@example.com", ' + + '"bcc@example.com", "Lottery Winner", "You won the lottery!")', + undefined); } function testPrint() { @@ -285,7 +302,10 @@ function testResetForm() { expect('typeof this.resetForm', 'function'); // TODO(tsepez): test with no permissions. - // TODO(tsepez): test success cases. + + // TODO(tsepez): Add form to document to match these arguments. + expect('this.resetForm()', undefined); + expect('this.resetForm("myform")', undefined); } function testSubmitForm() { @@ -295,7 +315,8 @@ function testSubmitForm() { // Method requires at least one argument. expectError('this.submitForm()'); - // TODO(tsepez): test success cases. + // TODO(tsepez): Add form to document to match these arguments. + expect('this.submitForm("myform", true, true, ["name", "age"])', undefined); } try { |