Index: Source/core/testing/Internals.cpp |
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp |
index 6f84a6b09302e5d3bf85f6c02a28aae1307d399a..f744bbe08ab33e1c7e4d5a3b325158302d2d4f9c 100644 |
--- a/Source/core/testing/Internals.cpp |
+++ b/Source/core/testing/Internals.cpp |
@@ -117,6 +117,7 @@ |
#include "core/paint/DeprecatedPaintLayer.h" |
#include "core/plugins/testing/DictionaryPluginPlaceholder.h" |
#include "core/plugins/testing/DocumentFragmentPluginPlaceholder.h" |
+#include "core/streams/ReadableStream2.h" |
#include "core/testing/DictionaryTest.h" |
#include "core/testing/GCObservation.h" |
#include "core/testing/InternalRuntimeFlags.h" |
@@ -192,9 +193,9 @@ static SpellCheckRequester* spellCheckRequester(Document* document) |
const char* Internals::internalsId = "internals"; |
-Internals* Internals::create(Document* document) |
+Internals* Internals::create(ScriptState* scriptState) |
{ |
- return new Internals(document); |
+ return new Internals(scriptState); |
} |
Internals::~Internals() |
@@ -220,9 +221,35 @@ void Internals::resetToConsistentState(Page* page) |
page->deprecatedLocalMainFrame()->view()->clear(); |
} |
-Internals::Internals(Document* document) |
- : ContextLifecycleObserver(document) |
+namespace { |
+ |
+class TestUnderlyingSource : public UnderlyingSourceBase { |
+public: |
+ ScriptPromise start(ScriptState* scriptState) override |
+ { |
+ controller().enqueue("a"); |
+ controller().enqueue("b"); |
+ controller().close(); |
+ return UnderlyingSourceBase::start(scriptState); |
+ }; |
+}; |
+ |
+class TestQueuingStrategy : public QueuingStrategyBase { |
+public: |
+ TestQueuingStrategy() : QueuingStrategyBase(1024.0) { }; |
+ |
+ double size(ScriptValue chunk) override |
+ { |
+ return 0; |
+ } |
+}; |
+ |
+} // namespace |
+ |
+Internals::Internals(ScriptState* scriptState) |
+ : ContextLifecycleObserver(scriptState->executionContext()) |
, m_runtimeFlags(InternalRuntimeFlags::create()) |
+ , m_readableStream(new ReadableStream2(scriptState, new TestUnderlyingSource(), new TestQueuingStrategy())) |
{ |
} |
@@ -2370,4 +2397,9 @@ ClientRectList* Internals::focusRingRects(Element* element) |
return ClientRectList::create(rects); |
} |
+ScriptValue Internals::readableStream() |
+{ |
+ return m_readableStream->scriptValue(); |
+} |
+ |
} // namespace blink |