Chromium Code Reviews| Index: Source/bindings/tests/results/core/UnionTypesCore.cpp |
| diff --git a/Source/bindings/tests/results/core/UnionTypesCore.cpp b/Source/bindings/tests/results/core/UnionTypesCore.cpp |
| index 8e9f21d50bb45cd6fbb3e55540f599e07939b441..85eaef4e13e14b8ba583a9894901d8601b4b8ab0 100644 |
| --- a/Source/bindings/tests/results/core/UnionTypesCore.cpp |
| +++ b/Source/bindings/tests/results/core/UnionTypesCore.cpp |
| @@ -758,8 +758,13 @@ String TestEnumOrDouble::getAsTestEnum() const |
| void TestEnumOrDouble::setTestEnum(String value) |
| { |
| ASSERT(isNull()); |
| - String string = value; |
| - if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" || string == "EnumValue3")) { |
| + const char* validValues[] = { |
| + "", |
| + "EnumValue1", |
| + "EnumValue2", |
| + "EnumValue3", |
| + }; |
| + if (!isValidEnum(value, validValues, 4)) { |
|
haraken
2015/03/31 06:11:17
Or you can use WTF_ARRAY_LENGTH(validValues).
bashi
2015/04/01 00:17:31
Done.
|
| ASSERT_NOT_REACHED(); |
| return; |
| } |
| @@ -811,9 +816,14 @@ void V8TestEnumOrDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Val |
| V8StringResource<> cppValue = v8Value; |
| if (!cppValue.prepare(exceptionState)) |
| return; |
| - String string = cppValue; |
| - if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" || string == "EnumValue3")) { |
| - exceptionState.throwTypeError("'" + string + "' is not a valid enum value."); |
| + const char* validValues[] = { |
| + "", |
| + "EnumValue1", |
| + "EnumValue2", |
| + "EnumValue3", |
| + }; |
| + if (!isValidEnum(cppValue, validValues, 4)) { |
| + exceptionState.throwTypeError("'" + String(cppValue) + "' is not a valid enum value."); |
| return; |
| } |
| impl.setTestEnum(cppValue); |