| 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 "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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 using ::testing::Invoke; | 27 using ::testing::Invoke; |
| 28 using ::testing::Return; | 28 using ::testing::Return; |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 using Checkpoint = ::testing::StrictMock<::testing::MockFunction<void(int)>>; | 32 using Checkpoint = ::testing::StrictMock<::testing::MockFunction<void(int)>>; |
| 33 using StringStream = ReadableStreamImpl<ReadableStreamChunkTypeTraits<String>>; | 33 using StringStream = ReadableStreamImpl<ReadableStreamChunkTypeTraits<String>>; |
| 34 | 34 |
| 35 class StringCapturingFunction : public ScriptFunction { | 35 class StringCapturingFunction : public ScriptFunction { |
| 36 public: | 36 public: |
| 37 static v8::Handle<v8::Function> createFunction(ScriptState* scriptState, Str
ing* value) | 37 static v8::Local<v8::Function> createFunction(ScriptState* scriptState, Stri
ng* value) |
| 38 { | 38 { |
| 39 StringCapturingFunction* self = new StringCapturingFunction(scriptState,
value); | 39 StringCapturingFunction* self = new StringCapturingFunction(scriptState,
value); |
| 40 return self->bindToV8Function(); | 40 return self->bindToV8Function(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 StringCapturingFunction(ScriptState* scriptState, String* value) | 44 StringCapturingFunction(ScriptState* scriptState, String* value) |
| 45 : ScriptFunction(scriptState) | 45 : ScriptFunction(scriptState) |
| 46 , m_value(value) | 46 , m_value(value) |
| 47 { | 47 { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 { | 111 { |
| 112 } | 112 } |
| 113 | 113 |
| 114 ~ReadableStreamTest() override | 114 ~ReadableStreamTest() override |
| 115 { | 115 { |
| 116 } | 116 } |
| 117 | 117 |
| 118 ScriptState* scriptState() { return ScriptState::forMainWorld(m_page->docume
nt().frame()); } | 118 ScriptState* scriptState() { return ScriptState::forMainWorld(m_page->docume
nt().frame()); } |
| 119 v8::Isolate* isolate() { return scriptState()->isolate(); } | 119 v8::Isolate* isolate() { return scriptState()->isolate(); } |
| 120 | 120 |
| 121 v8::Handle<v8::Function> createCaptor(String* value) | 121 v8::Local<v8::Function> createCaptor(String* value) |
| 122 { | 122 { |
| 123 return StringCapturingFunction::createFunction(scriptState(), value); | 123 return StringCapturingFunction::createFunction(scriptState(), value); |
| 124 } | 124 } |
| 125 | 125 |
| 126 StringStream* construct(MockStrategy* strategy) | 126 StringStream* construct(MockStrategy* strategy) |
| 127 { | 127 { |
| 128 Checkpoint checkpoint; | 128 Checkpoint checkpoint; |
| 129 { | 129 { |
| 130 InSequence s; | 130 InSequence s; |
| 131 EXPECT_CALL(checkpoint, Call(0)); | 131 EXPECT_CALL(checkpoint, Call(0)); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 reader->read(scriptState()); | 598 reader->read(scriptState()); |
| 599 EXPECT_FALSE(stream->isPulling()); | 599 EXPECT_FALSE(stream->isPulling()); |
| 600 checkpoint.Call(9); | 600 checkpoint.Call(9); |
| 601 reader->read(scriptState()); | 601 reader->read(scriptState()); |
| 602 EXPECT_TRUE(stream->isPulling()); | 602 EXPECT_TRUE(stream->isPulling()); |
| 603 | 603 |
| 604 stream->error(DOMException::create(AbortError, "done")); | 604 stream->error(DOMException::create(AbortError, "done")); |
| 605 } | 605 } |
| 606 | 606 |
| 607 } // namespace blink | 607 } // namespace blink |
| OLD | NEW |