OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/download/mock_download_file.h" | 5 #include "content/browser/download/mock_download_file.h" |
6 #include "testing/gmock/include/gmock/gmock.h" | 6 #include "testing/gmock/include/gmock/gmock.h" |
7 | 7 |
8 using ::testing::_; | 8 using ::testing::_; |
9 using ::testing::Return; | 9 using ::testing::Return; |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 namespace { | 12 namespace { |
13 | 13 |
14 void SuccessRun( | 14 void SuccessRun( |
15 const DownloadFile::InitializeCallback& initialize_callback, | 15 const DownloadFile::InitializeCallback& initialize_callback, |
16 const DownloadFile::CancelRequestCallback& cancel_request_callback, | 16 const DownloadFile::CancelRequestCallback& cancel_request_callback, |
17 const DownloadItem::ReceivedSlices& received_slices) { | 17 const DownloadItem::ReceivedSlices& received_slices, |
| 18 bool is_parallelizable) { |
18 initialize_callback.Run(DOWNLOAD_INTERRUPT_REASON_NONE); | 19 initialize_callback.Run(DOWNLOAD_INTERRUPT_REASON_NONE); |
19 } | 20 } |
20 | 21 |
21 } // namespace | 22 } // namespace |
22 | 23 |
23 MockDownloadFile::MockDownloadFile() { | 24 MockDownloadFile::MockDownloadFile() { |
24 // This is here because |Initialize()| is normally called right after | 25 // This is here because |Initialize()| is normally called right after |
25 // construction. | 26 // construction. |
26 ON_CALL(*this, Initialize(_, _, _)) | 27 ON_CALL(*this, Initialize(_, _, _, _)) |
27 .WillByDefault(::testing::Invoke(SuccessRun)); | 28 .WillByDefault(::testing::Invoke(SuccessRun)); |
28 } | 29 } |
29 | 30 |
30 MockDownloadFile::~MockDownloadFile() { | 31 MockDownloadFile::~MockDownloadFile() { |
31 } | 32 } |
32 | 33 |
33 void MockDownloadFile::AddByteStream( | 34 void MockDownloadFile::AddByteStream( |
34 std::unique_ptr<ByteStreamReader> stream_reader, | 35 std::unique_ptr<ByteStreamReader> stream_reader, |
35 int64_t offset, | 36 int64_t offset, |
36 int64_t length) { | 37 int64_t length) { |
37 // Gmock currently can't mock method that takes move-only parameters, | 38 // Gmock currently can't mock method that takes move-only parameters, |
38 // delegate the EXPECT_CALL count to |DoAddByteStream|. | 39 // delegate the EXPECT_CALL count to |DoAddByteStream|. |
39 DoAddByteStream(stream_reader.get(), offset, length); | 40 DoAddByteStream(stream_reader.get(), offset, length); |
40 } | 41 } |
41 | 42 |
42 } // namespace content | 43 } // namespace content |
OLD | NEW |