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

Unified Diff: Source/core/testing/UnionTypesTest.cpp

Issue 700733003: IDL: Support union type arrays and sequences for method arguments (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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
Index: Source/core/testing/UnionTypesTest.cpp
diff --git a/Source/core/testing/UnionTypesTest.cpp b/Source/core/testing/UnionTypesTest.cpp
index 5e34b96cf0ad2e699b7e18fd6d53499783c32285..a88763add977c898a968ac8b4d400ea6661acdbe 100644
--- a/Source/core/testing/UnionTypesTest.cpp
+++ b/Source/core/testing/UnionTypesTest.cpp
@@ -50,4 +50,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);
+}
+
}

Powered by Google App Engine
This is Rietveld 408576698