Index: Source/core/testing/UnionTypesTest.cpp |
diff --git a/Source/core/testing/UnionTypesTest.cpp b/Source/core/testing/UnionTypesTest.cpp |
index 5e34b96cf0ad2e699b7e18fd6d53499783c32285..a5431760791ba06e9f6f521c7a18fc9e331f1806 100644 |
--- a/Source/core/testing/UnionTypesTest.cpp |
+++ b/Source/core/testing/UnionTypesTest.cpp |
@@ -5,6 +5,8 @@ |
#include "config.h" |
#include "UnionTypesTest.h" |
+#include "wtf/text/StringBuilder.h" |
+ |
namespace blink { |
void UnionTypesTest::doubleOrStringAttribute(DoubleOrString& doubleOrString) |
@@ -50,4 +52,28 @@ String UnionTypesTest::doubleOrStringArg(DoubleOrString& doubleOrString) |
return String(); |
} |
+String UnionTypesTest::doubleOrStringArrayArg(Vector<DoubleOrString>& array) |
+{ |
+ if (!array.size()) |
+ return ""; |
+ |
+ StringBuilder builder; |
+ for (DoubleOrString& doubleOrString : array) { |
+ ASSERT(!doubleOrString.isNull()); |
+ if (doubleOrString.isDouble()) |
+ builder.append("double: " + String::numberToStringECMAScript(doubleOrString.getAsDouble())); |
+ else if (doubleOrString.isString()) |
+ builder.append("string: " + doubleOrString.getAsString()); |
+ else |
+ ASSERT_NOT_REACHED(); |
+ builder.append(", "); |
+ } |
+ return builder.substring(0, builder.length() - 2); |
+} |
+ |
+String UnionTypesTest::doubleOrStringSequenceArg(Vector<DoubleOrString>& sequence) |
+{ |
+ return doubleOrStringArrayArg(sequence); |
+} |
+ |
} |