Index: Source/bindings/tests/results/core/V8TestInterface.cpp |
diff --git a/Source/bindings/tests/results/core/V8TestInterface.cpp b/Source/bindings/tests/results/core/V8TestInterface.cpp |
index d67f1284b627985b322d248fab9dfb21ade96031..887762a9e97460fe597e0106c96078f4c8f63ae0 100644 |
--- a/Source/bindings/tests/results/core/V8TestInterface.cpp |
+++ b/Source/bindings/tests/results/core/V8TestInterface.cpp |
@@ -281,9 +281,14 @@ static void testEnumAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const |
V8StringResource<> cppValue = v8Value; |
if (!cppValue.prepare()) |
return; |
- String string = cppValue; |
- if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" || string == "EnumValue3")) { |
- currentExecutionContext(info.GetIsolate())->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "The provided value '" + string + "' is not a valid value of type 'TestEnum'.")); |
+ const char* validValues[] = { |
+ "", |
+ "EnumValue1", |
+ "EnumValue2", |
+ "EnumValue3", |
+ }; |
+ if (!isValidEnum(cppValue, validValues, 4)) { |
+ currentExecutionContext(info.GetIsolate())->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "The provided value is not a valid value of type 'TestEnum'.")); |
return; |
} |
impl->setTestEnumAttribute(cppValue); |
@@ -963,9 +968,12 @@ static void partialPartialEnumTypeAttributeAttributeSetter(v8::Local<v8::Value> |
V8StringResource<> cppValue = v8Value; |
if (!cppValue.prepare()) |
return; |
- String string = cppValue; |
- if (!(string == "foo" || string == "bar")) { |
- currentExecutionContext(info.GetIsolate())->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "The provided value '" + string + "' is not a valid value of type 'PartialEnumType'.")); |
+ const char* validValues[] = { |
+ "foo", |
+ "bar", |
+ }; |
+ if (!isValidEnum(cppValue, validValues, 2)) { |
+ currentExecutionContext(info.GetIsolate())->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "The provided value is not a valid value of type 'PartialEnumType'.")); |
return; |
} |
TestPartialInterface::setPartialPartialEnumTypeAttribute(*impl, cppValue); |
@@ -1179,9 +1187,14 @@ static void voidMethodTestEnumArgMethod(const v8::FunctionCallbackInfo<v8::Value |
testEnumArg = info[0]; |
if (!testEnumArg.prepare()) |
return; |
- String string = testEnumArg; |
- if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" || string == "EnumValue3")) { |
- V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodTestEnumArg", "TestInterface", "parameter 1 ('" + string + "') is not a valid enum value.")); |
+ const char* validValues[] = { |
+ "", |
+ "EnumValue1", |
+ "EnumValue2", |
+ "EnumValue3", |
+ }; |
+ if (!isValidEnum(testEnumArg, validValues, 4)) { |
+ V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodTestEnumArg", "TestInterface", "parameter 1 is not a valid enum value.")); |
return; |
} |
} |