OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/FetchDataLoader.h" | 5 #include "modules/fetch/FetchDataLoader.h" |
6 | 6 |
7 #include "modules/fetch/DataConsumerHandleTestUtil.h" | 7 #include "modules/fetch/DataConsumerHandleTestUtil.h" |
8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 218 |
219 TEST(FetchDataLoaderTest, LoadAsArrayBuffer) | 219 TEST(FetchDataLoaderTest, LoadAsArrayBuffer) |
220 { | 220 { |
221 WebDataConsumerHandle::Client *client = nullptr; | 221 WebDataConsumerHandle::Client *client = nullptr; |
222 Checkpoint checkpoint; | 222 Checkpoint checkpoint; |
223 | 223 |
224 OwnPtr<MockHandle> handle = MockHandle::create(); | 224 OwnPtr<MockHandle> handle = MockHandle::create(); |
225 OwnPtr<MockReader> reader = MockReader::create(); | 225 OwnPtr<MockReader> reader = MockReader::create(); |
226 FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsArrayBuffe
r(); | 226 FetchDataLoader* fetchDataLoader = FetchDataLoader::createLoaderAsArrayBuffe
r(); |
227 MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient
::create(); | 227 MockFetchDataLoaderClient* fetchDataLoaderClient = MockFetchDataLoaderClient
::create(); |
228 RefPtr<DOMArrayBuffer> arrayBuffer; | 228 DOMArrayBuffer* arrayBuffer = nullptr; |
229 | 229 |
230 InSequence s; | 230 InSequence s; |
231 EXPECT_CALL(checkpoint, Call(1)); | 231 EXPECT_CALL(checkpoint, Call(1)); |
232 EXPECT_CALL(*handle, obtainReaderInternal(_)).WillOnce(DoAll(SaveArg<0>(&cli
ent), Return(reader.get()))); | 232 EXPECT_CALL(*handle, obtainReaderInternal(_)).WillOnce(DoAll(SaveArg<0>(&cli
ent), Return(reader.get()))); |
233 EXPECT_CALL(checkpoint, Call(2)); | 233 EXPECT_CALL(checkpoint, Call(2)); |
234 EXPECT_CALL(*reader, beginRead(_, kNone, _)).WillOnce(DoAll(SetArgPointee<0>
(static_cast<const void*>(kQuickBrownFox)), SetArgPointee<2>(kQuickBrownFoxLengt
hWithTerminatingNull), Return(kOk))); | 234 EXPECT_CALL(*reader, beginRead(_, kNone, _)).WillOnce(DoAll(SetArgPointee<0>
(static_cast<const void*>(kQuickBrownFox)), SetArgPointee<2>(kQuickBrownFoxLengt
hWithTerminatingNull), Return(kOk))); |
235 EXPECT_CALL(*reader, endRead(kQuickBrownFoxLengthWithTerminatingNull)).WillO
nce(Return(kOk)); | 235 EXPECT_CALL(*reader, endRead(kQuickBrownFoxLengthWithTerminatingNull)).WillO
nce(Return(kOk)); |
236 EXPECT_CALL(*reader, beginRead(_, kNone, _)).WillOnce(Return(kDone)); | 236 EXPECT_CALL(*reader, beginRead(_, kNone, _)).WillOnce(Return(kDone)); |
237 EXPECT_CALL(*reader, destruct()); | 237 EXPECT_CALL(*reader, destruct()); |
238 EXPECT_CALL(*fetchDataLoaderClient, didFetchDataLoadedArrayBufferMock(_)).Wi
llOnce(SaveArg<0>(&arrayBuffer)); | 238 EXPECT_CALL(*fetchDataLoaderClient, didFetchDataLoadedArrayBufferMock(_)).Wi
llOnce(SaveArg<0>(&arrayBuffer)); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 checkpoint.Call(1); | 444 checkpoint.Call(1); |
445 fetchDataLoader->start(handle.get(), fetchDataLoaderClient); | 445 fetchDataLoader->start(handle.get(), fetchDataLoaderClient); |
446 checkpoint.Call(2); | 446 checkpoint.Call(2); |
447 fetchDataLoader->cancel(); | 447 fetchDataLoader->cancel(); |
448 checkpoint.Call(3); | 448 checkpoint.Call(3); |
449 } | 449 } |
450 | 450 |
451 } // namespace | 451 } // namespace |
452 | 452 |
453 } // namespace blink | 453 } // namespace blink |
OLD | NEW |