diff options
-rw-r--r-- | chrome/test/base/v8_unit_test.cc | 40 | ||||
-rw-r--r-- | chrome/test/base/v8_unit_test.h | 4 | ||||
-rw-r--r-- | content/renderer/v8_value_converter_impl_unittest.cc | 144 | ||||
-rw-r--r-- | webkit/plugins/ppapi/v8_var_converter_unittest.cc | 31 |
4 files changed, 130 insertions, 89 deletions
diff --git a/chrome/test/base/v8_unit_test.cc b/chrome/test/base/v8_unit_test.cc index 86753ec..087e98e 100644 --- a/chrome/test/base/v8_unit_test.cc +++ b/chrome/test/base/v8_unit_test.cc @@ -45,7 +45,9 @@ base::FilePath gen_test_data_directory; } // namespace -V8UnitTest::V8UnitTest() { +V8UnitTest::V8UnitTest() + : isolate_(v8::Isolate::GetCurrent()), + handle_scope_(isolate_) { InitPathsAndLibraries(); } @@ -88,11 +90,13 @@ bool V8UnitTest::RunJavascriptTestF( if (!ExecuteJavascriptLibraries()) return false; - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::Context::Scope context_scope(isolate_, context_); + v8::HandleScope handle_scope(isolate_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); v8::Handle<v8::Value> functionProperty = - context_->Global()->Get(v8::String::New("runTest")); + context->Global()->Get(v8::String::New("runTest")); EXPECT_FALSE(functionProperty.IsEmpty()); if (::testing::Test::HasNonfatalFailure()) return false; @@ -112,7 +116,7 @@ bool V8UnitTest::RunJavascriptTestF( }; v8::TryCatch try_catch; - v8::Handle<v8::Value> result = function->Call(context_->Global(), 3, args); + v8::Handle<v8::Value> result = function->Call(context->Global(), 3, args); // The test fails if an exception was thrown. EXPECT_FALSE(result.IsEmpty()); if (::testing::Test::HasNonfatalFailure()) @@ -174,23 +178,21 @@ void V8UnitTest::SetUp() { console->Set(v8::String::New("error"), v8::FunctionTemplate::New(&V8UnitTest::Error)); - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - // TODO(marja): Use v8::Persistent::Reset here. - context_ = v8::Persistent<v8::Context>( - isolate, v8::Context::New(isolate, NULL, global)); + context_.Reset(isolate_, v8::Context::New(isolate_, NULL, global)); } void V8UnitTest::SetGlobalStringVar(const std::string& var_name, const std::string& value) { - v8::Context::Scope context_scope(context_); - context_->Global()->Set(v8::String::New(var_name.c_str(), var_name.length()), - v8::String::New(value.c_str(), value.length())); + v8::Context::Scope context_scope(isolate_, context_); + v8::Local<v8::Context>::New(isolate_, context_)->Global() + ->Set(v8::String::New(var_name.c_str(), var_name.length()), + v8::String::New(value.c_str(), value.length())); } void V8UnitTest::ExecuteScriptInContext(const base::StringPiece& script_source, const base::StringPiece& script_name) { - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::Context::Scope context_scope(isolate_, context_); + v8::HandleScope handle_scope(isolate_); v8::Handle<v8::String> source = v8::String::New(script_source.data(), script_source.size()); v8::Handle<v8::String> name = v8::String::New(script_name.data(), @@ -228,18 +230,20 @@ std::string V8UnitTest::ExceptionToString(const v8::TryCatch& try_catch) { } void V8UnitTest::TestFunction(const std::string& function_name) { - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::Context::Scope context_scope(isolate_, context_); + v8::HandleScope handle_scope(isolate_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); v8::Handle<v8::Value> functionProperty = - context_->Global()->Get(v8::String::New(function_name.c_str())); + context->Global()->Get(v8::String::New(function_name.c_str())); ASSERT_FALSE(functionProperty.IsEmpty()); ASSERT_TRUE(functionProperty->IsFunction()); v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(functionProperty); v8::TryCatch try_catch; - v8::Handle<v8::Value> result = function->Call(context_->Global(), 0, NULL); + v8::Handle<v8::Value> result = function->Call(context->Global(), 0, NULL); // The test fails if an exception was thrown. if (result.IsEmpty()) FAIL() << ExceptionToString(try_catch); diff --git a/chrome/test/base/v8_unit_test.h b/chrome/test/base/v8_unit_test.h index 69f4af1..d03ba4c 100644 --- a/chrome/test/base/v8_unit_test.h +++ b/chrome/test/base/v8_unit_test.h @@ -74,11 +74,13 @@ class V8UnitTest : public testing::Test { // Initializes paths and libraries. void InitPathsAndLibraries(); + v8::Isolate* isolate_; + // Handle scope that is used throughout the life of this class. v8::HandleScope handle_scope_; // Context for the JavaScript in the test. - v8::Handle<v8::Context> context_; + v8::Persistent<v8::Context> context_; // User added libraries. std::vector<base::FilePath> user_libraries_; diff --git a/content/renderer/v8_value_converter_impl_unittest.cc b/content/renderer/v8_value_converter_impl_unittest.cc index a5ce247..ad9232b 100644 --- a/content/renderer/v8_value_converter_impl_unittest.cc +++ b/content/renderer/v8_value_converter_impl_unittest.cc @@ -55,18 +55,20 @@ v8::Handle<v8::Value> NamedCallbackGetter(v8::Local<v8::String> name, } // namespace class V8ValueConverterImplTest : public testing::Test { + public: + V8ValueConverterImplTest() + : isolate_(v8::Isolate::GetCurrent()) { + } + protected: virtual void SetUp() { - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - // TODO(marja): Use v8::Persistent::Reset here. - context_ = v8::Persistent<v8::Context>( - isolate, v8::Context::New(isolate, NULL, global)); + context_.Reset(isolate_, v8::Context::New(isolate_, NULL, global)); } virtual void TearDown() { - context_.Dispose(context_->GetIsolate()); + context_.Dispose(); } std::string GetString(base::DictionaryValue* value, const std::string& key) { @@ -148,7 +150,9 @@ class V8ValueConverterImplTest : public testing::Test { v8::Handle<v8::Value> val, base::Value::Type expected_type, scoped_ptr<base::Value> expected_value) { - scoped_ptr<base::Value> raw(converter.FromV8Value(val, context_)); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); + scoped_ptr<base::Value> raw(converter.FromV8Value(val, context)); if (expected_value) { ASSERT_TRUE(raw.get()); @@ -162,7 +166,7 @@ class V8ValueConverterImplTest : public testing::Test { object->Set(v8::String::New("test"), val); scoped_ptr<base::DictionaryValue> dictionary( static_cast<base::DictionaryValue*>( - converter.FromV8Value(object, context_))); + converter.FromV8Value(object, context))); ASSERT_TRUE(dictionary.get()); if (expected_value) { @@ -177,7 +181,7 @@ class V8ValueConverterImplTest : public testing::Test { v8::Handle<v8::Array> array(v8::Array::New()); array->Set(0, val); scoped_ptr<base::ListValue> list( - static_cast<base::ListValue*>(converter.FromV8Value(array, context_))); + static_cast<base::ListValue*>(converter.FromV8Value(array, context))); ASSERT_TRUE(list.get()); if (expected_value) { base::Value* temp = NULL; @@ -193,6 +197,8 @@ class V8ValueConverterImplTest : public testing::Test { } } + v8::Isolate* isolate_; + // Context for the JavaScript in the test. v8::Persistent<v8::Context> context_; }; @@ -219,12 +225,14 @@ TEST_F(V8ValueConverterImplTest, BasicRoundTrip) { " \"empty-list\": [], \n" "}"); - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); V8ValueConverterImpl converter; v8::Handle<v8::Object> v8_object = - converter.ToV8Value(original_root.get(), context_).As<v8::Object>(); + converter.ToV8Value(original_root.get(), context).As<v8::Object>(); ASSERT_FALSE(v8_object.IsEmpty()); EXPECT_EQ(static_cast<const base::DictionaryValue&>(*original_root).size(), @@ -245,7 +253,7 @@ TEST_F(V8ValueConverterImplTest, BasicRoundTrip) { EXPECT_TRUE(v8_object->Get(v8::String::New("list"))->IsArray()); EXPECT_TRUE(v8_object->Get(v8::String::New("empty-list"))->IsArray()); - scoped_ptr<base::Value> new_root(converter.FromV8Value(v8_object, context_)); + scoped_ptr<base::Value> new_root(converter.FromV8Value(v8_object, context)); EXPECT_NE(original_root.get(), new_root.get()); EXPECT_TRUE(original_root->Equals(new_root.get())); } @@ -254,20 +262,24 @@ TEST_F(V8ValueConverterImplTest, KeysWithDots) { scoped_ptr<base::Value> original = base::test::ParseJson("{ \"foo.bar\": \"baz\" }"); - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); V8ValueConverterImpl converter; scoped_ptr<base::Value> copy( converter.FromV8Value( - converter.ToV8Value(original.get(), context_), context_)); + converter.ToV8Value(original.get(), context), context)); EXPECT_TRUE(original->Equals(copy.get())); } TEST_F(V8ValueConverterImplTest, ObjectExceptions) { - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); // Set up objects to throw when reading or writing 'foo'. const char* source = @@ -286,7 +298,7 @@ TEST_F(V8ValueConverterImplTest, ObjectExceptions) { V8ValueConverterImpl converter; scoped_ptr<base::DictionaryValue> converted( static_cast<base::DictionaryValue*>( - converter.FromV8Value(object, context_))); + converter.FromV8Value(object, context))); EXPECT_TRUE(converted.get()); // http://code.google.com/p/v8/issues/detail?id=1342 // EXPECT_EQ(2u, converted->size()); @@ -297,15 +309,17 @@ TEST_F(V8ValueConverterImplTest, ObjectExceptions) { // Converting to v8 value should drop the foo property. converted->SetString("foo", "foo"); v8::Handle<v8::Object> copy = - converter.ToV8Value(converted.get(), context_).As<v8::Object>(); + converter.ToV8Value(converted.get(), context).As<v8::Object>(); EXPECT_FALSE(copy.IsEmpty()); EXPECT_EQ(2u, copy->GetPropertyNames()->Length()); EXPECT_EQ("bar", GetString(copy, "bar")); } TEST_F(V8ValueConverterImplTest, ArrayExceptions) { - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); const char* source = "(function() {" "var arr = [];" @@ -324,7 +338,7 @@ TEST_F(V8ValueConverterImplTest, ArrayExceptions) { // Converting from v8 value should replace the first item with null. V8ValueConverterImpl converter; scoped_ptr<base::ListValue> converted(static_cast<base::ListValue*>( - converter.FromV8Value(array, context_))); + converter.FromV8Value(array, context))); ASSERT_TRUE(converted.get()); // http://code.google.com/p/v8/issues/detail?id=1342 EXPECT_EQ(2u, converted->GetSize()); @@ -334,15 +348,15 @@ TEST_F(V8ValueConverterImplTest, ArrayExceptions) { converted.reset(static_cast<base::ListValue*>( base::test::ParseJson("[ \"foo\", \"bar\" ]").release())); v8::Handle<v8::Array> copy = - converter.ToV8Value(converted.get(), context_).As<v8::Array>(); + converter.ToV8Value(converted.get(), context).As<v8::Array>(); ASSERT_FALSE(copy.IsEmpty()); EXPECT_EQ(2u, copy->Length()); EXPECT_EQ("bar", GetString(copy, 1)); } TEST_F(V8ValueConverterImplTest, WeirdTypes) { - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); v8::Handle<v8::RegExp> regex( v8::RegExp::New(v8::String::New("."), v8::RegExp::kNone)); @@ -375,8 +389,10 @@ TEST_F(V8ValueConverterImplTest, WeirdTypes) { } TEST_F(V8ValueConverterImplTest, Prototype) { - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); const char* source = "(function() {" "Object.prototype.foo = 'foo';" @@ -390,14 +406,16 @@ TEST_F(V8ValueConverterImplTest, Prototype) { V8ValueConverterImpl converter; scoped_ptr<base::DictionaryValue> result( static_cast<base::DictionaryValue*>( - converter.FromV8Value(object, context_))); + converter.FromV8Value(object, context))); ASSERT_TRUE(result.get()); EXPECT_EQ(0u, result->size()); } TEST_F(V8ValueConverterImplTest, StripNullFromObjects) { - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); const char* source = "(function() {" "return { foo: undefined, bar: null };" @@ -412,14 +430,16 @@ TEST_F(V8ValueConverterImplTest, StripNullFromObjects) { scoped_ptr<base::DictionaryValue> result( static_cast<base::DictionaryValue*>( - converter.FromV8Value(object, context_))); + converter.FromV8Value(object, context))); ASSERT_TRUE(result.get()); EXPECT_EQ(0u, result->size()); } TEST_F(V8ValueConverterImplTest, RecursiveObjects) { - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); V8ValueConverterImpl converter; @@ -430,7 +450,7 @@ TEST_F(V8ValueConverterImplTest, RecursiveObjects) { scoped_ptr<base::DictionaryValue> object_result( static_cast<base::DictionaryValue*>( - converter.FromV8Value(object, context_))); + converter.FromV8Value(object, context))); ASSERT_TRUE(object_result.get()); EXPECT_EQ(2u, object_result->size()); EXPECT_TRUE(IsNull(object_result.get(), "obj")); @@ -441,15 +461,17 @@ TEST_F(V8ValueConverterImplTest, RecursiveObjects) { array->Set(1, array); scoped_ptr<base::ListValue> list_result( - static_cast<base::ListValue*>(converter.FromV8Value(array, context_))); + static_cast<base::ListValue*>(converter.FromV8Value(array, context))); ASSERT_TRUE(list_result.get()); EXPECT_EQ(2u, list_result->GetSize()); EXPECT_TRUE(IsNull(list_result.get(), 1)); } TEST_F(V8ValueConverterImplTest, WeirdProperties) { - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); const char* source = "(function() {" "return {" @@ -467,7 +489,7 @@ TEST_F(V8ValueConverterImplTest, WeirdProperties) { ASSERT_FALSE(object.IsEmpty()); V8ValueConverterImpl converter; - scoped_ptr<base::Value> actual(converter.FromV8Value(object, context_)); + scoped_ptr<base::Value> actual(converter.FromV8Value(object, context)); scoped_ptr<base::Value> expected = base::test::ParseJson( "{ \n" @@ -483,8 +505,10 @@ TEST_F(V8ValueConverterImplTest, WeirdProperties) { } TEST_F(V8ValueConverterImplTest, ArrayGetters) { - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); const char* source = "(function() {" "var a = [0];" @@ -498,14 +522,16 @@ TEST_F(V8ValueConverterImplTest, ArrayGetters) { V8ValueConverterImpl converter; scoped_ptr<base::ListValue> result( - static_cast<base::ListValue*>(converter.FromV8Value(array, context_))); + static_cast<base::ListValue*>(converter.FromV8Value(array, context))); ASSERT_TRUE(result.get()); EXPECT_EQ(2u, result->GetSize()); } TEST_F(V8ValueConverterImplTest, UndefinedValueBehavior) { - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); v8::Handle<v8::Object> object; { @@ -530,19 +556,21 @@ TEST_F(V8ValueConverterImplTest, UndefinedValueBehavior) { V8ValueConverterImpl converter; scoped_ptr<base::Value> actual_object( - converter.FromV8Value(object, context_)); + converter.FromV8Value(object, context)); EXPECT_TRUE(base::Value::Equals( base::test::ParseJson("{ \"bar\": null }").get(), actual_object.get())); // Everything is null because JSON stringification preserves array length. - scoped_ptr<Value> actual_array(converter.FromV8Value(array, context_)); + scoped_ptr<Value> actual_array(converter.FromV8Value(array, context)); EXPECT_TRUE(base::Value::Equals( base::test::ParseJson("[ null, null, null ]").get(), actual_array.get())); } TEST_F(V8ValueConverterImplTest, ObjectsWithClashingIdentityHash) { - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); V8ValueConverterImpl converter; // We check that the converter checks identity correctly by disabling the @@ -561,15 +589,17 @@ TEST_F(V8ValueConverterImplTest, ObjectsWithClashingIdentityHash) { ASSERT_TRUE(expected.get()); // The actual result. - scoped_ptr<base::Value> value(converter.FromV8Value(root, context_)); + scoped_ptr<base::Value> value(converter.FromV8Value(root, context)); ASSERT_TRUE(value.get()); EXPECT_TRUE(expected->Equals(value.get())); } TEST_F(V8ValueConverterImplTest, DetectCycles) { - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); V8ValueConverterImpl converter; // Create a recursive array. @@ -582,7 +612,7 @@ TEST_F(V8ValueConverterImplTest, DetectCycles) { // The actual result. scoped_ptr<base::Value> actual_list( - converter.FromV8Value(recursive_array, context_)); + converter.FromV8Value(recursive_array, context)); ASSERT_TRUE(actual_list.get()); EXPECT_TRUE(expected_list.Equals(actual_list.get())); @@ -601,15 +631,17 @@ TEST_F(V8ValueConverterImplTest, DetectCycles) { // The actual result. scoped_ptr<base::Value> actual_dictionary( - converter.FromV8Value(recursive_object, context_)); + converter.FromV8Value(recursive_object, context)); ASSERT_TRUE(actual_dictionary.get()); EXPECT_TRUE(expected_dictionary.Equals(actual_dictionary.get())); } TEST_F(V8ValueConverterImplTest, MaxRecursionDepth) { - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); // Must larger than kMaxRecursionDepth in v8_value_converter_impl.cc. int kDepth = 100; @@ -625,7 +657,7 @@ TEST_F(V8ValueConverterImplTest, MaxRecursionDepth) { } V8ValueConverterImpl converter; - scoped_ptr<base::Value> value(converter.FromV8Value(deep_object, context_)); + scoped_ptr<base::Value> value(converter.FromV8Value(deep_object, context)); ASSERT_TRUE(value); // Expected depth is kMaxRecursionDepth in v8_value_converter_impl.cc. diff --git a/webkit/plugins/ppapi/v8_var_converter_unittest.cc b/webkit/plugins/ppapi/v8_var_converter_unittest.cc index a216348..2198cf8 100644 --- a/webkit/plugins/ppapi/v8_var_converter_unittest.cc +++ b/webkit/plugins/ppapi/v8_var_converter_unittest.cc @@ -133,21 +133,19 @@ bool Equals(const PP_Var& var, class V8VarConverterTest : public testing::Test { public: - V8VarConverterTest() {} + V8VarConverterTest() + : isolate_(v8::Isolate::GetCurrent()) {} ~V8VarConverterTest() {} // testing::Test implementation. virtual void SetUp() { ProxyLock::Acquire(); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - // TODO(marja): Use v8::Persistent::Reset here. - context_ = v8::Persistent<v8::Context>( - isolate, v8::Context::New(isolate, NULL, global)); + context_.Reset(isolate_, v8::Context::New(isolate_, NULL, global)); } virtual void TearDown() { - context_.Dispose(context_->GetIsolate()); + context_.Dispose(); ASSERT_TRUE(PpapiGlobals::Get()->GetVarTracker()->GetLiveVars().empty()); ProxyLock::Release(); } @@ -155,14 +153,16 @@ class V8VarConverterTest : public testing::Test { protected: bool RoundTrip(const PP_Var& var, PP_Var* result) { V8VarConverter converter; - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, context_); v8::Handle<v8::Value> v8_result; - if (!converter.ToV8Value(var, context_, &v8_result)) + if (!converter.ToV8Value(var, context, &v8_result)) return false; if (!Equals(var, v8_result)) return false; - if (!converter.FromV8Value(v8_result, context_, result)) + if (!converter.FromV8Value(v8_result, context, result)) return false; return true; } @@ -177,6 +177,8 @@ class V8VarConverterTest : public testing::Test { return TestEqual(expected.get(), actual.get()); } + v8::Isolate* isolate_; + // Context for the JavaScript in the test. v8::Persistent<v8::Context> context_; @@ -305,8 +307,8 @@ TEST_F(V8VarConverterTest, StrangeDictionaryKeyTest) { { // Test non-string key types. They should be cast to strings. - v8::Context::Scope context_scope(context_); - v8::HandleScope handle_scope; + v8::HandleScope handle_scope(isolate_); + v8::Context::Scope context_scope(isolate_, context_); const char* source = "(function() {" "return {" @@ -325,7 +327,8 @@ TEST_F(V8VarConverterTest, StrangeDictionaryKeyTest) { V8VarConverter converter; PP_Var actual; - ASSERT_TRUE(converter.FromV8Value(object, context_, &actual)); + ASSERT_TRUE(converter.FromV8Value( + object, v8::Local<v8::Context>::New(isolate_, context_), &actual)); ScopedPPVar release_actual(ScopedPPVar::PassRef(), actual); scoped_refptr<DictionaryVar> expected(new DictionaryVar); |