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

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
« no previous file with comments | « Source/core/testing/UnionTypesTest.h ('k') | Source/core/testing/UnionTypesTest.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+}
+
}
« no previous file with comments | « Source/core/testing/UnionTypesTest.h ('k') | Source/core/testing/UnionTypesTest.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698