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 "core/testing/DummyPageHolder.h" | 7 #include "core/testing/DummyPageHolder.h" |
8 #include "modules/fetch/DataConsumerHandleTestUtil.h" | 8 #include "modules/fetch/DataConsumerHandleTestUtil.h" |
9 #include "platform/testing/UnitTestHelpers.h" | 9 #include "platform/testing/UnitTestHelpers.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 ASSERT_EQ(rawHandle, handle2.get()); | 54 ASSERT_EQ(rawHandle, handle2.get()); |
55 EXPECT_TRUE(buffer->stream()->isLocked()); | 55 EXPECT_TRUE(buffer->stream()->isLocked()); |
56 EXPECT_TRUE(buffer->stream()->isDisturbed()); | 56 EXPECT_TRUE(buffer->stream()->isDisturbed()); |
57 EXPECT_EQ(ReadableStream::Closed, buffer->stream()->stateInternal()); | 57 EXPECT_EQ(ReadableStream::Closed, buffer->stream()->stateInternal()); |
58 } | 58 } |
59 | 59 |
60 TEST_F(BodyStreamBufferTest, LoadBodyStreamBufferAsArrayBuffer) | 60 TEST_F(BodyStreamBufferTest, LoadBodyStreamBufferAsArrayBuffer) |
61 { | 61 { |
62 Checkpoint checkpoint; | 62 Checkpoint checkpoint; |
63 MockFetchDataLoaderClient* client = MockFetchDataLoaderClient::create(); | 63 MockFetchDataLoaderClient* client = MockFetchDataLoaderClient::create(); |
64 RefPtr<DOMArrayBuffer> arrayBuffer; | 64 DOMArrayBuffer* arrayBuffer = nullptr; |
65 | 65 |
66 InSequence s; | 66 InSequence s; |
67 EXPECT_CALL(checkpoint, Call(1)); | 67 EXPECT_CALL(checkpoint, Call(1)); |
68 EXPECT_CALL(*client, didFetchDataLoadedArrayBufferMock(_)).WillOnce(SaveArg<
0>(&arrayBuffer)); | 68 EXPECT_CALL(*client, didFetchDataLoadedArrayBufferMock(_)).WillOnce(SaveArg<
0>(&arrayBuffer)); |
69 EXPECT_CALL(checkpoint, Call(2)); | 69 EXPECT_CALL(checkpoint, Call(2)); |
70 | 70 |
71 OwnPtr<ReplayingHandle> handle = ReplayingHandle::create(); | 71 OwnPtr<ReplayingHandle> handle = ReplayingHandle::create(); |
72 handle->add(Command(Command::Data, "hello")); | 72 handle->add(Command(Command::Data, "hello")); |
73 handle->add(Command(Command::Done)); | 73 handle->add(Command(Command::Done)); |
74 BodyStreamBuffer* buffer = new BodyStreamBuffer(createFetchDataConsumerHandl
eFromWebHandle(handle.release())); | 74 BodyStreamBuffer* buffer = new BodyStreamBuffer(createFetchDataConsumerHandl
eFromWebHandle(handle.release())); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 BodyStreamBuffer* buffer = new BodyStreamBuffer(handle.release()); | 311 BodyStreamBuffer* buffer = new BodyStreamBuffer(handle.release()); |
312 checkpoint.Call(1); | 312 checkpoint.Call(1); |
313 ScriptValue reason(getScriptState(), v8String(getScriptState()->isolate(), "
reason")); | 313 ScriptValue reason(getScriptState(), v8String(getScriptState()->isolate(), "
reason")); |
314 buffer->cancelSource(getScriptState(), reason); | 314 buffer->cancelSource(getScriptState(), reason); |
315 checkpoint.Call(2); | 315 checkpoint.Call(2); |
316 } | 316 } |
317 | 317 |
318 } // namespace | 318 } // namespace |
319 | 319 |
320 } // namespace blink | 320 } // namespace blink |
OLD | NEW |