Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Side by Side Diff: fxjs/fxjs_v8_embeddertest.cpp

Issue 2241483004: Move some v8 objects from CJS back into FXJS (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Chromium style rules Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/gtest/include/gtest/gtest.h"
6 #include "testing/js_embedder_test.h" 6 #include "testing/js_embedder_test.h"
7 7
8 namespace { 8 namespace {
9 9
10 const double kExpected0 = 6.0; 10 const double kExpected0 = 6.0;
(...skipping 26 matching lines...) Expand all
37 37
38 TEST_F(FXJSV8EmbedderTest, Getters) { 38 TEST_F(FXJSV8EmbedderTest, Getters) {
39 v8::Isolate::Scope isolate_scope(isolate()); 39 v8::Isolate::Scope isolate_scope(isolate());
40 v8::HandleScope handle_scope(isolate()); 40 v8::HandleScope handle_scope(isolate());
41 v8::Context::Scope context_scope(GetV8Context()); 41 v8::Context::Scope context_scope(GetV8Context());
42 42
43 ExecuteInCurrentContext(CFX_WideString(kScript1)); 43 ExecuteInCurrentContext(CFX_WideString(kScript1));
44 CheckAssignmentInCurrentContext(kExpected1); 44 CheckAssignmentInCurrentContext(kExpected1);
45 } 45 }
46 46
47 TEST_F(FXJSV8EmbedderTest, MultipleRutimes) { 47 TEST_F(FXJSV8EmbedderTest, MultipleEngines) {
48 v8::Isolate::Scope isolate_scope(isolate()); 48 v8::Isolate::Scope isolate_scope(isolate());
49 v8::HandleScope handle_scope(isolate()); 49 v8::HandleScope handle_scope(isolate());
50 50
51 v8::Global<v8::Context> global_context1; 51 v8::Global<v8::Context> global_context1;
52 std::vector<v8::Global<v8::Object>*> static_objects1; 52 std::vector<v8::Global<v8::Object>*> static_objects1;
53 FXJS_InitializeRuntime(isolate(), nullptr, &global_context1, 53 FXJS_InitializeEngine(isolate(), nullptr, &global_context1, &static_objects1);
54 &static_objects1);
55 54
56 v8::Global<v8::Context> global_context2; 55 v8::Global<v8::Context> global_context2;
57 std::vector<v8::Global<v8::Object>*> static_objects2; 56 std::vector<v8::Global<v8::Object>*> static_objects2;
58 FXJS_InitializeRuntime(isolate(), nullptr, &global_context2, 57 FXJS_InitializeEngine(isolate(), nullptr, &global_context2, &static_objects2);
59 &static_objects2);
60 58
61 v8::Context::Scope context_scope(GetV8Context()); 59 v8::Context::Scope context_scope(GetV8Context());
62 ExecuteInCurrentContext(CFX_WideString(kScript0)); 60 ExecuteInCurrentContext(CFX_WideString(kScript0));
63 CheckAssignmentInCurrentContext(kExpected0); 61 CheckAssignmentInCurrentContext(kExpected0);
64 62
65 { 63 {
66 v8::Local<v8::Context> context1 = 64 v8::Local<v8::Context> context1 =
67 v8::Local<v8::Context>::New(isolate(), global_context1); 65 v8::Local<v8::Context>::New(isolate(), global_context1);
68 v8::Context::Scope context_scope1(context1); 66 v8::Context::Scope context_scope1(context1);
69 ExecuteInCurrentContext(CFX_WideString(kScript1)); 67 ExecuteInCurrentContext(CFX_WideString(kScript1));
70 CheckAssignmentInCurrentContext(kExpected1); 68 CheckAssignmentInCurrentContext(kExpected1);
71 } 69 }
72 FXJS_ReleaseRuntime(isolate(), &global_context1, &static_objects1); 70 FXJS_ReleaseEngine(isolate(), &global_context1, &static_objects1);
73 71
74 { 72 {
75 v8::Local<v8::Context> context2 = 73 v8::Local<v8::Context> context2 =
76 v8::Local<v8::Context>::New(isolate(), global_context2); 74 v8::Local<v8::Context>::New(isolate(), global_context2);
77 v8::Context::Scope context_scope2(context2); 75 v8::Context::Scope context_scope2(context2);
78 ExecuteInCurrentContext(CFX_WideString(kScript2)); 76 ExecuteInCurrentContext(CFX_WideString(kScript2));
79 CheckAssignmentInCurrentContext(kExpected2); 77 CheckAssignmentInCurrentContext(kExpected2);
80 } 78 }
81 FXJS_ReleaseRuntime(isolate(), &global_context2, &static_objects2); 79 FXJS_ReleaseEngine(isolate(), &global_context2, &static_objects2);
82 80
83 CheckAssignmentInCurrentContext(kExpected0); 81 CheckAssignmentInCurrentContext(kExpected0);
84 } 82 }
OLDNEW
« no previous file with comments | « fxjs/fxjs_v8.cpp ('k') | fxjs/include/fxjs_v8.h » ('j') | fxjs/include/fxjs_v8.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698