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

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

Issue 704503002: IDL: Union type support for attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@union-arraybuffer
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 bcf5519d1fe9258b7bb82c3ec126fece668ff3f9..e5af4a1df571cf9391d231acf702e5d1e60ec809 100644
--- a/Source/core/testing/UnionTypesTest.cpp
+++ b/Source/core/testing/UnionTypesTest.cpp
@@ -7,6 +7,35 @@
namespace blink {
+void UnionTypesTest::doubleOrStringAttribute(DoubleOrString& doubleOrString)
+{
+ switch (m_attributeType) {
+ case SpecificTypeNone:
+ break;
+ case SpecificTypeDouble:
+ doubleOrString.setDouble(m_attributeDouble);
+ break;
+ case SpecificTypeString:
+ doubleOrString.setString(m_attributeString);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+
+void UnionTypesTest::setDoubleOrStringAttribute(const DoubleOrString& doubleOrString)
+{
+ if (doubleOrString.isDouble()) {
+ m_attributeDouble = doubleOrString.getAsDouble();
+ m_attributeType = SpecificTypeDouble;
+ } else if (doubleOrString.isString()) {
+ m_attributeString = doubleOrString.getAsString();
+ m_attributeType = SpecificTypeString;
+ } else {
+ ASSERT_NOT_REACHED();
+ }
+}
+
String UnionTypesTest::doubleOrStringArg(DoubleOrString& doubleOrString)
{
ASSERT(!doubleOrString.isNull());

Powered by Google App Engine
This is Rietveld 408576698