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

Side by Side Diff: content/public/test/download_test_observer.cc

Issue 16007017: [Resumption 10/12] Use DI::IsDone to check for terminal downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with r204343 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 | « content/public/browser/download_item.h ('k') | content/public/test/mock_download_item.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 #include "content/public/test/download_test_observer.h" 5 #include "content/public/test/download_test_observer.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 if (waiting_ && IsFinished()) 214 if (waiting_ && IsFinished())
215 base::MessageLoopForUI::current()->Quit(); 215 base::MessageLoopForUI::current()->Quit();
216 } 216 }
217 217
218 void DownloadTestObserver::AcceptDangerousDownload(int32 download_id) { 218 void DownloadTestObserver::AcceptDangerousDownload(int32 download_id) {
219 // Download manager was shutdown before the UI thread could accept the 219 // Download manager was shutdown before the UI thread could accept the
220 // download. 220 // download.
221 if (!download_manager_) 221 if (!download_manager_)
222 return; 222 return;
223 DownloadItem* download = download_manager_->GetDownload(download_id); 223 DownloadItem* download = download_manager_->GetDownload(download_id);
224 if (download && (download->GetState() == DownloadItem::IN_PROGRESS)) 224 if (download && !download->IsDone())
225 download->ValidateDangerousDownload(); 225 download->ValidateDangerousDownload();
226 } 226 }
227 227
228 void DownloadTestObserver::DenyDangerousDownload(int32 download_id) { 228 void DownloadTestObserver::DenyDangerousDownload(int32 download_id) {
229 // Download manager was shutdown before the UI thread could deny the 229 // Download manager was shutdown before the UI thread could deny the
230 // download. 230 // download.
231 if (!download_manager_) 231 if (!download_manager_)
232 return; 232 return;
233 DownloadItem* download = download_manager_->GetDownload(download_id); 233 DownloadItem* download = download_manager_->GetDownload(download_id);
234 if (download && (download->GetState() == DownloadItem::IN_PROGRESS)) { 234 if (download && !download->IsDone())
235 download->Remove(); 235 download->Remove();
236 }
237 } 236 }
238 237
239 DownloadTestObserverTerminal::DownloadTestObserverTerminal( 238 DownloadTestObserverTerminal::DownloadTestObserverTerminal(
240 DownloadManager* download_manager, 239 DownloadManager* download_manager,
241 size_t wait_count, 240 size_t wait_count,
242 DangerousDownloadAction dangerous_download_action) 241 DangerousDownloadAction dangerous_download_action)
243 : DownloadTestObserver(download_manager, 242 : DownloadTestObserver(download_manager,
244 wait_count, 243 wait_count,
245 dangerous_download_action) { 244 dangerous_download_action) {
246 // You can't rely on overriden virtual functions in a base class constructor; 245 // You can't rely on overriden virtual functions in a base class constructor;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 base::MessageLoopForUI::current()->Quit(); 419 base::MessageLoopForUI::current()->Quit();
421 } 420 }
422 421
423 const DownloadUrlParameters::OnStartedCallback 422 const DownloadUrlParameters::OnStartedCallback
424 DownloadTestItemCreationObserver::callback() { 423 DownloadTestItemCreationObserver::callback() {
425 return base::Bind( 424 return base::Bind(
426 &DownloadTestItemCreationObserver::DownloadItemCreationCallback, this); 425 &DownloadTestItemCreationObserver::DownloadItemCreationCallback, this);
427 } 426 }
428 427
429 } // namespace content 428 } // namespace content
OLDNEW
« no previous file with comments | « content/public/browser/download_item.h ('k') | content/public/test/mock_download_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698