OLD | NEW |
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 "core/streams/ReadableStream.h" | 5 #include "core/streams/ReadableStream.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
11 #include "core/dom/DOMArrayBuffer.h" | 11 #include "core/dom/DOMArrayBuffer.h" |
12 #include "core/dom/DOMException.h" | 12 #include "core/dom/DOMException.h" |
13 #include "core/dom/Document.h" | 13 #include "core/dom/Document.h" |
14 #include "core/dom/ExceptionCode.h" | 14 #include "core/dom/ExceptionCode.h" |
15 #include "core/streams/ReadableStreamImpl.h" | 15 #include "core/streams/ReadableStreamImpl.h" |
16 #include "core/streams/ReadableStreamReader.h" | 16 #include "core/streams/ReadableStreamReader.h" |
17 #include "core/streams/UnderlyingSource.h" | 17 #include "core/streams/UnderlyingSource.h" |
18 #include "core/testing/DummyPageHolder.h" | 18 #include "core/testing/DummyPageHolder.h" |
19 #include "testing/gmock/include/gmock/gmock-more-actions.h" | 19 #include "testing/gmock/include/gmock/gmock-more-actions.h" |
20 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 #include <memory> | |
23 | 22 |
24 namespace blink { | 23 namespace blink { |
25 | 24 |
26 using ::testing::_; | 25 using ::testing::_; |
27 using ::testing::InSequence; | 26 using ::testing::InSequence; |
28 using ::testing::Invoke; | 27 using ::testing::Invoke; |
29 using ::testing::Return; | 28 using ::testing::Return; |
30 using ::testing::ReturnPointee; | 29 using ::testing::ReturnPointee; |
31 | 30 |
32 namespace { | 31 namespace { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 EXPECT_CALL(*m_underlyingSource, pullSource()).Times(1); | 146 EXPECT_CALL(*m_underlyingSource, pullSource()).Times(1); |
148 EXPECT_CALL(checkpoint, Call(1)); | 147 EXPECT_CALL(checkpoint, Call(1)); |
149 } | 148 } |
150 StringStream* stream = new StringStream(m_underlyingSource, new Permissi
veStrategy); | 149 StringStream* stream = new StringStream(m_underlyingSource, new Permissi
veStrategy); |
151 checkpoint.Call(0); | 150 checkpoint.Call(0); |
152 stream->didSourceStart(); | 151 stream->didSourceStart(); |
153 checkpoint.Call(1); | 152 checkpoint.Call(1); |
154 return stream; | 153 return stream; |
155 } | 154 } |
156 | 155 |
157 std::unique_ptr<DummyPageHolder> m_page; | 156 OwnPtr<DummyPageHolder> m_page; |
158 Persistent<MockUnderlyingSource> m_underlyingSource; | 157 Persistent<MockUnderlyingSource> m_underlyingSource; |
159 }; | 158 }; |
160 | 159 |
161 TEST_F(ReadableStreamTest, Start) | 160 TEST_F(ReadableStreamTest, Start) |
162 { | 161 { |
163 ScriptState::Scope scope(getScriptState()); | 162 ScriptState::Scope scope(getScriptState()); |
164 ExceptionState exceptionState(ExceptionState::ConstructionContext, "property
", "interface", getScriptState()->context()->Global(), isolate()); | 163 ExceptionState exceptionState(ExceptionState::ConstructionContext, "property
", "interface", getScriptState()->context()->Global(), isolate()); |
165 Checkpoint checkpoint; | 164 Checkpoint checkpoint; |
166 { | 165 { |
167 InSequence s; | 166 InSequence s; |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 reader->read(getScriptState()); | 644 reader->read(getScriptState()); |
646 EXPECT_FALSE(stream->isPulling()); | 645 EXPECT_FALSE(stream->isPulling()); |
647 checkpoint.Call(9); | 646 checkpoint.Call(9); |
648 reader->read(getScriptState()); | 647 reader->read(getScriptState()); |
649 EXPECT_TRUE(stream->isPulling()); | 648 EXPECT_TRUE(stream->isPulling()); |
650 | 649 |
651 stream->error(DOMException::create(AbortError, "done")); | 650 stream->error(DOMException::create(AbortError, "done")); |
652 } | 651 } |
653 | 652 |
654 } // namespace blink | 653 } // namespace blink |
OLD | NEW |