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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8BindingTest.cpp

Issue 2316263003: Add toImplSequence() (Closed)
Patch Set: comments 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/V8BindingTest.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8BindingTest.cpp b/third_party/WebKit/Source/bindings/core/v8/V8BindingTest.cpp
index 394b3b908daf70ad4eb7331b06e654ed3dffc188..4d062a62da8c9dd8b69ace47fbca8b3e625d1d08 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8BindingTest.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8BindingTest.cpp
@@ -19,6 +19,22 @@ template<typename T> v8::Local<v8::Value> toV8(V8TestingScope* scope, T value)
return blink::toV8(value, scope->context()->Global(), scope->isolate());
}
+TEST(V8BindingTest, toImplSequence)
+{
+ V8TestingScope scope;
+ {
+ v8::Local<v8::Array> v8StringArray = v8::Array::New(scope.isolate(), 2);
+ v8StringArray->Set(scope.context(), toV8(&scope, 0), toV8(&scope, "Hello, World!")).ToChecked();
+ v8StringArray->Set(scope.context(), toV8(&scope, 1), toV8(&scope, "Hi, Mom!")).ToChecked();
+
+ NonThrowableExceptionState exceptionState;
+ Vector<String> stringVector = toImplSequence<Vector<String>>(scope.isolate(), v8StringArray, exceptionState);
+ EXPECT_EQ(2U, stringVector.size());
+ EXPECT_EQ("Hello, World!", stringVector[0]);
+ EXPECT_EQ("Hi, Mom!", stringVector[1]);
+ }
+}
+
TEST(V8BindingTest, toImplArray)
{
V8TestingScope scope;

Powered by Google App Engine
This is Rietveld 408576698