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 // This file contains download browser tests that are known to be runnable | 5 // This file contains download browser tests that are known to be runnable |
6 // in a pure content context. Over time tests should be migrated here. | 6 // in a pure content context. Over time tests should be migrated here. |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 download, true, GetSafeBufferChunk() * 3, GetSafeBufferChunk() * 3, | 1124 download, true, GetSafeBufferChunk() * 3, GetSafeBufferChunk() * 3, |
1125 base::FilePath(FILE_PATH_LITERAL("rangereset"))); | 1125 base::FilePath(FILE_PATH_LITERAL("rangereset"))); |
1126 | 1126 |
1127 static const RecordingDownloadObserver::RecordStruct expected_record[] = { | 1127 static const RecordingDownloadObserver::RecordStruct expected_record[] = { |
1128 // Result of RST | 1128 // Result of RST |
1129 {DownloadItem::INTERRUPTED, GetSafeBufferChunk()}, | 1129 {DownloadItem::INTERRUPTED, GetSafeBufferChunk()}, |
1130 // Starting continuation | 1130 // Starting continuation |
1131 {DownloadItem::IN_PROGRESS, GetSafeBufferChunk()}, | 1131 {DownloadItem::IN_PROGRESS, GetSafeBufferChunk()}, |
1132 // Server precondition fail. | 1132 // Server precondition fail. |
1133 {DownloadItem::INTERRUPTED, GetSafeBufferChunk()}, | 1133 {DownloadItem::INTERRUPTED, GetSafeBufferChunk()}, |
| 1134 // Resumption. |
| 1135 {DownloadItem::INTERRUPTED, 0}, |
1134 // Notification of successful restart. | 1136 // Notification of successful restart. |
1135 {DownloadItem::IN_PROGRESS, 0}, | 1137 {DownloadItem::IN_PROGRESS, 0}, |
1136 // Completion. | 1138 // Completion. |
1137 {DownloadItem::COMPLETE, GetSafeBufferChunk() * 3}, | 1139 {DownloadItem::COMPLETE, GetSafeBufferChunk() * 3}, |
1138 }; | 1140 }; |
1139 | 1141 |
1140 recorder.CompareToExpectedRecord(expected_record, arraysize(expected_record)); | 1142 recorder.CompareToExpectedRecord(expected_record, arraysize(expected_record)); |
1141 } | 1143 } |
1142 | 1144 |
1143 // Confirm we don't try to resume if we don't have a verifier. | 1145 // Confirm we don't try to resume if we don't have a verifier. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 download, true, GetSafeBufferChunk() * 3, GetSafeBufferChunk() * 3, | 1223 download, true, GetSafeBufferChunk() * 3, GetSafeBufferChunk() * 3, |
1222 base::FilePath(FILE_PATH_LITERAL("rangereset"))); | 1224 base::FilePath(FILE_PATH_LITERAL("rangereset"))); |
1223 | 1225 |
1224 static const RecordingDownloadObserver::RecordStruct expected_record[] = { | 1226 static const RecordingDownloadObserver::RecordStruct expected_record[] = { |
1225 // Result of RST | 1227 // Result of RST |
1226 {DownloadItem::INTERRUPTED, GetSafeBufferChunk()}, | 1228 {DownloadItem::INTERRUPTED, GetSafeBufferChunk()}, |
1227 // Starting continuation | 1229 // Starting continuation |
1228 {DownloadItem::IN_PROGRESS, GetSafeBufferChunk()}, | 1230 {DownloadItem::IN_PROGRESS, GetSafeBufferChunk()}, |
1229 // Error because file isn't there. | 1231 // Error because file isn't there. |
1230 {DownloadItem::INTERRUPTED, GetSafeBufferChunk()}, | 1232 {DownloadItem::INTERRUPTED, GetSafeBufferChunk()}, |
1231 // Restart | 1233 // Resuming. |
| 1234 {DownloadItem::INTERRUPTED, 0}, |
| 1235 // Restart. |
1232 {DownloadItem::IN_PROGRESS, 0}, | 1236 {DownloadItem::IN_PROGRESS, 0}, |
1233 // Completion. | 1237 // Completion. |
1234 {DownloadItem::COMPLETE, GetSafeBufferChunk() * 3}, | 1238 {DownloadItem::COMPLETE, GetSafeBufferChunk() * 3}, |
1235 }; | 1239 }; |
1236 | 1240 |
1237 recorder.CompareToExpectedRecord(expected_record, arraysize(expected_record)); | 1241 recorder.CompareToExpectedRecord(expected_record, arraysize(expected_record)); |
1238 } | 1242 } |
1239 | 1243 |
1240 IN_PROC_BROWSER_TEST_F(DownloadContentTest, ResumeWithFileInitError) { | 1244 IN_PROC_BROWSER_TEST_F(DownloadContentTest, ResumeWithFileInitError) { |
1241 CommandLine::ForCurrentProcess()->AppendSwitch( | 1245 CommandLine::ForCurrentProcess()->AppendSwitch( |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 // Start the second download and wait until it's done. The test server is | 1570 // Start the second download and wait until it's done. The test server is |
1567 // single threaded. The response to this download request should follow the | 1571 // single threaded. The response to this download request should follow the |
1568 // response to the previous resumption request. | 1572 // response to the previous resumption request. |
1569 GURL url2(test_server()->GetURL("rangereset?size=100&rst_limit=0&token=x")); | 1573 GURL url2(test_server()->GetURL("rangereset?size=100&rst_limit=0&token=x")); |
1570 DownloadAndWait(shell(), url2, DownloadItem::COMPLETE); | 1574 DownloadAndWait(shell(), url2, DownloadItem::COMPLETE); |
1571 | 1575 |
1572 EXPECT_TRUE(EnsureNoPendingDownloads()); | 1576 EXPECT_TRUE(EnsureNoPendingDownloads()); |
1573 } | 1577 } |
1574 | 1578 |
1575 } // namespace content | 1579 } // namespace content |
OLD | NEW |