Refine tests for CJX_HostPseudoModel.

Change-Id: I68746e4b4d917b30430299bb60377218a2a6ad0c
Reviewed-on: https://pdfium-review.googlesource.com/c/50490
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel.in b/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel.in
index ce92dac..4a3ed16 100644
--- a/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel.in
+++ b/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel.in
@@ -21,6 +21,7 @@
     </pageSet>
     <event activity="docReady" ref="$host">
       <script contentType="application/x-javascript">
+        {{include ../expect.js}}
         {{include ../property_test_helpers.js}}
         testROProperty(xfa.host, "appType", "Exchange");
         testRWProperty(xfa.host, "calculationsEnabled", true, false);
@@ -33,22 +34,59 @@
         testRWProperty(xfa.host, "validationsEnabled", true, false);
         testROProperty(xfa.host, "variation", "Full");
         testROProperty(xfa.host, "version", "11");
-        try {
-          xfa.host.beep();
-          xfa.host.documentCountInBatch();
-          xfa.host.documentInBatch();
-          xfa.host.exportData('to-evil-place');
-          xfa.host.importData('from-good-place');
-          xfa.host.getFocus();
-          xfa.host.gotoURL('http://example.com');
-          xfa.host.setFocus("my_doc.subform_combox_0.combox");
-          xfa.host.openList("my_doc.subform_combox_0.combox");
-          app.alert("finished testing methods");
-        } catch (e) {
-          app.alert("error testing methods: " + e);
-        }
+        app.alert("finished testing properties");
+
+        expectError("xfa.host.beep(1, 1)");
+        expect("xfa.host.beep(42)");
+        expect("xfa.host.beep()");
+
+        expect("xfa.host.documentCountInBatch()", 0);
+        expect("xfa.host.documentCountInBatch(42, 'args', ['ignored'])", 0);
+
+        expect("xfa.host.documentInBatch()", 0);
+        expect("xfa.host.documentInBatch(42, 'args', ['ignored'])", 0);
+
+        expectError("xfa.host.exportData()");
+        expectError("xfa.host.exportData(1, 2, 3)");
+        expect("xfa.host.exportData('to-evil-place')");
+        expect("xfa.host.exportData('to-evil-place', false)");
+
+        expect("xfa.host.getFocus()");
+        expect("xfa.host.getFocus('args', 'ignored')");
+
+        expectError("xfa.host.gotoURL()");
+        expectError("xfa.host.gotoURL(1, 2)");
+        expect("xfa.host.gotoURL('http://example.com')");
+
+        expectError("xfa.host.importData()");
+        expectError("xfa.host.importData(1, 2)");
+        expect("xfa.host.importData('from-good-place')");
+
+        expectError("xfa.host.openList()");
+        expectError("xfa.host.openList(1, 2)");
+        expect("xfa.host.openList('my_doc.subform_combox_0.combox')");
+        expect("xfa.host.openList(eval('my_doc.subform_combox_0'))");
+
+        expectError("xfa.host.print(1, 2, 3, 4, 5, 6, 7)");
+        expectError("xfa.host.print(1, 2, 3, 4, 5, 6, 7, 8, 9)");
+        expect("xfa.host.print(true, 1, 1, true, true, true, true, true)");
+
+        expectError("xfa.host.setFocus()");
+        expectError("xfa.host.setFocus('one', 'two')");
+        expect("xfa.host.setFocus('my_doc.subform_combox_0')");
+        expect("xfa.host.getFocus()", "[object XFAObject]");
+        expect("xfa.host.setFocus(eval('my_doc.subform_combox_0'))");
+        expect("xfa.host.getFocus()", "[object XFAObject]");
+
+        app.alert("finished testing methods");
       </script>
     </event>
+    <subform layout="tb" name="subform_combox_0">
+      <occur initial="1" max="10" min="0" name="occur_subform_combox_0">
+      </occur>
+      <field h="10mm" name="combox" w="40mm" x="10mm" y="10mm">
+      </field>
+    </subform>
   </subform>
 </template>
 endstream
diff --git a/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel_expected.txt b/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel_expected.txt
index 212638a..390d425 100644
--- a/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel_expected.txt
+++ b/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel_expected.txt
@@ -20,5 +20,40 @@
 Alert: PASS: variation threw Error: Unable to set variation value.
 Alert: PASS: version = 11
 Alert: PASS: version threw Error: Unable to set version value.
+Alert: finished testing properties
+Alert: PASS: xfa.host.beep(1, 1) threw XFAObject.beep: Incorrect number of parameters passed to function.
+BEEP!!! 42
+Alert: PASS: xfa.host.beep(42) = undefined
 BEEP!!! 4
+Alert: PASS: xfa.host.beep() = undefined
+Alert: PASS: xfa.host.documentCountInBatch() = 0
+Alert: PASS: xfa.host.documentCountInBatch(42, 'args', ['ignored']) = 0
+Alert: PASS: xfa.host.documentInBatch() = 0
+Alert: PASS: xfa.host.documentInBatch(42, 'args', ['ignored']) = 0
+Alert: PASS: xfa.host.exportData() threw XFAObject.exportData: Incorrect number of parameters passed to function.
+Alert: PASS: xfa.host.exportData(1, 2, 3) threw XFAObject.exportData: Incorrect number of parameters passed to function.
+Alert: PASS: xfa.host.exportData('to-evil-place') = undefined
+Alert: PASS: xfa.host.exportData('to-evil-place', false) = undefined
+Alert: PASS: xfa.host.getFocus() = undefined
+Alert: PASS: xfa.host.getFocus('args', 'ignored') = undefined
+Alert: PASS: xfa.host.gotoURL() threw XFAObject.gotoURL: Incorrect number of parameters passed to function.
+Alert: PASS: xfa.host.gotoURL(1, 2) threw XFAObject.gotoURL: Incorrect number of parameters passed to function.
+Alert: PASS: xfa.host.gotoURL('http://example.com') = undefined
+Alert: PASS: xfa.host.importData() threw XFAObject.importData: Incorrect number of parameters passed to function.
+Alert: PASS: xfa.host.importData(1, 2) threw XFAObject.importData: Incorrect number of parameters passed to function.
+Alert: PASS: xfa.host.importData('from-good-place') = undefined
+Alert: PASS: xfa.host.openList() threw XFAObject.openList: Incorrect number of parameters passed to function.
+Alert: PASS: xfa.host.openList(1, 2) threw XFAObject.openList: Incorrect number of parameters passed to function.
+Alert: PASS: xfa.host.openList('my_doc.subform_combox_0.combox') = undefined
+Alert: PASS: xfa.host.openList(eval('my_doc.subform_combox_0')) = undefined
+Alert: PASS: xfa.host.print(1, 2, 3, 4, 5, 6, 7) threw XFAObject.print: Incorrect number of parameters passed to function.
+Alert: PASS: xfa.host.print(1, 2, 3, 4, 5, 6, 7, 8, 9) threw XFAObject.print: Incorrect number of parameters passed to function.
+Doc Print: 1, 1, 1, 2, 4, 8, 16, 32
+Alert: PASS: xfa.host.print(true, 1, 1, true, true, true, true, true) = undefined
+Alert: PASS: xfa.host.setFocus() threw XFAObject.setFocus: Incorrect number of parameters passed to function.
+Alert: PASS: xfa.host.setFocus('one', 'two') threw XFAObject.setFocus: Incorrect number of parameters passed to function.
+Alert: PASS: xfa.host.setFocus('my_doc.subform_combox_0') = undefined
+Alert: PASS: xfa.host.getFocus() = [object XFAObject]
+Alert: PASS: xfa.host.setFocus(eval('my_doc.subform_combox_0')) = undefined
+Alert: PASS: xfa.host.getFocus() = [object XFAObject]
 Alert: finished testing methods