コード例 #1
0
// Note: Detailed tests are on ReadableStreamReaderTest.
TEST_F(ReadableStreamTest, ReadableStreamReader)
{
    ScriptState::Scope scope(scriptState());
    ExceptionState exceptionState(ExceptionState::ConstructionContext, "property", "interface", scriptState()->context()->Global(), isolate());
    StringStream* stream = construct();
    ReadableStreamReader* reader = stream->getReader(scriptState()->executionContext(), exceptionState);

    ASSERT_TRUE(reader);
    EXPECT_FALSE(exceptionState.hadException());
    EXPECT_TRUE(reader->isActive());
    EXPECT_TRUE(stream->isLockedTo(reader));

    ReadableStreamReader* another = stream->getReader(scriptState()->executionContext(), exceptionState);
    ASSERT_EQ(nullptr, another);
    EXPECT_TRUE(exceptionState.hadException());
    EXPECT_TRUE(reader->isActive());
    EXPECT_TRUE(stream->isLockedTo(reader));
}