Chromium Code Reviews| Index: Source/bindings/tests/results/core/V8TestDictionary.cpp |
| diff --git a/Source/bindings/tests/results/core/V8TestDictionary.cpp b/Source/bindings/tests/results/core/V8TestDictionary.cpp |
| index 62cd43d3da1ece5601f0e2149585d5b383255f6e..a73a53751a20bcafc2f47b1d962656257f6e6f73 100644 |
| --- a/Source/bindings/tests/results/core/V8TestDictionary.cpp |
| +++ b/Source/bindings/tests/results/core/V8TestDictionary.cpp |
| @@ -130,14 +130,43 @@ void V8TestDictionary::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value |
| V8StringResource<> enumMember = enumMemberValue; |
| if (!enumMember.prepare(exceptionState)) |
| return; |
| - String string = enumMember; |
| - if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" || string == "EnumValue3")) { |
| - exceptionState.throwTypeError("member enumMember ('" + string + "') is not a valid enum value."); |
| + static const char* validValues[] = { |
| + "", |
| + "EnumValue1", |
| + "EnumValue2", |
| + "EnumValue3", |
| + }; |
| + if (!isValidEnum(enumMember, validValues, WTF_ARRAY_LENGTH(validValues))) { |
| + exceptionState.throwTypeError("member enumMember ('" + toCoreString(isolate, enumMemberValue) + "') is not a valid enum value."); |
| return; |
| } |
| impl.setEnumMember(enumMember); |
| } |
| + v8::Local<v8::Value> enumSequenceMemberValue = v8Object->Get(v8String(isolate, "enumSequenceMember")); |
| + if (block.HasCaught()) { |
| + exceptionState.rethrowV8Exception(block.Exception()); |
| + return; |
| + } |
| + if (enumSequenceMemberValue.IsEmpty() || enumSequenceMemberValue->IsUndefined()) { |
| + // Do nothing. |
| + } else { |
| + Vector<String> enumSequenceMember = toImplArray<String>(enumSequenceMemberValue, 0, isolate, exceptionState); |
| + if (exceptionState.hadException()) |
| + return; |
| + static const char* validValues[] = { |
| + "", |
| + "EnumValue1", |
| + "EnumValue2", |
| + "EnumValue3", |
| + }; |
| + if (!isValidEnum(enumSequenceMember, validValues, WTF_ARRAY_LENGTH(validValues))) { |
| + exceptionState.throwTypeError("member enumSequenceMember ('" + toCoreString(isolate, enumSequenceMemberValue) + "') is not a valid enum value."); |
|
haraken
2015/04/01 01:27:25
Shall we move the for loop from isValidEnum to the
|
| + return; |
| + } |
| + impl.setEnumSequenceMember(enumSequenceMember); |
| + } |
| + |
| v8::Local<v8::Value> eventTargetMemberValue = v8Object->Get(v8String(isolate, "eventTargetMember")); |
| if (block.HasCaught()) { |
| exceptionState.rethrowV8Exception(block.Exception()); |
| @@ -495,6 +524,10 @@ void toV8TestDictionary(const TestDictionary& impl, v8::Local<v8::Object> dictio |
| dictionary->Set(v8String(isolate, "enumMember"), v8String(isolate, String("foo"))); |
| } |
| + if (impl.hasEnumSequenceMember()) { |
| + dictionary->Set(v8String(isolate, "enumSequenceMember"), toV8(impl.enumSequenceMember(), creationContext, isolate)); |
| + } |
| + |
| if (impl.hasEventTargetMember()) { |
| dictionary->Set(v8String(isolate, "eventTargetMember"), toV8(impl.eventTargetMember(), creationContext, isolate)); |
| } |