diff options
-rw-r--r-- | chrome/renderer/extensions/chrome_app_bindings.cc | 7 | ||||
-rw-r--r-- | chrome/renderer/extensions/event_bindings.cc | 1 | ||||
-rw-r--r-- | chrome/renderer/extensions/extension_bindings_context_set.cc | 8 | ||||
-rw-r--r-- | content/content_renderer.gypi | 5 | ||||
-rw-r--r-- | content/content_tests.gypi | 2 | ||||
-rw-r--r-- | content/public/renderer/DEPS | 1 | ||||
-rw-r--r-- | content/public/renderer/v8_value_converter.h | 47 | ||||
-rw-r--r-- | content/renderer/intents_dispatcher.cc | 2 | ||||
-rw-r--r-- | content/renderer/render_view.cc | 5 | ||||
-rw-r--r-- | content/renderer/v8_value_converter.h | 68 | ||||
-rw-r--r-- | content/renderer/v8_value_converter_impl.cc (renamed from content/renderer/v8_value_converter.cc) | 32 | ||||
-rw-r--r-- | content/renderer/v8_value_converter_impl.h | 53 | ||||
-rw-r--r-- | content/renderer/v8_value_converter_impl_unittest.cc (renamed from content/renderer/v8_value_converter_unittest.cc) | 30 |
13 files changed, 154 insertions, 107 deletions
diff --git a/chrome/renderer/extensions/chrome_app_bindings.cc b/chrome/renderer/extensions/chrome_app_bindings.cc index f2b8638..c13e497 100644 --- a/chrome/renderer/extensions/chrome_app_bindings.cc +++ b/chrome/renderer/extensions/chrome_app_bindings.cc @@ -14,13 +14,14 @@ #include "chrome/common/extensions/extension_set.h" #include "chrome/renderer/extensions/extension_dispatcher.h" #include "chrome/renderer/extensions/extension_helper.h" +#include "content/public/renderer/v8_value_converter.h" #include "content/renderer/render_view.h" -#include "content/renderer/v8_value_converter.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "v8/include/v8.h" using WebKit::WebFrame; +using content::V8ValueConverter; namespace { @@ -174,8 +175,8 @@ class ChromeAppExtensionWrapper : public v8::Extension { scoped_ptr<DictionaryValue> manifest_copy( extension->manifest_value()->DeepCopy()); manifest_copy->SetString("id", extension->id()); - V8ValueConverter converter; - return converter.ToV8Value(manifest_copy.get(), + scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); + return converter->ToV8Value(manifest_copy.get(), frame->mainWorldScriptContext()); } diff --git a/chrome/renderer/extensions/event_bindings.cc b/chrome/renderer/extensions/event_bindings.cc index 5b2713d..c3b47cf3 100644 --- a/chrome/renderer/extensions/event_bindings.cc +++ b/chrome/renderer/extensions/event_bindings.cc @@ -21,7 +21,6 @@ #include "chrome/renderer/extensions/user_script_slave.h" #include "content/renderer/render_thread.h" #include "content/renderer/render_view.h" -#include "content/renderer/v8_value_converter.h" #include "googleurl/src/gurl.h" #include "grit/renderer_resources.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" diff --git a/chrome/renderer/extensions/extension_bindings_context_set.cc b/chrome/renderer/extensions/extension_bindings_context_set.cc index 8977c05..48f4a04 100644 --- a/chrome/renderer/extensions/extension_bindings_context_set.cc +++ b/chrome/renderer/extensions/extension_bindings_context_set.cc @@ -9,9 +9,9 @@ #include "base/tracked_objects.h" #include "chrome/renderer/extensions/extension_bindings_context.h" #include "content/common/url_constants.h" +#include "content/public/renderer/v8_value_converter.h" #include "content/renderer/render_thread.h" #include "content/renderer/render_view.h" -#include "content/renderer/v8_value_converter.h" #include "v8/include/v8.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" @@ -19,6 +19,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" +using content::V8ValueConverter; + namespace { // Returns true if the extension running in the given |render_view| has @@ -124,7 +126,7 @@ void ExtensionBindingsContextSet::DispatchChromeHiddenMethod( // out from under us. ContextSet contexts = GetAll(); - V8ValueConverter converter; + scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); for (ContextSet::iterator it = contexts.begin(); it != contexts.end(); ++it) { if ((*it)->v8_context().IsEmpty()) @@ -148,7 +150,7 @@ void ExtensionBindingsContextSet::DispatchChromeHiddenMethod( for (size_t i = 0; i < arguments.GetSize(); ++i) { base::Value* item = NULL; CHECK(arguments.Get(i, &item)); - v8_arguments.push_back(converter.ToV8Value(item, context)); + v8_arguments.push_back(converter->ToV8Value(item, context)); } v8::Handle<v8::Value> retval = (*it)->CallChromeHiddenMethod( diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index f2ae861..c0571ac 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi @@ -32,6 +32,7 @@ 'public/renderer/render_view_observer.h', 'public/renderer/render_view_observer_tracker.h', 'public/renderer/render_view_visitor.h', + 'public/renderer/v8_value_converter.h', 'renderer/active_notification_tracker.cc', 'renderer/active_notification_tracker.h', 'renderer/device_orientation_dispatcher.cc', @@ -157,8 +158,8 @@ 'renderer/speech_input_dispatcher.h', 'renderer/text_input_client_observer.cc', 'renderer/text_input_client_observer.h', - 'renderer/v8_value_converter.cc', - 'renderer/v8_value_converter.h', + 'renderer/v8_value_converter_impl.cc', + 'renderer/v8_value_converter_impl.h', 'renderer/webplugin_delegate_proxy.cc', 'renderer/webplugin_delegate_proxy.h', 'renderer/websharedworker_proxy.cc', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 8d15641..7fd04a5 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -173,7 +173,7 @@ 'renderer/media/video_capture_impl_unittest.cc', 'renderer/media/video_capture_message_filter_unittest.cc', 'renderer/paint_aggregator_unittest.cc', - 'renderer/v8_value_converter_unittest.cc', + 'renderer/v8_value_converter_impl_unittest.cc', 'test/run_all_unittests.cc', ], 'conditions': [ diff --git a/content/public/renderer/DEPS b/content/public/renderer/DEPS index ad40bca..d472a18 100644 --- a/content/public/renderer/DEPS +++ b/content/public/renderer/DEPS @@ -1,3 +1,4 @@ include_rules = [ "+content/renderer/render_view.h", + "+v8/include/v8.h", ] diff --git a/content/public/renderer/v8_value_converter.h b/content/public/renderer/v8_value_converter.h new file mode 100644 index 0000000..f14f48e --- /dev/null +++ b/content/public/renderer/v8_value_converter.h @@ -0,0 +1,47 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ +#define CONTENT_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ + +#include "content/common/content_export.h" +#include "v8/include/v8.h" + +namespace base { +class DictionaryValue; +class ListValue; +class Value; +} + +namespace content { + +// Converts between v8::Value (JavaScript values in the v8 heap) and Chrome's +// values (from base/values.h). Lists and dictionaries are converted +// recursively. +// +// Only the JSON types (null, boolean, string, number, array, and object) are +// supported. +class V8ValueConverter { + public: + CONTENT_EXPORT static V8ValueConverter* create(); + + virtual ~V8ValueConverter() {} + + // Converts Value to v8::Value. Unsupported types are replaced with null. + // If an array or object throws while setting a value, that property or item + // is skipped, leaving a hole in the case of arrays. + virtual v8::Handle<v8::Value> ToV8Value( + base::Value* value, + v8::Handle<v8::Context> context) const = 0; + + // Converts v8::Value to Value. Unsupported types are replaced with null. + // If an array or object throws while getting a value, that property or item + // is replaced with null. + virtual base::Value* FromV8Value(v8::Handle<v8::Value> value, + v8::Handle<v8::Context> context) const = 0; +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ diff --git a/content/renderer/intents_dispatcher.cc b/content/renderer/intents_dispatcher.cc index da74b94..697d60e 100644 --- a/content/renderer/intents_dispatcher.cc +++ b/content/renderer/intents_dispatcher.cc @@ -5,12 +5,12 @@ #include "content/renderer/intents_dispatcher.h" #include "content/common/intents_messages.h" -#include "content/renderer/v8_value_converter.h" #include "ipc/ipc_message.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptValue.h" +#include "v8/include/v8.h" #include "webkit/glue/cpp_bound_class.h" using WebKit::WebCString; diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index 5a20971..dde2992 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -68,7 +68,7 @@ #include "content/renderer/renderer_webstoragenamespace_impl.h" #include "content/renderer/speech_input_dispatcher.h" #include "content/renderer/text_input_client_observer.h" -#include "content/renderer/v8_value_converter.h" +#include "content/renderer/v8_value_converter_impl.h" #include "content/renderer/web_ui_bindings.h" #include "content/renderer/webplugin_delegate_proxy.h" #include "content/renderer/websharedworker_proxy.h" @@ -240,6 +240,7 @@ using base::TimeDelta; using content::NavigationState; using content::RenderViewObserver; using content::RenderViewVisitor; +using content::V8ValueConverter; using webkit_glue::AltErrorPageResourceFetcher; using webkit_glue::FormField; using webkit_glue::PasswordForm; @@ -3419,7 +3420,7 @@ void RenderView::EvaluateScript(const string16& frame_xpath, v8::HandleScope handle_scope; v8::Local<v8::Context> context = web_frame->mainWorldScriptContext(); v8::Context::Scope context_scope(context); - V8ValueConverter converter; + V8ValueConverterImpl converter; converter.set_allow_date(true); converter.set_allow_regexp(true); list.Set(0, converter.FromV8Value(result, context)); diff --git a/content/renderer/v8_value_converter.h b/content/renderer/v8_value_converter.h deleted file mode 100644 index 4c74f2f..0000000 --- a/content/renderer/v8_value_converter.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_RENDERER_V8_VALUE_CONVERTER_H_ -#define CHROME_RENDERER_V8_VALUE_CONVERTER_H_ - -#include "content/common/content_export.h" -#include "v8/include/v8.h" - -namespace base { -class DictionaryValue; -class ListValue; -class Value; -} - -// Converts between v8::Value (JavaScript values in the v8 heap) and Chrome's -// values (from base/values.h). Lists and dictionaries are converted -// recursively. -// -// Only the JSON types (null, boolean, string, number, array, and object) are -// supported by default. Additional types can be allowed with e.g. -// set_allow_date(), set_allow_regexp(). -class CONTENT_EXPORT V8ValueConverter { - public: - V8ValueConverter(); - - bool allow_undefined() const { return allow_undefined_; } - void set_allow_undefined(bool val) { allow_undefined_ = val; } - - bool allow_date() const { return allow_date_; } - void set_allow_date(bool val) { allow_date_ = val; } - - bool allow_regexp() const { return allow_regexp_; } - void set_allow_regexp(bool val) { allow_regexp_ = val; } - - // Converts Value to v8::Value. Unsupported types are replaced with null. - // If an array or object throws while setting a value, that property or item - // is skipped, leaving a hole in the case of arrays. - v8::Handle<v8::Value> ToV8Value(base::Value* value, - v8::Handle<v8::Context> context) const; - - // Converts v8::Value to Value. Unsupported types are replaced with null. - // If an array or object throws while getting a value, that property or item - // is replaced with null. - base::Value* FromV8Value(v8::Handle<v8::Value> value, - v8::Handle<v8::Context> context) const; - - private: - v8::Handle<v8::Value> ToV8ValueImpl(base::Value* value) const; - v8::Handle<v8::Value> ToV8Array(base::ListValue* list) const; - v8::Handle<v8::Value> ToV8Object(base::DictionaryValue* dictionary) const; - - base::Value* FromV8ValueImpl(v8::Handle<v8::Value> value) const; - base::ListValue* FromV8Array(v8::Handle<v8::Array> array) const; - base::DictionaryValue* FromV8Object(v8::Handle<v8::Object> object) const; - - // If true, we will convert undefined JavaScript values to null. - bool allow_undefined_; - - // If true, we will convert Date JavaScript objects to doubles. - bool allow_date_; - - // If true, we will convet RegExp JavaScript objects to string. - bool allow_regexp_; -}; - -#endif // CHROME_RENDERER_V8_VALUE_CONVERTER_H_ diff --git a/content/renderer/v8_value_converter.cc b/content/renderer/v8_value_converter_impl.cc index d2c21cd..218624a 100644 --- a/content/renderer/v8_value_converter.cc +++ b/content/renderer/v8_value_converter_impl.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/renderer/v8_value_converter.h" +#include "content/renderer/v8_value_converter_impl.h" #include <string> @@ -11,27 +11,36 @@ #include "base/values.h" #include "v8/include/v8.h" -V8ValueConverter::V8ValueConverter() +namespace content { + +V8ValueConverter* V8ValueConverter::create() { + return new V8ValueConverterImpl(); +} + +} + +V8ValueConverterImpl::V8ValueConverterImpl() : allow_undefined_(false), allow_date_(false), allow_regexp_(false) { } -v8::Handle<v8::Value> V8ValueConverter::ToV8Value( +v8::Handle<v8::Value> V8ValueConverterImpl::ToV8Value( Value* value, v8::Handle<v8::Context> context) const { v8::Context::Scope context_scope(context); v8::HandleScope handle_scope; return handle_scope.Close(ToV8ValueImpl(value)); } -Value* V8ValueConverter::FromV8Value(v8::Handle<v8::Value> val, - v8::Handle<v8::Context> context) const { +Value* V8ValueConverterImpl::FromV8Value( + v8::Handle<v8::Value> val, + v8::Handle<v8::Context> context) const { v8::Context::Scope context_scope(context); v8::HandleScope handle_scope; return FromV8ValueImpl(val); } -v8::Handle<v8::Value> V8ValueConverter::ToV8ValueImpl(Value* value) const { +v8::Handle<v8::Value> V8ValueConverterImpl::ToV8ValueImpl(Value* value) const { CHECK(value); switch (value->GetType()) { case Value::TYPE_NULL: @@ -73,7 +82,7 @@ v8::Handle<v8::Value> V8ValueConverter::ToV8ValueImpl(Value* value) const { } } -v8::Handle<v8::Value> V8ValueConverter::ToV8Array(ListValue* val) const { +v8::Handle<v8::Value> V8ValueConverterImpl::ToV8Array(ListValue* val) const { v8::Handle<v8::Array> result(v8::Array::New(val->GetSize())); for (size_t i = 0; i < val->GetSize(); ++i) { @@ -92,7 +101,8 @@ v8::Handle<v8::Value> V8ValueConverter::ToV8Array(ListValue* val) const { return result; } -v8::Handle<v8::Value> V8ValueConverter::ToV8Object(DictionaryValue* val) const { +v8::Handle<v8::Value> V8ValueConverterImpl::ToV8Object( + DictionaryValue* val) const { v8::Handle<v8::Object> result(v8::Object::New()); for (DictionaryValue::key_iterator iter = val->begin_keys(); @@ -115,7 +125,7 @@ v8::Handle<v8::Value> V8ValueConverter::ToV8Object(DictionaryValue* val) const { return result; } -Value* V8ValueConverter::FromV8ValueImpl(v8::Handle<v8::Value> val) const { +Value* V8ValueConverterImpl::FromV8ValueImpl(v8::Handle<v8::Value> val) const { CHECK(!val.IsEmpty()); if (val->IsNull()) @@ -159,7 +169,7 @@ Value* V8ValueConverter::FromV8ValueImpl(v8::Handle<v8::Value> val) const { return Value::CreateNullValue(); } -ListValue* V8ValueConverter::FromV8Array(v8::Handle<v8::Array> val) const { +ListValue* V8ValueConverterImpl::FromV8Array(v8::Handle<v8::Array> val) const { ListValue* result = new ListValue(); for (uint32 i = 0; i < val->Length(); ++i) { v8::TryCatch try_catch; @@ -182,7 +192,7 @@ ListValue* V8ValueConverter::FromV8Array(v8::Handle<v8::Array> val) const { return result; } -DictionaryValue* V8ValueConverter::FromV8Object( +DictionaryValue* V8ValueConverterImpl::FromV8Object( v8::Handle<v8::Object> val) const { DictionaryValue* result = new DictionaryValue(); v8::Handle<v8::Array> property_names(val->GetPropertyNames()); diff --git a/content/renderer/v8_value_converter_impl.h b/content/renderer/v8_value_converter_impl.h new file mode 100644 index 0000000..dfdc001 --- /dev/null +++ b/content/renderer/v8_value_converter_impl.h @@ -0,0 +1,53 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_ +#define CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_ + +#include "base/compiler_specific.h" +#include "content/public/renderer/v8_value_converter.h" + +class V8ValueConverterImpl : public content::V8ValueConverter { + public: + V8ValueConverterImpl(); + + // Use the following setters to support additional types other than the + // default ones. + bool allow_undefined() const { return allow_undefined_; } + void set_allow_undefined(bool val) { allow_undefined_ = val; } + + bool allow_date() const { return allow_date_; } + void set_allow_date(bool val) { allow_date_ = val; } + + bool allow_regexp() const { return allow_regexp_; } + void set_allow_regexp(bool val) { allow_regexp_ = val; } + + // V8ValueConverter implementation. + virtual v8::Handle<v8::Value> ToV8Value( + base::Value* value, + v8::Handle<v8::Context> context) const OVERRIDE; + virtual base::Value* FromV8Value( + v8::Handle<v8::Value> value, + v8::Handle<v8::Context> context) const OVERRIDE; + + private: + v8::Handle<v8::Value> ToV8ValueImpl(base::Value* value) const; + v8::Handle<v8::Value> ToV8Array(base::ListValue* list) const; + v8::Handle<v8::Value> ToV8Object(base::DictionaryValue* dictionary) const; + + base::Value* FromV8ValueImpl(v8::Handle<v8::Value> value) const; + base::ListValue* FromV8Array(v8::Handle<v8::Array> array) const; + base::DictionaryValue* FromV8Object(v8::Handle<v8::Object> object) const; + + // If true, we will convert undefined JavaScript values to null. + bool allow_undefined_; + + // If true, we will convert Date JavaScript objects to doubles. + bool allow_date_; + + // If true, we will convet RegExp JavaScript objects to string. + bool allow_regexp_; +}; + +#endif // CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_ diff --git a/content/renderer/v8_value_converter_unittest.cc b/content/renderer/v8_value_converter_impl_unittest.cc index 7eed5f4..44b4712 100644 --- a/content/renderer/v8_value_converter_unittest.cc +++ b/content/renderer/v8_value_converter_impl_unittest.cc @@ -6,11 +6,11 @@ #include "base/memory/scoped_ptr.h" #include "base/values.h" -#include "content/renderer/v8_value_converter.h" +#include "content/renderer/v8_value_converter_impl.h" #include "testing/gtest/include/gtest/gtest.h" #include "v8/include/v8.h" -class V8ValueConverterTest : public testing::Test { +class V8ValueConverterImplTest : public testing::Test { protected: virtual void SetUp() { v8::HandleScope handle_scope; @@ -97,7 +97,7 @@ class V8ValueConverterTest : public testing::Test { return child->IsNull(); } - void TestWeirdType(const V8ValueConverter& converter, + void TestWeirdType(const V8ValueConverterImpl& converter, v8::Handle<v8::Value> val, base::Value::Type expected_type, Value* expected_value) { @@ -135,7 +135,7 @@ class V8ValueConverterTest : public testing::Test { v8::Persistent<v8::Context> context_; }; -TEST_F(V8ValueConverterTest, BasicRoundTrip) { +TEST_F(V8ValueConverterImplTest, BasicRoundTrip) { DictionaryValue original_root; original_root.Set("null", Value::CreateNullValue()); original_root.Set("true", Value::CreateBooleanValue(true)); @@ -164,7 +164,7 @@ TEST_F(V8ValueConverterTest, BasicRoundTrip) { v8::Context::Scope context_scope(context_); v8::HandleScope handle_scope; - V8ValueConverter converter; + V8ValueConverterImpl converter; v8::Handle<v8::Object> v8_object = converter.ToV8Value(&original_root, context_).As<v8::Object>(); ASSERT_FALSE(v8_object.IsEmpty()); @@ -191,14 +191,14 @@ TEST_F(V8ValueConverterTest, BasicRoundTrip) { EXPECT_TRUE(original_root.Equals(new_root.get())); } -TEST_F(V8ValueConverterTest, KeysWithDots) { +TEST_F(V8ValueConverterImplTest, KeysWithDots) { DictionaryValue original; original.SetWithoutPathExpansion("foo.bar", Value::CreateStringValue("baz")); v8::Context::Scope context_scope(context_); v8::HandleScope handle_scope; - V8ValueConverter converter; + V8ValueConverterImpl converter; scoped_ptr<Value> copy( converter.FromV8Value( converter.ToV8Value(&original, context_), context_)); @@ -206,7 +206,7 @@ TEST_F(V8ValueConverterTest, KeysWithDots) { EXPECT_TRUE(original.Equals(copy.get())); } -TEST_F(V8ValueConverterTest, ObjectExceptions) { +TEST_F(V8ValueConverterImplTest, ObjectExceptions) { v8::Context::Scope context_scope(context_); v8::HandleScope handle_scope; @@ -224,7 +224,7 @@ TEST_F(V8ValueConverterTest, ObjectExceptions) { object->Set(v8::String::New("bar"), v8::String::New("bar")); // Converting from v8 value should replace the foo property with null. - V8ValueConverter converter; + V8ValueConverterImpl converter; scoped_ptr<DictionaryValue> converted(static_cast<DictionaryValue*>( converter.FromV8Value(object, context_))); EXPECT_TRUE(converted.get()); @@ -243,7 +243,7 @@ TEST_F(V8ValueConverterTest, ObjectExceptions) { EXPECT_EQ("bar", GetString(copy, "bar")); } -TEST_F(V8ValueConverterTest, ArrayExceptions) { +TEST_F(V8ValueConverterImplTest, ArrayExceptions) { v8::Context::Scope context_scope(context_); v8::HandleScope handle_scope; @@ -262,7 +262,7 @@ TEST_F(V8ValueConverterTest, ArrayExceptions) { ASSERT_FALSE(array.IsEmpty()); // Converting from v8 value should replace the first item with null. - V8ValueConverter converter; + V8ValueConverterImpl converter; scoped_ptr<ListValue> converted(static_cast<ListValue*>( converter.FromV8Value(array, context_))); ASSERT_TRUE(converted.get()); @@ -281,14 +281,14 @@ TEST_F(V8ValueConverterTest, ArrayExceptions) { EXPECT_EQ("bar", GetString(copy, 1)); } -TEST_F(V8ValueConverterTest, WeirdTypes) { +TEST_F(V8ValueConverterImplTest, WeirdTypes) { v8::Context::Scope context_scope(context_); v8::HandleScope handle_scope; v8::Handle<v8::RegExp> regex( v8::RegExp::New(v8::String::New("."), v8::RegExp::kNone)); - V8ValueConverter converter; + V8ValueConverterImpl converter; TestWeirdType(converter, v8::Undefined(), Value::TYPE_NULL, NULL); TestWeirdType(converter, v8::Date::New(1000), Value::TYPE_DICTIONARY, NULL); TestWeirdType(converter, regex, Value::TYPE_DICTIONARY, NULL); @@ -305,7 +305,7 @@ TEST_F(V8ValueConverterTest, WeirdTypes) { Value::CreateStringValue("/./")); } -TEST_F(V8ValueConverterTest, Prototype) { +TEST_F(V8ValueConverterImplTest, Prototype) { v8::Context::Scope context_scope(context_); v8::HandleScope handle_scope; @@ -318,7 +318,7 @@ TEST_F(V8ValueConverterTest, Prototype) { v8::Handle<v8::Object> object = script->Run().As<v8::Object>(); ASSERT_FALSE(object.IsEmpty()); - V8ValueConverter converter; + V8ValueConverterImpl converter; scoped_ptr<DictionaryValue> result( static_cast<DictionaryValue*>(converter.FromV8Value(object, context_))); ASSERT_TRUE(result.get()); |