Fix Javascript tests after commit f55771af6429.
- Return true instead of false. All the other unsupported JS
functions return true.
- Adjust test expectations accordingly.
TBR=jam@chromium.org
Review URL: https://codereview.chromium.org/1196163006.
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index 1d2dca5..c35045c 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -1541,7 +1541,7 @@
FX_BOOL Document::removeIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
// Unsafe, no supported.
- return FALSE;
+ return TRUE;
}
FX_BOOL Document::createDataObject(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
@@ -1806,7 +1806,7 @@
FX_BOOL Document::deletePages(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
// Unsafe, no supported.
- return FALSE;
+ return TRUE;
}
FX_BOOL Document::extractPages(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
diff --git a/testing/resources/javascript/document_methods.in b/testing/resources/javascript/document_methods.in
index 662c05c..b2467f3 100644
--- a/testing/resources/javascript/document_methods.in
+++ b/testing/resources/javascript/document_methods.in
@@ -134,14 +134,6 @@
// TODO(tsepez): test success cases.
}
-function testDeletePages() {
- // Method is present.
- expect('typeof this.deletePages', 'function');
-
- // TODO(tsepez): test with no permissions.
- // TODO(tsepez): test success cases.
-}
-
function testGetField() {
// Method is present.
expect('typeof this.getField', 'function');
@@ -255,16 +247,6 @@
// TODO(tsepez): test success cases.
}
-function testRemoveIcon() {
- // Method is present.
- expect('typeof this.removeIcon', 'function');
-
- // Method requires at least one argument.
- expectError('this.removeIcon()');
-
- // TODO(tsepez): test success cases.
-}
-
function testResetForm() {
// Method is present.
expect('typeof this.resetForm', 'function');
@@ -290,6 +272,7 @@
testUnsupported('this.addLink');
testUnsupported('this.closeDoc');
testUnsupported('this.createDataObject');
+ testUnsupported('this.deletePages');
testUnsupported('this.exportAsFDF');
testUnsupported('this.exportAsText');
testUnsupported('this.exportAsXFDF');
@@ -305,13 +288,13 @@
testUnsupported('this.importAnXFDF');
testUnsupported('this.importTextData');
testUnsupported('this.insertPages');
+ testUnsupported('this.removeIcon');
testUnsupported('this.replacePages');
testUnsupported('this.saveAs');
app.alert('*** Testing Supported Methods ***');
testAddIcon();
testCalculateNow();
- testDeletePages();
testGetField();
testGetIcon();
testGetNthFieldName();
@@ -323,7 +306,6 @@
testMailForm();
testPrint();
testRemoveField();
- testRemoveIcon();
testResetForm();
testSubmitForm();
} catch (e) {
diff --git a/testing/resources/javascript/document_methods_expected.txt b/testing/resources/javascript/document_methods_expected.txt
index 445b48d..753a99d 100644
--- a/testing/resources/javascript/document_methods_expected.txt
+++ b/testing/resources/javascript/document_methods_expected.txt
@@ -14,6 +14,9 @@
Alert: PASS: typeof this.createDataObject = function
Alert: PASS: this.createDataObject() = undefined
Alert: PASS: this.createDataObject(1, 2, "clams", [1, 2, 3]) = undefined
+Alert: PASS: typeof this.deletePages = function
+Alert: PASS: this.deletePages() = undefined
+Alert: PASS: this.deletePages(1, 2, "clams", [1, 2, 3]) = undefined
Alert: PASS: typeof this.exportAsFDF = function
Alert: PASS: this.exportAsFDF() = undefined
Alert: PASS: this.exportAsFDF(1, 2, "clams", [1, 2, 3]) = undefined
@@ -59,6 +62,9 @@
Alert: PASS: typeof this.insertPages = function
Alert: PASS: this.insertPages() = undefined
Alert: PASS: this.insertPages(1, 2, "clams", [1, 2, 3]) = undefined
+Alert: PASS: typeof this.removeIcon = function
+Alert: PASS: this.removeIcon() = undefined
+Alert: PASS: this.removeIcon(1, 2, "clams", [1, 2, 3]) = undefined
Alert: PASS: typeof this.replacePages = function
Alert: PASS: this.replacePages() = undefined
Alert: PASS: this.replacePages(1, 2, "clams", [1, 2, 3]) = undefined
@@ -72,7 +78,6 @@
Alert: PASS: this.addIcon(1, 2, 3) threw error Document.addIcon: Incorrect number of parameters passed to function.
Alert: PASS: this.addIcon("myicon", 3) threw error Document.addIcon: Incorrect parameter type.
Alert: PASS: typeof this.calculateNow = function
-Alert: PASS: typeof this.deletePages = function
Alert: PASS: typeof this.getField = function
Alert: PASS: this.getField() threw error Document.getField: Incorrect number of parameters passed to function.
Alert: PASS: typeof this.getIcon = function
@@ -96,8 +101,6 @@
Alert: PASS: typeof this.print = function
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.removeIcon = function
-Alert: PASS: this.removeIcon() threw error Document.removeIcon: Incorrect number of parameters passed to function.
Alert: PASS: typeof this.resetForm = function
Alert: PASS: typeof this.submitForm = function
Alert: PASS: this.submitForm() threw error Document.submitForm: Incorrect number of parameters passed to function.