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

Unified Diff: content/public/test/download_test_observer.cc

Issue 17450008: [Downloads] Make DownloadTestObserverTerminal condition on IsDone (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/test/download_test_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/download_test_observer.cc
diff --git a/content/public/test/download_test_observer.cc b/content/public/test/download_test_observer.cc
index cc26ff02a45a7ef0ec013ccc80bdf72eed4a341a..2d322e52d24ac0b21e3566468812af0267b13a54 100644
--- a/content/public/test/download_test_observer.cc
+++ b/content/public/test/download_test_observer.cc
@@ -255,7 +255,7 @@ DownloadTestObserverTerminal::~DownloadTestObserverTerminal() {
bool DownloadTestObserverTerminal::IsDownloadInFinalState(
DownloadItem* download) {
- return (download->GetState() != DownloadItem::IN_PROGRESS);
+ return download->IsDone();
}
DownloadTestObserverInProgress::DownloadTestObserverInProgress(
@@ -281,6 +281,29 @@ bool DownloadTestObserverInProgress::IsDownloadInFinalState(
!download->GetTargetFilePath().empty();
}
+DownloadTestObserverInterrupted::DownloadTestObserverInterrupted(
+ DownloadManager* download_manager,
+ size_t wait_count,
+ DangerousDownloadAction dangerous_download_action)
+ : DownloadTestObserver(download_manager,
+ wait_count,
+ dangerous_download_action) {
+ // You can't rely on overriden virtual functions in a base class constructor;
+ // the virtual function table hasn't been set up yet. So, we have to do any
+ // work that depends on those functions in the derived class constructor
+ // instead. In this case, it's because of |IsDownloadInFinalState()|.
+ Init();
+}
+
+DownloadTestObserverInterrupted::~DownloadTestObserverInterrupted() {
+}
+
+
+bool DownloadTestObserverInterrupted::IsDownloadInFinalState(
+ DownloadItem* download) {
+ return download->GetState() == DownloadItem::INTERRUPTED;
+}
+
DownloadTestFlushObserver::DownloadTestFlushObserver(
DownloadManager* download_manager)
: download_manager_(download_manager),
« no previous file with comments | « content/public/test/download_test_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698