Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(583)

Side by Side Diff: content/browser/download/download_file_unittest.cc

Issue 2823273004: Add new UMA stats for parallelizable download (Closed)
Patch Set: fix test Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 .WillOnce(Return(ByteStreamReader::STREAM_EMPTY)) 236 .WillOnce(Return(ByteStreamReader::STREAM_EMPTY))
237 .RetiresOnSaturation(); 237 .RetiresOnSaturation();
238 238
239 base::WeakPtrFactory<DownloadFileTest> weak_ptr_factory(this); 239 base::WeakPtrFactory<DownloadFileTest> weak_ptr_factory(this);
240 DownloadInterruptReason result = DOWNLOAD_INTERRUPT_REASON_NONE; 240 DownloadInterruptReason result = DOWNLOAD_INTERRUPT_REASON_NONE;
241 base::RunLoop loop_runner; 241 base::RunLoop loop_runner;
242 download_file_->Initialize( 242 download_file_->Initialize(
243 base::Bind(&DownloadFileTest::SetInterruptReasonCallback, 243 base::Bind(&DownloadFileTest::SetInterruptReasonCallback,
244 weak_ptr_factory.GetWeakPtr(), loop_runner.QuitClosure(), 244 weak_ptr_factory.GetWeakPtr(), loop_runner.QuitClosure(),
245 &result), 245 &result),
246 DownloadFile::CancelRequestCallback(), received_slices); 246 DownloadFile::CancelRequestCallback(), received_slices, true);
247 loop_runner.Run(); 247 loop_runner.Run();
248 248
249 ::testing::Mock::VerifyAndClearExpectations(input_stream_); 249 ::testing::Mock::VerifyAndClearExpectations(input_stream_);
250 return result == DOWNLOAD_INTERRUPT_REASON_NONE; 250 return result == DOWNLOAD_INTERRUPT_REASON_NONE;
251 } 251 }
252 252
253 void DestroyDownloadFile(int offset, bool compare_disk_data = true) { 253 void DestroyDownloadFile(int offset, bool compare_disk_data = true) {
254 EXPECT_FALSE(download_file_->InProgress()); 254 EXPECT_FALSE(download_file_->InProgress());
255 255
256 // Make sure the data has been properly written to disk. 256 // Make sure the data has been properly written to disk.
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 SourceStreamTestData stream_data_0(0, stream_0_length, true); 1016 SourceStreamTestData stream_data_0(0, stream_0_length, true);
1017 SourceStreamTestData stream_data_1(stream_0_length - 1, 0, false); 1017 SourceStreamTestData stream_data_1(stream_0_length - 1, 0, false);
1018 VerifySourceStreamsStates(stream_data_0); 1018 VerifySourceStreamsStates(stream_data_0);
1019 VerifySourceStreamsStates(stream_data_1); 1019 VerifySourceStreamsStates(stream_data_1);
1020 EXPECT_EQ(stream_0_length, TotalBytesReceived()); 1020 EXPECT_EQ(stream_0_length, TotalBytesReceived());
1021 1021
1022 DestroyDownloadFile(0); 1022 DestroyDownloadFile(0);
1023 } 1023 }
1024 1024
1025 } // namespace content 1025 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_file_impl.cc ('k') | content/browser/download/download_item_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698