Convert xfa_host_pseudomodel.in to use property_test_helpers.js

Change-Id: Ib5f24eb4264a1b3d80939f61d684759c6fa22e76
Reviewed-on: https://pdfium-review.googlesource.com/c/49852
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 514b3ab..ce92dac 100644
--- a/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel.in
+++ b/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel.in
@@ -21,46 +21,18 @@
     </pageSet>
     <event activity="docReady" ref="$host">
       <script contentType="application/x-javascript">
-        function say(what) {
-          app.alert(what, "xfa.host says");
-        }
-        function testReadProperty(prop) {
-          try {
-            var actual = xfa.host[prop];
-            say("property " + prop + " is " + actual);
-          } catch (e) {
-            say("unexpected error: " + e);
-          }
-        }
-        function testROProperty(prop) {
-          testReadProperty(prop);
-          try {
-            xfa.host[prop] = "bogus";
-            say("error: property " + prop + " was settable");
-          } catch (e) {
-            say("expected error setting " + prop + " is " + e);
-          }
-        }
-        function testRWProperty(prop) {
-          testReadProperty(prop);
-          try {
-            xfa.host[prop] = "bogus";
-            say("property " + prop + " was settable as expected");
-          } catch (e) {
-            say("error setting " + prop + " is " + e);
-          }
-        }
-        testROProperty("appType");
-        testRWProperty("calculationsEnabled");
-        testRWProperty("currentPage");
-        testROProperty("language");
-        testROProperty("name");
-        testROProperty("numPages");
-        testROProperty("platform");
-        testRWProperty("title");
-        testRWProperty("validationsEnabled");
-        testROProperty("variation");
-        testROProperty("version");
+        {{include ../property_test_helpers.js}}
+        testROProperty(xfa.host, "appType", "Exchange");
+        testRWProperty(xfa.host, "calculationsEnabled", true, false);
+        testRIProperty(xfa.host, "currentPage", -1, 0);
+        testROProperty(xfa.host, "language", "");
+        testROProperty(xfa.host, "name", "Acrobat");
+        testROProperty(xfa.host, "numPages", 2);
+        testROProperty(xfa.host, "platform", "");
+        testRIProperty(xfa.host, "title", "");
+        testRWProperty(xfa.host, "validationsEnabled", true, false);
+        testROProperty(xfa.host, "variation", "Full");
+        testROProperty(xfa.host, "version", "11");
         try {
           xfa.host.beep();
           xfa.host.documentCountInBatch();
@@ -71,8 +43,9 @@
           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) {
-          say("error testing methods: " + e);
+          app.alert("error testing methods: " + e);
         }
       </script>
     </event>
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 d4c2d62..212638a 100644
--- a/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel_expected.txt
+++ b/testing/resources/javascript/xfa_specific/xfa_host_pseudomodel_expected.txt
@@ -1,23 +1,24 @@
-Alert: property appType is Exchange
-Alert: expected error setting appType is Error: Invalid property set operation.
-Alert: property calculationsEnabled is true
-Alert: property calculationsEnabled was settable as expected
-Alert: property currentPage is -1
-Alert: property currentPage was settable as expected
-Alert: property language is 
-Alert: expected error setting language is Error: Unable to set language value.
-Alert: property name is Acrobat
-Alert: expected error setting name is Error: Invalid property set operation.
-Alert: property numPages is 2
-Alert: expected error setting numPages is Error: Unable to set numPages value.
-Alert: property platform is 
-Alert: expected error setting platform is Error: Unable to set platform value.
-Alert: property title is 
-Alert: property title was settable as expected
-Alert: property validationsEnabled is true
-Alert: property validationsEnabled was settable as expected
-Alert: property variation is Full
-Alert: expected error setting variation is Error: Unable to set variation value.
-Alert: property version is 11
-Alert: expected error setting version is Error: Unable to set version value.
+Alert: PASS: appType = Exchange
+Alert: PASS: appType threw Error: Invalid property set operation.
+Alert: PASS: calculationsEnabled = true
+Alert: PASS: calculationsEnabled = false
+Alert: PASS: currentPage = -1
+Alert: PASS: currentPage = -1
+Alert: PASS: language = 
+Alert: PASS: language threw Error: Unable to set language value.
+Alert: PASS: name = Acrobat
+Alert: PASS: name threw Error: Invalid property set operation.
+Alert: PASS: numPages = 2
+Alert: PASS: numPages threw Error: Unable to set numPages value.
+Alert: PASS: platform = 
+Alert: PASS: platform threw Error: Unable to set platform value.
+Alert: PASS: title = 
+Alert: PASS: title = 
+Alert: PASS: validationsEnabled = true
+Alert: PASS: validationsEnabled = false
+Alert: PASS: variation = Full
+Alert: PASS: variation threw Error: Unable to set variation value.
+Alert: PASS: version = 11
+Alert: PASS: version threw Error: Unable to set version value.
 BEEP!!! 4
+Alert: finished testing methods