Chromium Code Reviews| Index: Source/core/testing/Internals.cpp |
| diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp |
| index b1c90e3d5d3a890586c421ae344b5470c15df15d..6e753d3357ce9413c3ae29b9d24558fd38056fc8 100644 |
| --- a/Source/core/testing/Internals.cpp |
| +++ b/Source/core/testing/Internals.cpp |
| @@ -48,6 +48,7 @@ |
| #include "core/dom/DocumentMarkerController.h" |
| #include "core/dom/Element.h" |
| #include "core/dom/ExceptionCode.h" |
| +#include "core/dom/Iterator.h" |
| #include "core/dom/NodeRenderStyle.h" |
| #include "core/dom/PseudoElement.h" |
| #include "core/dom/Range.h" |
| @@ -67,9 +68,9 @@ |
| #include "core/editing/TextIterator.h" |
| #include "core/fetch/MemoryCache.h" |
| #include "core/fetch/ResourceFetcher.h" |
| -#include "core/frame/LocalDOMWindow.h" |
| #include "core/frame/EventHandlerRegistry.h" |
| #include "core/frame/FrameView.h" |
| +#include "core/frame/LocalDOMWindow.h" |
| #include "core/frame/LocalFrame.h" |
| #include "core/frame/Settings.h" |
| #include "core/frame/WebKitPoint.h" |
| @@ -141,6 +142,37 @@ |
| namespace blink { |
| +namespace { |
| + |
| +class InternalsIterator : public Iterator { |
| +public: |
| + InternalsIterator() : m_current(0) { } |
| + |
| + virtual ScriptValue next(ScriptState* scriptState, ExceptionState& exceptionState) OVERRIDE |
|
arv (Not doing code reviews)
2014/08/20 14:18:38
This looks reasonable but I'm wondering if we shou
yhirano
2014/08/21 11:55:27
Sorry I don't got your idea, can you explain it in
|
| + { |
| + v8::Isolate* isolate = scriptState->isolate(); |
| + v8::Local<v8::Value> value = v8::Integer::New(isolate, m_current * m_current); |
| + bool done = (m_current >= 5); |
| + ++m_current; |
| + |
| + v8::Local<v8::Object> result = v8::Object::New(isolate); |
| + result->Set(v8String(isolate, "value"), value); |
| + result->Set(v8String(isolate, "done"), v8::Boolean::New(isolate, done)); |
| + return ScriptValue(scriptState, result); |
| + } |
| + |
| + virtual ScriptValue next(ScriptState* scriptState, ScriptValue value, ExceptionState& exceptionState) OVERRIDE |
| + { |
| + exceptionState.throwTypeError("Not implemented"); |
| + return ScriptValue(); |
| + } |
| + |
| +private: |
| + int m_current; |
| +}; |
| + |
| +} // namespace |
| + |
| // FIXME: oilpan: These will be removed soon. |
| static MockPagePopupDriver* s_pagePopupDriver = 0; |
| @@ -2235,4 +2267,9 @@ void Internals::forcePluginPlaceholder(HTMLElement* element, const String& htmlS |
| toHTMLPlugInElement(element)->setUsePlaceholderContent(true); |
| } |
| +Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptionState) |
| +{ |
| + return new InternalsIterator; |
| +} |
| + |
| } // namespace blink |