Chromium Code Reviews| Index: Source/core/testing/DictionaryTest.cpp |
| diff --git a/Source/core/testing/DictionaryTest.cpp b/Source/core/testing/DictionaryTest.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..17ccdbfabf24bf7ae957fe4f921a8de05939ddd3 |
| --- /dev/null |
| +++ b/Source/core/testing/DictionaryTest.cpp |
| @@ -0,0 +1,48 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "config.h" |
| +#include "DictionaryTest.h" |
| + |
| +#include "core/testing/TestingDictionary.h" |
| + |
| +namespace blink { |
| + |
| +DictionaryTest::DictionaryTest() |
| +{ |
| + ScriptWrappable::init(this); |
| +} |
| + |
| +DictionaryTest::~DictionaryTest() |
| +{ |
| +} |
| + |
| +void DictionaryTest::set(const TestingDictionary* testingDictionary) |
| +{ |
| + if (testingDictionary->hasLongMember()) |
| + m_longMember = testingDictionary->longMember(); |
| + m_stringMember = testingDictionary->stringMember(); |
|
haraken
2014/08/26 04:00:40
Just help me understand: Are you assuming that Dic
bashi
2014/08/27 05:06:32
It depends on whether a member has a default value
|
| + if (testingDictionary->hasBooleanOrNullMember()) |
| + m_booleanOrNullMember = testingDictionary->booleanOrNullMember(); |
| + if (testingDictionary->hasStringSequenceMember()) |
| + m_stringSequenceMember = testingDictionary->stringSequenceMember(); |
| +} |
| + |
| +TestingDictionary* DictionaryTest::get() |
| +{ |
| + TestingDictionary* result = TestingDictionary::create(); |
| + if (m_longMember) |
| + result->setLongMember(m_longMember.get()); |
| + result->setStringMember(m_stringMember); |
| + if (m_booleanOrNullMember) |
| + result->setBooleanOrNullMember(m_booleanOrNullMember); |
| + result->setStringSequenceMember(m_stringSequenceMember); |
|
haraken
2014/08/26 04:00:40
Ditto. It's not clear to me when the Dictionary us
bashi
2014/08/27 05:06:32
It depends on how the dictionary is defined and th
|
| + return result; |
| +} |
| + |
| +void DictionaryTest::trace(Visitor* visitor) |
|
haraken
2014/08/26 04:00:40
Drop |visitor|.
bashi
2014/08/27 05:06:32
Done.
|
| +{ |
| +} |
| + |
| +} |