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

Side by Side Diff: chrome/browser/download/download_item_model_unittest.cc

Issue 1751603002: [Downloads] Rework how hashes are calculated for download files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on top of https://codereview.chromium.org/1781983002 since that's going in first. Created 4 years, 9 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 "chrome/browser/download/download_item_model.h" 5 #include "chrome/browser/download/download_item_model.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 "Failed - File too large"}, 136 "Failed - File too large"},
137 {content::DOWNLOAD_INTERRUPT_REASON_FILE_VIRUS_INFECTED, 137 {content::DOWNLOAD_INTERRUPT_REASON_FILE_VIRUS_INFECTED,
138 "Failed - Virus detected"}, 138 "Failed - Virus detected"},
139 {content::DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED, "Failed - Blocked"}, 139 {content::DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED, "Failed - Blocked"},
140 {content::DOWNLOAD_INTERRUPT_REASON_FILE_SECURITY_CHECK_FAILED, 140 {content::DOWNLOAD_INTERRUPT_REASON_FILE_SECURITY_CHECK_FAILED,
141 "Failed - Virus scan failed"}, 141 "Failed - Virus scan failed"},
142 {content::DOWNLOAD_INTERRUPT_REASON_FILE_TOO_SHORT, 142 {content::DOWNLOAD_INTERRUPT_REASON_FILE_TOO_SHORT,
143 "Failed - File truncated"}, 143 "Failed - File truncated"},
144 {content::DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR, 144 {content::DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR,
145 "Failed - System busy"}, 145 "Failed - System busy"},
146 {content::DOWNLOAD_INTERRUPT_REASON_FILE_HASH_MISMATCH,
147 "Failed - Download error"},
146 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, 148 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED,
147 "Failed - Network error"}, 149 "Failed - Network error"},
148 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT, 150 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT,
149 "Failed - Network timeout"}, 151 "Failed - Network timeout"},
150 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED, 152 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED,
151 "Failed - Network disconnected"}, 153 "Failed - Network disconnected"},
152 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_SERVER_DOWN, 154 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_SERVER_DOWN,
153 "Failed - Server unavailable"}, 155 "Failed - Server unavailable"},
154 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST, 156 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST,
155 "Failed - Network error"}, 157 "Failed - Network error"},
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 "foo.bar\nFile too large"}, 210 "foo.bar\nFile too large"},
209 {content::DOWNLOAD_INTERRUPT_REASON_FILE_VIRUS_INFECTED, 211 {content::DOWNLOAD_INTERRUPT_REASON_FILE_VIRUS_INFECTED,
210 "foo.bar\nVirus detected"}, 212 "foo.bar\nVirus detected"},
211 {content::DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED, "foo.bar\nBlocked"}, 213 {content::DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED, "foo.bar\nBlocked"},
212 {content::DOWNLOAD_INTERRUPT_REASON_FILE_SECURITY_CHECK_FAILED, 214 {content::DOWNLOAD_INTERRUPT_REASON_FILE_SECURITY_CHECK_FAILED,
213 "foo.bar\nVirus scan failed"}, 215 "foo.bar\nVirus scan failed"},
214 {content::DOWNLOAD_INTERRUPT_REASON_FILE_TOO_SHORT, 216 {content::DOWNLOAD_INTERRUPT_REASON_FILE_TOO_SHORT,
215 "foo.bar\nFile truncated"}, 217 "foo.bar\nFile truncated"},
216 {content::DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR, 218 {content::DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR,
217 "foo.bar\nSystem busy"}, 219 "foo.bar\nSystem busy"},
220 {content::DOWNLOAD_INTERRUPT_REASON_FILE_HASH_MISMATCH,
221 "foo.bar\nDownload error"},
218 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED, 222 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED,
219 "foo.bar\nNetwork error"}, 223 "foo.bar\nNetwork error"},
220 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT, 224 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT,
221 "foo.bar\nNetwork timeout"}, 225 "foo.bar\nNetwork timeout"},
222 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED, 226 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED,
223 "foo.bar\nNetwork disconnected"}, 227 "foo.bar\nNetwork disconnected"},
224 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_SERVER_DOWN, 228 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_SERVER_DOWN,
225 "foo.bar\nServer unavailable"}, 229 "foo.bar\nServer unavailable"},
226 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST, 230 {content::DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST,
227 "foo.bar\nNetwork error"}, 231 "foo.bar\nNetwork error"},
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 EXPECT_CALL(item(), GetAutoOpened()) 428 EXPECT_CALL(item(), GetAutoOpened())
425 .WillRepeatedly(Return(test_case.auto_opened)); 429 .WillRepeatedly(Return(test_case.auto_opened));
426 430
427 EXPECT_EQ(test_case.expected_result, 431 EXPECT_EQ(test_case.expected_result,
428 model().ShouldRemoveFromShelfWhenComplete()) 432 model().ShouldRemoveFromShelfWhenComplete())
429 << "Test case: " << i; 433 << "Test case: " << i;
430 Mock::VerifyAndClearExpectations(&item()); 434 Mock::VerifyAndClearExpectations(&item());
431 Mock::VerifyAndClearExpectations(&model()); 435 Mock::VerifyAndClearExpectations(&model());
432 } 436 }
433 } 437 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_item_model.cc ('k') | chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698