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

Side by Side Diff: Source/core/streams/ReadableStreamTest.cpp

Issue 1001233002: Streams Implementation Update: Reader name and Stream methods (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « Source/core/streams/ReadableStreamReaderTest.cpp ('k') | Source/modules/fetch/Body.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/streams/ReadableStream.h" 6 #include "core/streams/ReadableStream.h"
7 7
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
11 #include "bindings/core/v8/V8Binding.h" 11 #include "bindings/core/v8/V8Binding.h"
12 #include "core/dom/DOMArrayBuffer.h" 12 #include "core/dom/DOMArrayBuffer.h"
13 #include "core/dom/DOMException.h" 13 #include "core/dom/DOMException.h"
14 #include "core/dom/Document.h" 14 #include "core/dom/Document.h"
15 #include "core/dom/ExceptionCode.h" 15 #include "core/dom/ExceptionCode.h"
16 #include "core/streams/ExclusiveStreamReader.h"
17 #include "core/streams/ReadableStreamImpl.h" 16 #include "core/streams/ReadableStreamImpl.h"
17 #include "core/streams/ReadableStreamReader.h"
18 #include "core/streams/UnderlyingSource.h" 18 #include "core/streams/UnderlyingSource.h"
19 #include "core/testing/DummyPageHolder.h" 19 #include "core/testing/DummyPageHolder.h"
20 #include <gmock/gmock.h> 20 #include <gmock/gmock.h>
21 #include <gtest/gtest.h> 21 #include <gtest/gtest.h>
22 22
23 namespace blink { 23 namespace blink {
24 24
25 using ::testing::_; 25 using ::testing::_;
26 using ::testing::InSequence; 26 using ::testing::InSequence;
27 using ::testing::Invoke; 27 using ::testing::Invoke;
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 stream->enqueue("foo"); 799 stream->enqueue("foo");
800 stream->enqueue("bar"); 800 stream->enqueue("bar");
801 checkpoint.Call(3); 801 checkpoint.Call(3);
802 EXPECT_TRUE(stream->read(scriptState(), m_exceptionState).toString(chunk)); 802 EXPECT_TRUE(stream->read(scriptState(), m_exceptionState).toString(chunk));
803 EXPECT_EQ("foo", chunk); 803 EXPECT_EQ("foo", chunk);
804 checkpoint.Call(4); 804 checkpoint.Call(4);
805 805
806 stream->error(DOMException::create(AbortError, "done")); 806 stream->error(DOMException::create(AbortError, "done"));
807 } 807 }
808 808
809 // Note: Detailed tests are on ExclusiveStreamReaderTest. 809 // Note: Detailed tests are on ReadableStreamReaderTest.
810 TEST_F(ReadableStreamTest, ExclusiveStreamReader) 810 TEST_F(ReadableStreamTest, ReadableStreamReader)
811 { 811 {
812 StringStream* stream = construct(); 812 StringStream* stream = construct();
813 ExclusiveStreamReader* reader = stream->getReader(m_exceptionState); 813 ReadableStreamReader* reader = stream->getReader(m_exceptionState);
814 814
815 ASSERT_TRUE(reader); 815 ASSERT_TRUE(reader);
816 EXPECT_FALSE(m_exceptionState.hadException()); 816 EXPECT_FALSE(m_exceptionState.hadException());
817 EXPECT_TRUE(reader->isActive()); 817 EXPECT_TRUE(reader->isActive());
818 EXPECT_TRUE(stream->isLockedTo(reader)); 818 EXPECT_TRUE(stream->isLockedTo(reader));
819 819
820 ExclusiveStreamReader* another = stream->getReader(m_exceptionState); 820 ReadableStreamReader* another = stream->getReader(m_exceptionState);
821 ASSERT_EQ(nullptr, another); 821 ASSERT_EQ(nullptr, another);
822 EXPECT_TRUE(m_exceptionState.hadException()); 822 EXPECT_TRUE(m_exceptionState.hadException());
823 EXPECT_TRUE(reader->isActive()); 823 EXPECT_TRUE(reader->isActive());
824 EXPECT_TRUE(stream->isLockedTo(reader)); 824 EXPECT_TRUE(stream->isLockedTo(reader));
825 } 825 }
826 826
827 } // namespace blink 827 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/streams/ReadableStreamReaderTest.cpp ('k') | Source/modules/fetch/Body.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698