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

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

Issue 1316833003: bindings: Support (deprecated) Dictionary in IDL dictionary (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months 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/DictionaryTest.h ('k') | Source/core/testing/DictionaryTest.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/testing/DictionaryTest.cpp
diff --git a/Source/core/testing/DictionaryTest.cpp b/Source/core/testing/DictionaryTest.cpp
index 98afc9de22b517fbd59b257eed96eac26975dee6..5545867abf5c690cffadb9e8a21387545b6d33f9 100644
--- a/Source/core/testing/DictionaryTest.cpp
+++ b/Source/core/testing/DictionaryTest.cpp
@@ -5,6 +5,7 @@
#include "config.h"
#include "DictionaryTest.h"
+#include "bindings/core/v8/V8ObjectBuilder.h"
#include "core/testing/InternalDictionary.h"
#include "core/testing/InternalDictionaryDerived.h"
@@ -66,6 +67,11 @@ void DictionaryTest::set(const InternalDictionary& testingDictionary)
if (testingDictionary.hasDoubleOrStringSequenceMember())
m_doubleOrStringSequenceMember = testingDictionary.doubleOrStringSequenceMember();
m_eventTargetOrNullMember = testingDictionary.eventTargetOrNullMember();
+ if (testingDictionary.hasDictionaryMember()) {
+ HashMap<String, String> properties;
+ testingDictionary.dictionaryMember().getOwnPropertiesAsStringHashMap(properties);
+ m_dictionaryMemberProperties = properties;
+ }
}
void DictionaryTest::get(InternalDictionary& result)
@@ -114,6 +120,17 @@ void DictionaryTest::get(InternalDictionary& result)
result.setEventTargetOrNullMember(m_eventTargetOrNullMember);
}
+ScriptValue DictionaryTest::getDictionaryMemberProperties(ScriptState* scriptState)
+{
+ if (!m_dictionaryMemberProperties)
+ return ScriptValue();
+ V8ObjectBuilder builder(scriptState);
+ HashMap<String, String> properties = m_dictionaryMemberProperties.get();
+ for (HashMap<String, String>::iterator it = properties.begin(); it != properties.end(); ++it)
+ builder.addString(it->key, it->value);
+ return builder.scriptValue();
+}
+
void DictionaryTest::setDerived(const InternalDictionaryDerived& derived)
{
ASSERT(derived.hasRequiredBooleanMember());
@@ -161,6 +178,7 @@ void DictionaryTest::reset()
m_derivedStringMember = String();
m_derivedStringMemberWithDefault = String();
m_requiredBooleanMember = false;
+ m_dictionaryMemberProperties = nullptr;
}
DEFINE_TRACE(DictionaryTest)
« no previous file with comments | « Source/core/testing/DictionaryTest.h ('k') | Source/core/testing/DictionaryTest.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698