| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 EXPECT_CALL(checkpoint, Call(1)); | 262 EXPECT_CALL(checkpoint, Call(1)); |
| 263 EXPECT_CALL(*client, didFetchDataLoadedString(String("hello"))); | 263 EXPECT_CALL(*client, didFetchDataLoadedString(String("hello"))); |
| 264 EXPECT_CALL(checkpoint, Call(2)); | 264 EXPECT_CALL(checkpoint, Call(2)); |
| 265 | 265 |
| 266 OwnPtr<ReplayingHandle> handle = ReplayingHandle::create(); | 266 OwnPtr<ReplayingHandle> handle = ReplayingHandle::create(); |
| 267 handle->add(Command(Command::Data, "hello")); | 267 handle->add(Command(Command::Data, "hello")); |
| 268 handle->add(Command(Command::Done)); | 268 handle->add(Command(Command::Done)); |
| 269 Persistent<BodyStreamBuffer> buffer = new BodyStreamBuffer(createFetchDataCo
nsumerHandleFromWebHandle(handle.release())); | 269 Persistent<BodyStreamBuffer> buffer = new BodyStreamBuffer(createFetchDataCo
nsumerHandleFromWebHandle(handle.release())); |
| 270 buffer->startLoading(getExecutionContext(), FetchDataLoader::createLoaderAsS
tring(), client); | 270 buffer->startLoading(getExecutionContext(), FetchDataLoader::createLoaderAsS
tring(), client); |
| 271 | 271 |
| 272 Heap::collectAllGarbage(); | 272 ThreadHeap::collectAllGarbage(); |
| 273 checkpoint.Call(1); | 273 checkpoint.Call(1); |
| 274 testing::runPendingTasks(); | 274 testing::runPendingTasks(); |
| 275 checkpoint.Call(2); | 275 checkpoint.Call(2); |
| 276 } | 276 } |
| 277 | 277 |
| 278 // TODO(hiroshige): Merge this class into MockFetchDataConsumerHandle. | 278 // TODO(hiroshige): Merge this class into MockFetchDataConsumerHandle. |
| 279 class MockFetchDataConsumerHandleWithMockDestructor : public DataConsumerHandleT
estUtil::MockFetchDataConsumerHandle { | 279 class MockFetchDataConsumerHandleWithMockDestructor : public DataConsumerHandleT
estUtil::MockFetchDataConsumerHandle { |
| 280 public: | 280 public: |
| 281 static PassOwnPtr<::testing::StrictMock<MockFetchDataConsumerHandleWithMockD
estructor>> create() { return adoptPtr(new ::testing::StrictMock<MockFetchDataCo
nsumerHandleWithMockDestructor>); } | 281 static PassOwnPtr<::testing::StrictMock<MockFetchDataConsumerHandleWithMockD
estructor>> create() { return adoptPtr(new ::testing::StrictMock<MockFetchDataCo
nsumerHandleWithMockDestructor>); } |
| 282 | 282 |
| (...skipping 28 matching lines...) Expand all 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 |