| Index: third_party/WebKit/Source/bindings/core/v8/ToV8Test.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/ToV8Test.cpp b/third_party/WebKit/Source/bindings/core/v8/ToV8Test.cpp
|
| index b539ccf75d98cf5acdd45601ece98c42a5527083..24aceb62c10f95cf59a79d2473ca3a7fda19c704 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/ToV8Test.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/ToV8Test.cpp
|
| @@ -204,15 +204,15 @@ TEST(ToV8Test, basicTypeVectors) {
|
| TEST_TOV8("true,true,false", boolVector);
|
| }
|
|
|
| -TEST(ToV8Test, dictionaryVector) {
|
| +TEST(ToV8Test, pairVector) {
|
| V8TestingScope scope;
|
| - Vector<std::pair<String, int>> dictionary;
|
| - dictionary.push_back(std::make_pair("one", 1));
|
| - dictionary.push_back(std::make_pair("two", 2));
|
| - TEST_TOV8("[object Object]", dictionary);
|
| + Vector<std::pair<String, int>> pairVector;
|
| + pairVector.push_back(std::make_pair("one", 1));
|
| + pairVector.push_back(std::make_pair("two", 2));
|
| + TEST_TOV8("[object Object]", pairVector);
|
| v8::Local<v8::Context> context = scope.getScriptState()->context();
|
| v8::Local<v8::Object> result =
|
| - ToV8(dictionary, context->Global(), scope.isolate())
|
| + ToV8(pairVector, context->Global(), scope.isolate())
|
| ->ToObject(context)
|
| .ToLocalChecked();
|
| v8::Local<v8::Value> one =
|
| @@ -223,6 +223,30 @@ TEST(ToV8Test, dictionaryVector) {
|
| EXPECT_EQ(2, two->NumberValue(context).FromJust());
|
| }
|
|
|
| +TEST(ToV8Test, pairHeapVector) {
|
| + V8TestingScope scope;
|
| + HeapVector<std::pair<String, Member<GarbageCollectedScriptWrappable>>>
|
| + pairHeapVector;
|
| + pairHeapVector.push_back(
|
| + std::make_pair("one", new GarbageCollectedScriptWrappable("foo")));
|
| + pairHeapVector.push_back(
|
| + std::make_pair("two", new GarbageCollectedScriptWrappable("bar")));
|
| + TEST_TOV8("[object Object]", pairHeapVector);
|
| + v8::Local<v8::Context> context = scope.getScriptState()->context();
|
| + v8::Local<v8::Object> result =
|
| + ToV8(pairHeapVector, context->Global(), scope.isolate())
|
| + ->ToObject(context)
|
| + .ToLocalChecked();
|
| + v8::Local<v8::Value> one =
|
| + result->Get(context, v8String(scope.isolate(), "one")).ToLocalChecked();
|
| + EXPECT_TRUE(one->IsObject());
|
| + EXPECT_EQ(String("foo"), toCoreString(one->ToString()));
|
| + v8::Local<v8::Value> two =
|
| + result->Get(context, v8String(scope.isolate(), "two")).ToLocalChecked();
|
| + EXPECT_TRUE(two->IsObject());
|
| + EXPECT_EQ(String("bar"), toCoreString(two->ToString()));
|
| +}
|
| +
|
| TEST(ToV8Test, stringVectorVector) {
|
| V8TestingScope scope;
|
|
|
|
|