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 "chrome/browser/download/download_item_model.h" | 5 #include "chrome/browser/download/download_item_model.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST, | 155 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST, |
156 "Failed - Network error" }, | 156 "Failed - Network error" }, |
157 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_FAILED, | 157 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_FAILED, |
158 "Failed - Server problem" }, | 158 "Failed - Server problem" }, |
159 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE, | 159 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE, |
160 "Failed - Download error" }, | 160 "Failed - Download error" }, |
161 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_PRECONDITION, | 161 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_PRECONDITION, |
162 "Failed - Download error" }, | 162 "Failed - Download error" }, |
163 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT, | 163 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT, |
164 "Failed - No file" }, | 164 "Failed - No file" }, |
| 165 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_UNAUTHORIZED, |
| 166 "Failed - Needs authorization" }, |
| 167 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_CERT_PROBLEM, |
| 168 "Failed - Bad certificate" }, |
165 { content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED, | 169 { content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED, |
166 "Cancelled" }, | 170 "Cancelled" }, |
167 { content::DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN, | 171 { content::DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN, |
168 "Failed - Shutdown" }, | 172 "Failed - Shutdown" }, |
169 { content::DOWNLOAD_INTERRUPT_REASON_CRASH, | 173 { content::DOWNLOAD_INTERRUPT_REASON_CRASH, |
170 "Failed - Crash" }, | 174 "Failed - Crash" }, |
171 }; | 175 }; |
172 COMPILE_ASSERT(kInterruptReasonCount == ARRAYSIZE_UNSAFE(kTestCases), | 176 COMPILE_ASSERT(kInterruptReasonCount == ARRAYSIZE_UNSAFE(kTestCases), |
173 interrupt_reason_mismatch); | 177 interrupt_reason_mismatch); |
174 | 178 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST, | 231 { content::DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST, |
228 "foo.bar\nNetwork error" }, | 232 "foo.bar\nNetwork error" }, |
229 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_FAILED, | 233 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_FAILED, |
230 "foo.bar\nServer problem" }, | 234 "foo.bar\nServer problem" }, |
231 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE, | 235 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE, |
232 "foo.bar\nDownload error" }, | 236 "foo.bar\nDownload error" }, |
233 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_PRECONDITION, | 237 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_PRECONDITION, |
234 "foo.bar\nDownload error" }, | 238 "foo.bar\nDownload error" }, |
235 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT, | 239 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_BAD_CONTENT, |
236 "foo.bar\nNo file" }, | 240 "foo.bar\nNo file" }, |
| 241 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_UNAUTHORIZED, |
| 242 "foo.bar\nNeeds authorization" }, |
| 243 { content::DOWNLOAD_INTERRUPT_REASON_SERVER_CERT_PROBLEM, |
| 244 "foo.bar\nBad certificate" }, |
237 { content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED, | 245 { content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED, |
238 "foo.bar" }, | 246 "foo.bar" }, |
239 { content::DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN, | 247 { content::DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN, |
240 "foo.bar\nShutdown" }, | 248 "foo.bar\nShutdown" }, |
241 { content::DOWNLOAD_INTERRUPT_REASON_CRASH, | 249 { content::DOWNLOAD_INTERRUPT_REASON_CRASH, |
242 "foo.bar\nCrash" }, | 250 "foo.bar\nCrash" }, |
243 }; | 251 }; |
244 COMPILE_ASSERT(kInterruptReasonCount == ARRAYSIZE_UNSAFE(kTestCases), | 252 COMPILE_ASSERT(kInterruptReasonCount == ARRAYSIZE_UNSAFE(kTestCases), |
245 interrupt_reason_mismatch); | 253 interrupt_reason_mismatch); |
246 | 254 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 EXPECT_CALL(item(), GetAutoOpened()) | 420 EXPECT_CALL(item(), GetAutoOpened()) |
413 .WillRepeatedly(Return(test_case.auto_opened)); | 421 .WillRepeatedly(Return(test_case.auto_opened)); |
414 | 422 |
415 EXPECT_EQ(test_case.expected_result, | 423 EXPECT_EQ(test_case.expected_result, |
416 model().ShouldRemoveFromShelfWhenComplete()) | 424 model().ShouldRemoveFromShelfWhenComplete()) |
417 << "Test case: " << i; | 425 << "Test case: " << i; |
418 Mock::VerifyAndClearExpectations(&item()); | 426 Mock::VerifyAndClearExpectations(&item()); |
419 Mock::VerifyAndClearExpectations(&model()); | 427 Mock::VerifyAndClearExpectations(&model()); |
420 } | 428 } |
421 } | 429 } |
OLD | NEW |