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

Side by Side Diff: fxjs/fxjs_v8_embeddertest.cpp

Issue 2354353002: Set up isolate in CFXJS_Engine's constructor (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « fxjs/fxjs_v8.cpp ('k') | fxjs/include/fxjs_v8.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 27 matching lines...) Expand all
38 v8::Context::Scope context_scope(GetV8Context()); 38 v8::Context::Scope context_scope(GetV8Context());
39 39
40 ExecuteInCurrentContext(CFX_WideString(kScript1)); 40 ExecuteInCurrentContext(CFX_WideString(kScript1));
41 CheckAssignmentInCurrentContext(kExpected1); 41 CheckAssignmentInCurrentContext(kExpected1);
42 } 42 }
43 43
44 TEST_F(FXJSV8EmbedderTest, MultipleEngines) { 44 TEST_F(FXJSV8EmbedderTest, MultipleEngines) {
45 v8::Isolate::Scope isolate_scope(isolate()); 45 v8::Isolate::Scope isolate_scope(isolate());
46 v8::HandleScope handle_scope(isolate()); 46 v8::HandleScope handle_scope(isolate());
47 47
48 CFXJS_Engine engine1; 48 CFXJS_Engine engine1(isolate());
49 engine1.SetIsolate(isolate());
50 engine1.InitializeEngine(); 49 engine1.InitializeEngine();
51 50
52 CFXJS_Engine engine2; 51 CFXJS_Engine engine2(isolate());
53 engine2.SetIsolate(isolate());
54 engine2.InitializeEngine(); 52 engine2.InitializeEngine();
55 53
56 v8::Context::Scope context_scope(GetV8Context()); 54 v8::Context::Scope context_scope(GetV8Context());
57 ExecuteInCurrentContext(CFX_WideString(kScript0)); 55 ExecuteInCurrentContext(CFX_WideString(kScript0));
58 CheckAssignmentInCurrentContext(kExpected0); 56 CheckAssignmentInCurrentContext(kExpected0);
59 57
60 { 58 {
61 v8::Local<v8::Context> context1 = engine1.NewLocalContext(); 59 v8::Local<v8::Context> context1 = engine1.NewLocalContext();
62 v8::Context::Scope context_scope1(context1); 60 v8::Context::Scope context_scope1(context1);
63 ExecuteInCurrentContext(CFX_WideString(kScript1)); 61 ExecuteInCurrentContext(CFX_WideString(kScript1));
64 CheckAssignmentInCurrentContext(kExpected1); 62 CheckAssignmentInCurrentContext(kExpected1);
65 } 63 }
66 64
67 engine1.ReleaseEngine(); 65 engine1.ReleaseEngine();
68 66
69 { 67 {
70 v8::Local<v8::Context> context2 = engine2.NewLocalContext(); 68 v8::Local<v8::Context> context2 = engine2.NewLocalContext();
71 v8::Context::Scope context_scope2(context2); 69 v8::Context::Scope context_scope2(context2);
72 ExecuteInCurrentContext(CFX_WideString(kScript2)); 70 ExecuteInCurrentContext(CFX_WideString(kScript2));
73 CheckAssignmentInCurrentContext(kExpected2); 71 CheckAssignmentInCurrentContext(kExpected2);
74 } 72 }
75 73
76 engine2.ReleaseEngine(); 74 engine2.ReleaseEngine();
77 CheckAssignmentInCurrentContext(kExpected0); 75 CheckAssignmentInCurrentContext(kExpected0);
78 } 76 }
OLDNEW
« no previous file with comments | « fxjs/fxjs_v8.cpp ('k') | fxjs/include/fxjs_v8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698