blob: afbdb26e1a575787b9c63b59ceff60214b571b0a [file] [log] [blame]
Dan Sinclair14aacd52017-05-18 14:11:29 -04001// Copyright 2017 PDFium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef TESTING_XFA_JS_EMBEDDER_TEST_H_
6#define TESTING_XFA_JS_EMBEDDER_TEST_H_
7
8#include <memory>
9#include <string>
10
11#include "fxjs/cfxjse_value.h"
12#include "fxjs/fxjs_v8.h"
13#include "testing/embedder_test.h"
Dan Sinclair129b0132017-05-24 09:33:20 -040014#include "xfa/fxfa/parser/cxfa_document.h"
15#include "xfa/fxfa/parser/cxfa_node.h"
16#include "xfa/fxfa/parser/cxfa_object.h"
Dan Sinclair14aacd52017-05-18 14:11:29 -040017
18class CXFA_ScriptContext;
19
20class XFAJSEmbedderTest : public EmbedderTest {
21 public:
22 XFAJSEmbedderTest();
23 ~XFAJSEmbedderTest() override;
24
25 void SetUp() override;
26 void TearDown() override;
27
28 bool OpenDocument(const std::string& filename,
29 const char* password = nullptr,
30 bool must_linearize = false) override;
31
32 v8::Isolate* GetIsolate() const { return isolate_; }
Dan Sinclair129b0132017-05-24 09:33:20 -040033 CXFA_Document* GetXFADocument();
Dan Sinclair14aacd52017-05-18 14:11:29 -040034
35 bool Execute(const CFX_ByteStringC& input);
36 CFXJSE_Value* GetValue() const { return value_.get(); }
37
38 private:
39 std::unique_ptr<FXJS_ArrayBufferAllocator> array_buffer_allocator_;
40 std::unique_ptr<CFXJSE_Value> value_;
41 v8::Isolate* isolate_;
42 CXFA_ScriptContext* script_context_;
43};
44
45#endif // TESTING_XFA_JS_EMBEDDER_TEST_H_