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

Unified Diff: chrome/browser/download/download_test_observer.h

Issue 9568003: Fixed issue with DownloadTestObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added check that download finished in expected state. Created 8 years, 10 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
Index: chrome/browser/download/download_test_observer.h
diff --git a/chrome/browser/download/download_test_observer.h b/chrome/browser/download/download_test_observer.h
index 3404f425e3c9d6fc57beb11ee7ca6e49536a251b..60104b77ae2d90782faa94f0705ad546cb06aca5 100644
--- a/chrome/browser/download/download_test_observer.h
+++ b/chrome/browser/download/download_test_observer.h
@@ -73,6 +73,10 @@ class DownloadTestObserver : public content::DownloadManager::Observer,
size_t NumDangerousDownloadsSeen() const;
+ // If we finish other than because we met the condtions, call this to find
+ // out how many rogue downloads there were.
+ size_t NumOtherDownloadsSeen() const;
Randy Smith (Not in Mondays) 2012/03/01 21:07:53 In context, it isn't clear what "rogue downloads"
ahendrickson 2012/03/02 17:29:41 Changed the comment.
+
private:
typedef std::set<content::DownloadItem*> DownloadSet;
@@ -82,11 +86,25 @@ class DownloadTestObserver : public content::DownloadManager::Observer,
// that state. So we keep our own track of transitions into final.
void DownloadInFinalState(content::DownloadItem* download);
+ // Called when we think the download item is in a terminal state.
+ void DownloadInTerminalState(content::DownloadItem* download);
+
void SignalIfFinished();
// The observed download manager.
scoped_refptr<content::DownloadManager> download_manager_;
+ // The set of |DownloadItem|s that have transitioned to a final state before
+ // we start. Will not overlap with |finished_downloads_|.
+ DownloadSet previously_finished_downloads_;
+
+ // The set of |DownloadItem|s that have transitioned to a final state without
+ // having hit the 'finished' state. Will not overlap with
+ // |finished_downloads_|.
+ // This is so the test will finish even if it doesn't have the expected
+ // result.
+ DownloadSet finished_other_downloads_;
+
// The set of DownloadItem's that have transitioned to their finished state
// since construction of this object. When the size of this array
// reaches wait_count_, we're done.

Powered by Google App Engine
This is Rietveld 408576698