| 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/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/html/FormData.h" | 9 #include "core/html/FormData.h" |
| 10 #include "modules/fetch/BlobBytesConsumer.h" | 10 #include "modules/fetch/BlobBytesConsumer.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 ADD_FAILURE() << toCoreString( | 60 ADD_FAILURE() << toCoreString( |
| 61 block.Exception()->ToString(scriptState->isolate())) | 61 block.Exception()->ToString(scriptState->isolate())) |
| 62 .utf8() | 62 .utf8() |
| 63 .data(); | 63 .data(); |
| 64 block.ReThrow(); | 64 block.ReThrow(); |
| 65 } | 65 } |
| 66 return r; | 66 return r; |
| 67 } | 67 } |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 class X : public GarbageCollectedMixin { |
| 71 public: |
| 72 DEFINE_INLINE_VIRTUAL_TRACE() {} |
| 73 }; |
| 74 |
| 75 template <typename T> |
| 76 class Y : public T { |
| 77 public: |
| 78 DEFINE_INLINE_TRACE() { T::trace(visitor); } |
| 79 }; |
| 80 |
| 81 class Z final : public GarbageCollectedFinalized<Z>, public Y<X> { |
| 82 USING_GARBAGE_COLLECTED_MIXIN(Z); |
| 83 |
| 84 public: |
| 85 ~Z() {} |
| 86 DEFINE_INLINE_TRACE() { Y<X>::trace(visitor); } |
| 87 }; |
| 88 |
| 70 TEST_F(BodyStreamBufferTest, Tee) { | 89 TEST_F(BodyStreamBufferTest, Tee) { |
| 90 Persistent<Z> z = new Z(); |
| 71 V8TestingScope scope; | 91 V8TestingScope scope; |
| 72 Checkpoint checkpoint; | 92 Checkpoint checkpoint; |
| 73 MockFetchDataLoaderClient* client1 = MockFetchDataLoaderClient::create(); | 93 MockFetchDataLoaderClient* client1 = MockFetchDataLoaderClient::create(); |
| 74 MockFetchDataLoaderClient* client2 = MockFetchDataLoaderClient::create(); | 94 MockFetchDataLoaderClient* client2 = MockFetchDataLoaderClient::create(); |
| 75 | 95 |
| 76 InSequence s; | 96 InSequence s; |
| 77 EXPECT_CALL(checkpoint, Call(0)); | 97 EXPECT_CALL(checkpoint, Call(0)); |
| 78 EXPECT_CALL(*client1, didFetchDataLoadedString(String("hello, world"))); | 98 EXPECT_CALL(*client1, didFetchDataLoadedString(String("hello, world"))); |
| 79 EXPECT_CALL(checkpoint, Call(1)); | 99 EXPECT_CALL(checkpoint, Call(1)); |
| 80 EXPECT_CALL(checkpoint, Call(2)); | 100 EXPECT_CALL(checkpoint, Call(2)); |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 ScriptValue reason(scope.getScriptState(), | 496 ScriptValue reason(scope.getScriptState(), |
| 477 v8String(scope.getScriptState()->isolate(), "reason")); | 497 v8String(scope.getScriptState()->isolate(), "reason")); |
| 478 EXPECT_FALSE(consumer->isCancelled()); | 498 EXPECT_FALSE(consumer->isCancelled()); |
| 479 buffer->cancel(scope.getScriptState(), reason); | 499 buffer->cancel(scope.getScriptState(), reason); |
| 480 EXPECT_TRUE(consumer->isCancelled()); | 500 EXPECT_TRUE(consumer->isCancelled()); |
| 481 } | 501 } |
| 482 | 502 |
| 483 } // namespace | 503 } // namespace |
| 484 | 504 |
| 485 } // namespace blink | 505 } // namespace blink |
| OLD | NEW |