summaryrefslogtreecommitdiff
path: root/testing/xfa_js_embedder_test.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-05-24 09:33:20 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-05-24 15:52:39 +0000
commit129b0135adf99be8e2c3015267a4689c6d62dca1 (patch)
tree91fbce51793d1631d16faee06bdebc505479c413 /testing/xfa_js_embedder_test.cpp
parent033e565d8244953afe8eab3d0c7ee1ed9863c921 (diff)
downloadpdfium-129b0135adf99be8e2c3015267a4689c6d62dca1.tar.xz
More FM2JSContext tests
This CL adds tests for the FormCalc methods that don't require passing in a formcalc object reference. Change-Id: Ica6f15704cce525d38d25a27d1628089d2fc5a5a Reviewed-on: https://pdfium-review.googlesource.com/5691 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'testing/xfa_js_embedder_test.cpp')
-rw-r--r--testing/xfa_js_embedder_test.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/testing/xfa_js_embedder_test.cpp b/testing/xfa_js_embedder_test.cpp
index d72e8762e8..4a29872eab 100644
--- a/testing/xfa_js_embedder_test.cpp
+++ b/testing/xfa_js_embedder_test.cpp
@@ -38,16 +38,17 @@ void XFAJSEmbedderTest::TearDown() {
isolate_ = nullptr;
}
+CXFA_Document* XFAJSEmbedderTest::GetXFADocument() {
+ return UnderlyingFromFPDFDocument(document())->GetXFADoc()->GetXFADoc();
+}
+
bool XFAJSEmbedderTest::OpenDocument(const std::string& filename,
const char* password,
bool must_linearize) {
if (!EmbedderTest::OpenDocument(filename, password, must_linearize))
return false;
- script_context_ = UnderlyingFromFPDFDocument(document())
- ->GetXFADoc()
- ->GetXFADoc()
- ->GetScriptContext();
+ script_context_ = GetXFADocument()->GetScriptContext();
return true;
}
@@ -55,7 +56,7 @@ bool XFAJSEmbedderTest::Execute(const CFX_ByteStringC& input) {
value_ = pdfium::MakeUnique<CFXJSE_Value>(GetIsolate());
if (script_context_->RunScript(XFA_SCRIPTLANGTYPE_Formcalc,
CFX_WideString::FromUTF8(input).AsStringC(),
- value_.get(), nullptr)) {
+ value_.get(), GetXFADocument()->GetRoot())) {
return true;
}