Chromium Code Reviews| 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 "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 11 matching lines...) Expand all Loading... | |
| 22 // These functions take scoped_refptr's to DownloadManager because they | 22 // These functions take scoped_refptr's to DownloadManager because they |
| 23 // are posted to message queues, and hence may execute arbitrarily after | 23 // are posted to message queues, and hence may execute arbitrarily after |
| 24 // their actual posting. Once posted, there is no connection between | 24 // their actual posting. Once posted, there is no connection between |
| 25 // these routines and the DownloadTestObserver class from which | 25 // these routines and the DownloadTestObserver class from which |
| 26 // they came, so the DownloadTestObserver's reference to the | 26 // they came, so the DownloadTestObserver's reference to the |
| 27 // DownloadManager cannot be counted on to keep the DownloadManager around. | 27 // DownloadManager cannot be counted on to keep the DownloadManager around. |
| 28 | 28 |
| 29 // Fake user click on "Accept". | 29 // Fake user click on "Accept". |
| 30 void AcceptDangerousDownload(scoped_refptr<DownloadManager> download_manager, | 30 void AcceptDangerousDownload(scoped_refptr<DownloadManager> download_manager, |
| 31 int32 download_id) { | 31 int32 download_id) { |
| 32 DownloadItem* download = download_manager->GetDownloadItem(download_id); | 32 DownloadItem* download = download_manager->GetDownload(download_id); |
|
Randy Smith (Not in Mondays)
2012/09/11 19:02:21
Same comment as in DownloadsDOMHandler: I think we
benjhayden
2012/09/12 18:17:25
Done.
| |
| 33 download->DangerousDownloadValidated(); | 33 download->DangerousDownloadValidated(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 // Fake user click on "Deny". | 36 // Fake user click on "Deny". |
| 37 void DenyDangerousDownload(scoped_refptr<DownloadManager> download_manager, | 37 void DenyDangerousDownload(scoped_refptr<DownloadManager> download_manager, |
| 38 int32 download_id) { | 38 int32 download_id) { |
| 39 DownloadItem* download = download_manager->GetDownloadItem(download_id); | 39 DownloadItem* download = download_manager->GetDownload(download_id); |
| 40 ASSERT_TRUE(download->IsPartialDownload()); | 40 ASSERT_TRUE(download->IsPartialDownload()); |
| 41 download->Cancel(true); | 41 download->Cancel(true); |
| 42 download->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); | 42 download->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 DownloadTestObserver::DownloadTestObserver( | 47 DownloadTestObserver::DownloadTestObserver( |
| 48 DownloadManager* download_manager, | 48 DownloadManager* download_manager, |
| 49 size_t wait_count, | 49 size_t wait_count, |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 379 MessageLoopForUI::current()->Quit(); | 379 MessageLoopForUI::current()->Quit(); |
| 380 } | 380 } |
| 381 | 381 |
| 382 const DownloadUrlParameters::OnStartedCallback | 382 const DownloadUrlParameters::OnStartedCallback |
| 383 DownloadTestItemCreationObserver::callback() { | 383 DownloadTestItemCreationObserver::callback() { |
| 384 return base::Bind( | 384 return base::Bind( |
| 385 &DownloadTestItemCreationObserver::DownloadItemCreationCallback, this); | 385 &DownloadTestItemCreationObserver::DownloadItemCreationCallback, this); |
| 386 } | 386 } |
| 387 | 387 |
| 388 } // namespace content | 388 } // namespace content |
| OLD | NEW |