| 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 "modules/fetch/BodyStreamBuffer.h" | 5 #include "modules/fetch/BodyStreamBuffer.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/V8BindingForTesting.h" | 7 #include "bindings/core/v8/V8BindingForTesting.h" |
| 8 #include "core/html/FormData.h" | 8 #include "core/html/FormData.h" |
| 9 #include "modules/fetch/BlobBytesConsumer.h" | 9 #include "modules/fetch/BlobBytesConsumer.h" |
| 10 #include "modules/fetch/BytesConsumerTestUtil.h" | 10 #include "modules/fetch/BytesConsumerTestUtil.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 using ::testing::ByMove; | 26 using ::testing::ByMove; |
| 27 using ::testing::InSequence; | 27 using ::testing::InSequence; |
| 28 using ::testing::Return; | 28 using ::testing::Return; |
| 29 using ::testing::_; | 29 using ::testing::_; |
| 30 using ::testing::SaveArg; | 30 using ::testing::SaveArg; |
| 31 using Checkpoint = ::testing::StrictMock<::testing::MockFunction<void(int)>>; | 31 using Checkpoint = ::testing::StrictMock<::testing::MockFunction<void(int)>>; |
| 32 using Command = DataConsumerHandleTestUtil::Command; | 32 using Command = DataConsumerHandleTestUtil::Command; |
| 33 using ReplayingHandle = DataConsumerHandleTestUtil::ReplayingHandle; | 33 using ReplayingHandle = DataConsumerHandleTestUtil::ReplayingHandle; |
| 34 using MockFetchDataLoaderClient = DataConsumerHandleTestUtil::MockFetchDataLoade
rClient; | 34 using MockFetchDataLoaderClient = BytesConsumerTestUtil::MockFetchDataLoaderClie
nt; |
| 35 | 35 |
| 36 class BodyStreamBufferTest : public ::testing::Test { | 36 class BodyStreamBufferTest : public ::testing::Test { |
| 37 protected: | 37 protected: |
| 38 ScriptValue eval(ScriptState* scriptState, const char* s) | 38 ScriptValue eval(ScriptState* scriptState, const char* s) |
| 39 { | 39 { |
| 40 v8::Local<v8::String> source; | 40 v8::Local<v8::String> source; |
| 41 v8::Local<v8::Script> script; | 41 v8::Local<v8::Script> script; |
| 42 v8::MicrotasksScope microtasks(scriptState->isolate(), v8::MicrotasksSco
pe::kDoNotRunMicrotasks); | 42 v8::MicrotasksScope microtasks(scriptState->isolate(), v8::MicrotasksSco
pe::kDoNotRunMicrotasks); |
| 43 if (!v8Call(v8::String::NewFromUtf8(scriptState->isolate(), s, v8::NewSt
ringType::kNormal), source)) { | 43 if (!v8Call(v8::String::NewFromUtf8(scriptState->isolate(), s, v8::NewSt
ringType::kNormal), source)) { |
| 44 ADD_FAILURE(); | 44 ADD_FAILURE(); |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 BodyStreamBuffer* buffer = new BodyStreamBuffer(scope.getScriptState(), cons
umer); | 463 BodyStreamBuffer* buffer = new BodyStreamBuffer(scope.getScriptState(), cons
umer); |
| 464 ScriptValue reason(scope.getScriptState(), v8String(scope.getScriptState()->
isolate(), "reason")); | 464 ScriptValue reason(scope.getScriptState(), v8String(scope.getScriptState()->
isolate(), "reason")); |
| 465 EXPECT_FALSE(consumer->isCancelled()); | 465 EXPECT_FALSE(consumer->isCancelled()); |
| 466 buffer->cancel(scope.getScriptState(), reason); | 466 buffer->cancel(scope.getScriptState(), reason); |
| 467 EXPECT_TRUE(consumer->isCancelled()); | 467 EXPECT_TRUE(consumer->isCancelled()); |
| 468 } | 468 } |
| 469 | 469 |
| 470 } // namespace | 470 } // namespace |
| 471 | 471 |
| 472 } // namespace blink | 472 } // namespace blink |
| OLD | NEW |