1 // Copyright 2015 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 #include "testing/js_embedder_test.h" 6 #include "testing/gtest/include/gtest/gtest.h" 7 8 namespace { 9 10 const wchar_t kScript[] = L"fred = 7"; 11 12 } // namespace 13 14 class FXJSV8EmbedderTest : public JSEmbedderTest {}; 15 TEST_F(FXJSV8EmbedderTest,Getters)16TEST_F(FXJSV8EmbedderTest, Getters) { 17 v8::Isolate::Scope isolate_scope(isolate()); 18 #ifdef PDF_ENABLE_XFA 19 v8::Locker locker(isolate()); 20 #endif // PDF_ENABLE_XFA 21 v8::HandleScope handle_scope(isolate()); 22 v8::Context::Scope context_scope(GetV8Context()); 23 24 FXJSErr error; 25 int sts = FXJS_Execute(isolate(), nullptr, kScript, &error); 26 EXPECT_EQ(0, sts); 27 28 v8::Local<v8::Object> This = FXJS_GetThisObj(isolate()); 29 v8::Local<v8::Value> fred = FXJS_GetObjectElement(isolate(), This, L"fred"); 30 EXPECT_TRUE(fred->IsNumber()); 31 } 32