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

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

Issue 17515003: [Downloads] Move UpdateObservers out of TransitionTo in DownloadItemImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restore necessary UpdateObservers() call Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/download/download_item_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // 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 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 ConfirmFileStatusForResume( 1123 ConfirmFileStatusForResume(
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, 0},
1134 // Notification of successful restart. 1134 // Notification of successful restart.
1135 {DownloadItem::IN_PROGRESS, 0}, 1135 {DownloadItem::IN_PROGRESS, 0},
1136 // Completion. 1136 // Completion.
1137 {DownloadItem::COMPLETE, GetSafeBufferChunk() * 3}, 1137 {DownloadItem::COMPLETE, GetSafeBufferChunk() * 3},
1138 }; 1138 };
1139 1139
1140 recorder.CompareToExpectedRecord(expected_record, arraysize(expected_record)); 1140 recorder.CompareToExpectedRecord(expected_record, arraysize(expected_record));
1141 } 1141 }
1142 1142
1143 // Confirm we don't try to resume if we don't have a verifier. 1143 // Confirm we don't try to resume if we don't have a verifier.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 ConfirmFileStatusForResume( 1220 ConfirmFileStatusForResume(
1221 download, true, GetSafeBufferChunk() * 3, GetSafeBufferChunk() * 3, 1221 download, true, GetSafeBufferChunk() * 3, GetSafeBufferChunk() * 3,
1222 base::FilePath(FILE_PATH_LITERAL("rangereset"))); 1222 base::FilePath(FILE_PATH_LITERAL("rangereset")));
1223 1223
1224 static const RecordingDownloadObserver::RecordStruct expected_record[] = { 1224 static const RecordingDownloadObserver::RecordStruct expected_record[] = {
1225 // Result of RST 1225 // Result of RST
1226 {DownloadItem::INTERRUPTED, GetSafeBufferChunk()}, 1226 {DownloadItem::INTERRUPTED, GetSafeBufferChunk()},
1227 // Starting continuation 1227 // Starting continuation
1228 {DownloadItem::IN_PROGRESS, GetSafeBufferChunk()}, 1228 {DownloadItem::IN_PROGRESS, GetSafeBufferChunk()},
1229 // Error because file isn't there. 1229 // Error because file isn't there.
1230 {DownloadItem::INTERRUPTED, GetSafeBufferChunk()}, 1230 {DownloadItem::INTERRUPTED, 0},
1231 // Restart 1231 // Restart.
1232 {DownloadItem::IN_PROGRESS, 0}, 1232 {DownloadItem::IN_PROGRESS, 0},
1233 // Completion. 1233 // Completion.
1234 {DownloadItem::COMPLETE, GetSafeBufferChunk() * 3}, 1234 {DownloadItem::COMPLETE, GetSafeBufferChunk() * 3},
1235 }; 1235 };
1236 1236
1237 recorder.CompareToExpectedRecord(expected_record, arraysize(expected_record)); 1237 recorder.CompareToExpectedRecord(expected_record, arraysize(expected_record));
1238 } 1238 }
1239 1239
1240 IN_PROC_BROWSER_TEST_F(DownloadContentTest, ResumeWithFileInitError) { 1240 IN_PROC_BROWSER_TEST_F(DownloadContentTest, ResumeWithFileInitError) {
1241 CommandLine::ForCurrentProcess()->AppendSwitch( 1241 CommandLine::ForCurrentProcess()->AppendSwitch(
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 // Start the second download and wait until it's done. The test server is 1566 // 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 1567 // single threaded. The response to this download request should follow the
1568 // response to the previous resumption request. 1568 // response to the previous resumption request.
1569 GURL url2(test_server()->GetURL("rangereset?size=100&rst_limit=0&token=x")); 1569 GURL url2(test_server()->GetURL("rangereset?size=100&rst_limit=0&token=x"));
1570 DownloadAndWait(shell(), url2, DownloadItem::COMPLETE); 1570 DownloadAndWait(shell(), url2, DownloadItem::COMPLETE);
1571 1571
1572 EXPECT_TRUE(EnsureNoPendingDownloads()); 1572 EXPECT_TRUE(EnsureNoPendingDownloads());
1573 } 1573 }
1574 1574
1575 } // namespace content 1575 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/download/download_item_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698