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

Unified Diff: third_party/WebKit/Source/core/streams/ReadableStreamOperationsTest.cpp

Issue 1898873003: Add ReadableStream operations to use it from Fetch API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@body-stream-buffer-test-refactoring
Patch Set: Created 4 years, 8 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 | « third_party/WebKit/Source/core/streams/ReadableStreamOperations.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/streams/ReadableStreamOperationsTest.cpp
diff --git a/third_party/WebKit/Source/core/streams/ReadableStreamOperationsTest.cpp b/third_party/WebKit/Source/core/streams/ReadableStreamOperationsTest.cpp
index 7bfa71df64d62acaf467de2723f2648aba5d8c70..d3b9175e5b7b3c770c1dcb2d33952ec65c2c931c 100644
--- a/third_party/WebKit/Source/core/streams/ReadableStreamOperationsTest.cpp
+++ b/third_party/WebKit/Source/core/streams/ReadableStreamOperationsTest.cpp
@@ -334,6 +334,58 @@ TEST_F(ReadableStreamOperationsTest, CreateReadableStreamWithCustomUnderlyingSou
EXPECT_TRUE(it3->isDone());
}
+TEST_F(ReadableStreamOperationsTest, SetDisturbed)
+{
+ ScriptValue stream = evalWithPrintingError("new ReadableStream()");
+ ASSERT_FALSE(stream.isEmpty());
+
+ EXPECT_FALSE(ReadableStreamOperations::isDisturbed(getScriptState(), stream));
+ ReadableStreamOperations::setDisturbed(getScriptState(), stream);
+ EXPECT_TRUE(ReadableStreamOperations::isDisturbed(getScriptState(), stream));
+}
+
+TEST_F(ReadableStreamOperationsTest, IsReadable)
+{
+ ScriptValue readable = evalWithPrintingError("new ReadableStream()");
+ ScriptValue closed = evalWithPrintingError("new ReadableStream({start: c => c.close()})");
+ ScriptValue errored = evalWithPrintingError("new ReadableStream({start: c => c.error()})");
+ ASSERT_FALSE(readable.isEmpty());
+ ASSERT_FALSE(closed.isEmpty());
+ ASSERT_FALSE(errored.isEmpty());
+
+ EXPECT_TRUE(ReadableStreamOperations::isReadable(getScriptState(), readable));
+ EXPECT_FALSE(ReadableStreamOperations::isReadable(getScriptState(), closed));
+ EXPECT_FALSE(ReadableStreamOperations::isReadable(getScriptState(), errored));
+}
+
+TEST_F(ReadableStreamOperationsTest, IsClosed)
+{
+ ScriptValue readable = evalWithPrintingError("new ReadableStream()");
+ ScriptValue closed = evalWithPrintingError("new ReadableStream({start: c => c.close()})");
+ ScriptValue errored = evalWithPrintingError("new ReadableStream({start: c => c.error()})");
+ ASSERT_FALSE(readable.isEmpty());
+ ASSERT_FALSE(closed.isEmpty());
+ ASSERT_FALSE(errored.isEmpty());
+
+ EXPECT_FALSE(ReadableStreamOperations::isClosed(getScriptState(), readable));
+ EXPECT_TRUE(ReadableStreamOperations::isClosed(getScriptState(), closed));
+ EXPECT_FALSE(ReadableStreamOperations::isClosed(getScriptState(), errored));
+}
+
+TEST_F(ReadableStreamOperationsTest, IsErrored)
+{
+ ScriptValue readable = evalWithPrintingError("new ReadableStream()");
+ ScriptValue closed = evalWithPrintingError("new ReadableStream({start: c => c.close()})");
+ ScriptValue errored = evalWithPrintingError("new ReadableStream({start: c => c.error()})");
+ ASSERT_FALSE(readable.isEmpty());
+ ASSERT_FALSE(closed.isEmpty());
+ ASSERT_FALSE(errored.isEmpty());
+
+ EXPECT_FALSE(ReadableStreamOperations::isErrored(getScriptState(), readable));
+ EXPECT_FALSE(ReadableStreamOperations::isErrored(getScriptState(), closed));
+ EXPECT_TRUE(ReadableStreamOperations::isErrored(getScriptState(), errored));
+}
+
} // namespace
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/streams/ReadableStreamOperations.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698