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

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

Issue 2900743002: bindings: Do not skip symbols in the JS -> record<> conversion. (Closed)
Patch Set: Fix tests Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImplTest.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImplTest.cpp b/third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImplTest.cpp
index 71a82a2f8d14f4ba5994bb527ad75299e0404a8f..8203b299ef64754bdb2a4842ef403053bd02ddbb 100644
--- a/third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImplTest.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImplTest.cpp
@@ -200,27 +200,15 @@ TEST(NativeValueTraitsImplTest, IDLRecord) {
EXPECT_TRUE(V8CallBoolean(v8_object->Set(
scope.GetContext(), ToV8(&scope, "foo"), ToV8(&scope, 42))));
- NonThrowableExceptionState exception_state;
- const auto& record =
- NativeValueTraits<IDLRecord<IDLString, IDLShort>>::NativeValue(
- scope.GetIsolate(), v8_object, exception_state);
- EXPECT_EQ(1U, record.size());
- EXPECT_EQ(std::make_pair(String("foo"), int16_t(42)), record[0]);
- }
- {
- v8::Local<v8::Object> v8_object = v8::Object::New(scope.GetIsolate());
- EXPECT_TRUE(V8CallBoolean(v8_object->Set(
- scope.GetContext(), v8::Symbol::GetToStringTag(scope.GetIsolate()),
- ToV8(&scope, 34))));
- EXPECT_TRUE(V8CallBoolean(v8_object->Set(
- scope.GetContext(), ToV8(&scope, "foo"), ToV8(&scope, 42))));
-
- NonThrowableExceptionState exception_state;
+ // The presence of symbols should throw a TypeError when the conversion to
+ // the record's key type is attempted.
+ DummyExceptionStateForTesting exception_state;
const auto& record =
NativeValueTraits<IDLRecord<IDLString, IDLShort>>::NativeValue(
scope.GetIsolate(), v8_object, exception_state);
- EXPECT_EQ(1U, record.size());
- EXPECT_EQ(std::make_pair(String("foo"), int16_t(42)), record[0]);
+ EXPECT_TRUE(record.IsEmpty());
+ EXPECT_TRUE(exception_state.HadException());
+ EXPECT_TRUE(exception_state.Message().IsEmpty());
}
{
v8::Local<v8::Object> v8_parent_object =
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698