Index: Source/core/streams/StreamTest.cpp |
diff --git a/Source/core/streams/StreamTest.cpp b/Source/core/streams/StreamTest.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e312f2a40a522ab6d7d77ba365becfdd4c2efd7a |
--- /dev/null |
+++ b/Source/core/streams/StreamTest.cpp |
@@ -0,0 +1,61 @@ |
+// Copyright 2015 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 "core/streams/ScriptQueuingStrategy.h" |
+#include "core/streams/ScriptUnderlyingSource.h" |
+#include "bindings/core/v8/ScriptPromise.h" |
+#include "core/streams/StreamTest.h" |
+#include <v8.h> |
+ |
+namespace blink { |
+ |
+class TestUnderlyingSource : public ScriptUnderlyingSource { |
+public: |
+ TestUnderlyingSource(ScriptState* state) : m_scriptState(state) { }; |
+ |
+ ScriptPromise startImpl() override |
+ { |
+ controller().close(); |
+ return ScriptPromise::cast(m_scriptState, ScriptValue::createNull(m_scriptState)); |
+ // Use controller().enqueue(), controller().close(), controller().error() |
+ }; |
+ ScriptPromise pullImpl() override |
+ { |
+ return ScriptPromise::cast(m_scriptState, ScriptValue::createNull(m_scriptState)); |
+ // Use controller().enqueue(), controller().close(), controller().error() |
+ }; |
+ ScriptPromise cancelImpl(ScriptValue reason) override |
+ { |
+ return ScriptPromise::cast(m_scriptState, ScriptValue::createNull(m_scriptState)); |
+ // Do any cancel stuff, maybe using reason. |
+ }; |
+ |
+private: |
+ ScriptState* m_scriptState; |
+}; |
+ |
+class TestQueuingStrategy : public ScriptQueuingStrategy { |
+public: |
+// using ScriptQueuingStrategy::ScriptQueuingStrategy; |
+ TestQueuingStrategy(double hwm) : ScriptQueuingStrategy(hwm) { }; |
+ |
+ double size(ScriptValue chunk) override { |
+ return 0; |
+ } |
+}; |
+ |
+ScriptReadableStream StreamTest::test(ScriptState* scriptState) |
+{ |
+ // Aaaaah I have no idea how C++ works :( pointers :( |
+ auto us = new TestUnderlyingSource(scriptState); |
+ auto qs = new TestQueuingStrategy(1024.0); |
+ return ScriptReadableStream(scriptState, us, qs); |
+} |
+ |
+DEFINE_TRACE(StreamTest) |
+{ |
+} |
+ |
+} |