| 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> |
| 22 | 23 |
| 23 namespace blink { | 24 namespace blink { |
| 24 | 25 |
| 25 using ::testing::_; | 26 using ::testing::_; |
| 26 using ::testing::InSequence; | 27 using ::testing::InSequence; |
| 27 using ::testing::Invoke; | 28 using ::testing::Invoke; |
| 28 using ::testing::Return; | 29 using ::testing::Return; |
| 29 using ::testing::ReturnPointee; | 30 using ::testing::ReturnPointee; |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 EXPECT_CALL(*m_underlyingSource, pullSource()).Times(1); | 147 EXPECT_CALL(*m_underlyingSource, pullSource()).Times(1); |
| 147 EXPECT_CALL(checkpoint, Call(1)); | 148 EXPECT_CALL(checkpoint, Call(1)); |
| 148 } | 149 } |
| 149 StringStream* stream = new StringStream(m_underlyingSource, new Permissi
veStrategy); | 150 StringStream* stream = new StringStream(m_underlyingSource, new Permissi
veStrategy); |
| 150 checkpoint.Call(0); | 151 checkpoint.Call(0); |
| 151 stream->didSourceStart(); | 152 stream->didSourceStart(); |
| 152 checkpoint.Call(1); | 153 checkpoint.Call(1); |
| 153 return stream; | 154 return stream; |
| 154 } | 155 } |
| 155 | 156 |
| 156 OwnPtr<DummyPageHolder> m_page; | 157 std::unique_ptr<DummyPageHolder> m_page; |
| 157 Persistent<MockUnderlyingSource> m_underlyingSource; | 158 Persistent<MockUnderlyingSource> m_underlyingSource; |
| 158 }; | 159 }; |
| 159 | 160 |
| 160 TEST_F(ReadableStreamTest, Start) | 161 TEST_F(ReadableStreamTest, Start) |
| 161 { | 162 { |
| 162 ScriptState::Scope scope(getScriptState()); | 163 ScriptState::Scope scope(getScriptState()); |
| 163 ExceptionState exceptionState(ExceptionState::ConstructionContext, "property
", "interface", getScriptState()->context()->Global(), isolate()); | 164 ExceptionState exceptionState(ExceptionState::ConstructionContext, "property
", "interface", getScriptState()->context()->Global(), isolate()); |
| 164 Checkpoint checkpoint; | 165 Checkpoint checkpoint; |
| 165 { | 166 { |
| 166 InSequence s; | 167 InSequence s; |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 reader->read(getScriptState()); | 645 reader->read(getScriptState()); |
| 645 EXPECT_FALSE(stream->isPulling()); | 646 EXPECT_FALSE(stream->isPulling()); |
| 646 checkpoint.Call(9); | 647 checkpoint.Call(9); |
| 647 reader->read(getScriptState()); | 648 reader->read(getScriptState()); |
| 648 EXPECT_TRUE(stream->isPulling()); | 649 EXPECT_TRUE(stream->isPulling()); |
| 649 | 650 |
| 650 stream->error(DOMException::create(AbortError, "done")); | 651 stream->error(DOMException::create(AbortError, "done")); |
| 651 } | 652 } |
| 652 | 653 |
| 653 } // namespace blink | 654 } // namespace blink |
| OLD | NEW |