OLD | NEW |
1 // Copyright 2015 PDFium Authors. All rights reserved. | 1 // Copyright 2015 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
| 5 #include "testing/gtest/include/gtest/gtest.h" |
5 #include "testing/js_embedder_test.h" | 6 #include "testing/js_embedder_test.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | |
7 | 7 |
8 namespace { | 8 namespace { |
9 | 9 |
10 const wchar_t kScript[] = L"fred = 7"; | 10 const wchar_t kScript[] = L"fred = 7"; |
11 | 11 |
12 } // namespace | 12 } // namespace |
13 | 13 |
14 class FXJSV8EmbedderTest : public JSEmbedderTest {}; | 14 class FXJSV8EmbedderTest : public JSEmbedderTest {}; |
15 | 15 |
16 TEST_F(FXJSV8EmbedderTest, Getters) { | 16 TEST_F(FXJSV8EmbedderTest, Getters) { |
17 v8::Isolate::Scope isolate_scope(isolate()); | 17 v8::Isolate::Scope isolate_scope(isolate()); |
18 #ifdef PDF_ENABLE_XFA | 18 #ifdef PDF_ENABLE_XFA |
19 v8::Locker locker(isolate()); | 19 v8::Locker locker(isolate()); |
20 #endif // PDF_ENABLE_XFA | 20 #endif // PDF_ENABLE_XFA |
21 v8::HandleScope handle_scope(isolate()); | 21 v8::HandleScope handle_scope(isolate()); |
22 v8::Context::Scope context_scope(GetV8Context()); | 22 v8::Context::Scope context_scope(GetV8Context()); |
23 | 23 |
24 FXJSErr error; | 24 FXJSErr error; |
25 int sts = FXJS_Execute(isolate(), nullptr, kScript, &error); | 25 int sts = FXJS_Execute(isolate(), nullptr, kScript, &error); |
26 EXPECT_EQ(0, sts); | 26 EXPECT_EQ(0, sts); |
27 | 27 |
28 v8::Local<v8::Object> This = FXJS_GetThisObj(isolate()); | 28 v8::Local<v8::Object> This = FXJS_GetThisObj(isolate()); |
29 v8::Local<v8::Value> fred = FXJS_GetObjectElement(isolate(), This, L"fred"); | 29 v8::Local<v8::Value> fred = FXJS_GetObjectElement(isolate(), This, L"fred"); |
30 EXPECT_TRUE(fred->IsNumber()); | 30 EXPECT_TRUE(fred->IsNumber()); |
31 } | 31 } |
OLD | NEW |