summaryrefslogtreecommitdiff
path: root/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp')
-rw-r--r--fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp b/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp
new file mode 100644
index 0000000000..b7700c8b60
--- /dev/null
+++ b/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp
@@ -0,0 +1,31 @@
+// Copyright 2015 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/js_embedder_test.h"
+
+namespace {
+
+const wchar_t kScript[] = L"fred = 7";
+
+} // namespace
+
+class FXJSV8EmbedderTest : public JSEmbedderTest {};
+
+TEST_F(FXJSV8EmbedderTest, Getters) {
+ v8::Isolate::Scope isolate_scope(isolate());
+#ifdef PDF_ENABLE_XFA
+ v8::Locker locker(isolate());
+#endif // PDF_ENABLE_XFA
+ v8::HandleScope handle_scope(isolate());
+ v8::Context::Scope context_scope(GetV8Context());
+
+ FXJSErr error;
+ int sts = FXJS_Execute(isolate(), nullptr, kScript, &error);
+ EXPECT_EQ(0, sts);
+
+ v8::Local<v8::Object> This = FXJS_GetThisObj(isolate());
+ v8::Local<v8::Value> fred = FXJS_GetObjectElement(isolate(), This, L"fred");
+ EXPECT_TRUE(fred->IsNumber());
+}