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

Side by Side 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: Merged with trunk Created 8 years, 9 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 | chrome/browser/download/download_test_observer.cc » ('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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_OBSERVER_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_OBSERVER_H_ 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_OBSERVER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 virtual void OnDownloadOpened(content::DownloadItem* download) OVERRIDE {} 66 virtual void OnDownloadOpened(content::DownloadItem* download) OVERRIDE {}
67 67
68 // content::DownloadManager::Observer 68 // content::DownloadManager::Observer
69 virtual void ModelChanged(content::DownloadManager* manager) OVERRIDE; 69 virtual void ModelChanged(content::DownloadManager* manager) OVERRIDE;
70 70
71 virtual void SelectFileDialogDisplayed( 71 virtual void SelectFileDialogDisplayed(
72 content::DownloadManager* manager, int32 id) OVERRIDE; 72 content::DownloadManager* manager, int32 id) OVERRIDE;
73 73
74 size_t NumDangerousDownloadsSeen() const; 74 size_t NumDangerousDownloadsSeen() const;
75 75
76 size_t NumOtherDownloadsSeen() const;
77
76 private: 78 private:
77 typedef std::set<content::DownloadItem*> DownloadSet; 79 typedef std::set<content::DownloadItem*> DownloadSet;
78 80
79 // Called when we know that a download item is in a final state. 81 // Called when we know that a download item is in a final state.
80 // Note that this is not the same as it first transitioning in to the 82 // Note that this is not the same as it first transitioning in to the
81 // final state; multiple notifications may occur once the item is in 83 // final state; multiple notifications may occur once the item is in
82 // that state. So we keep our own track of transitions into final. 84 // that state. So we keep our own track of transitions into final.
83 void DownloadInFinalState(content::DownloadItem* download); 85 void DownloadInFinalState(content::DownloadItem* download);
84 86
87 // Called when we think the download item is in a terminal state.
88 // Should never be called normally, only when there's a problem with a test.
ahendrickson 2012/03/01 20:20:14 Remove 2nd line of comment. It's incorrect.
ahendrickson 2012/03/01 20:38:39 Done.
89 void DownloadInTerminalState(content::DownloadItem* download);
90
85 void SignalIfFinished(); 91 void SignalIfFinished();
86 92
87 // The observed download manager. 93 // The observed download manager.
88 scoped_refptr<content::DownloadManager> download_manager_; 94 scoped_refptr<content::DownloadManager> download_manager_;
89 95
96 // The set of |DownloadItem|s that have transitioned to a final state before
97 // we start. May overlap with |finished_downloads_|.
ahendrickson 2012/03/01 20:20:14 May -> Will not
ahendrickson 2012/03/01 20:38:39 Done.
98 DownloadSet previously_finished_downloads_;
benjhayden 2012/03/01 19:58:32 So now we have 4 DownloadSets. It seems that it wo
ahendrickson 2012/03/01 20:38:39 I think the code would be more cluttered. Yes, we
99
100 // The set of |DownloadItem|s that have transitioned to a final state without
101 // having hit the 'finished' state. Will not overlap with
102 // |finished_downloads_|.
103 // This is so the test will finish even if it doesn't have the expected
104 // result.
105 DownloadSet finished_other_downloads_;
106
90 // The set of DownloadItem's that have transitioned to their finished state 107 // The set of DownloadItem's that have transitioned to their finished state
91 // since construction of this object. When the size of this array 108 // since construction of this object. When the size of this array
92 // reaches wait_count_, we're done. 109 // reaches wait_count_, we're done.
93 DownloadSet finished_downloads_; 110 DownloadSet finished_downloads_;
94 111
95 // The set of DownloadItem's we are currently observing. Generally there 112 // The set of DownloadItem's we are currently observing. Generally there
96 // won't be any overlap with the above; once we see the final state 113 // won't be any overlap with the above; once we see the final state
97 // on a DownloadItem, we'll stop observing it. 114 // on a DownloadItem, we'll stop observing it.
98 DownloadSet downloads_observed_; 115 DownloadSet downloads_observed_;
99 116
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 void PingIOThread(int cycle); 192 void PingIOThread(int cycle);
176 193
177 content::DownloadManager* download_manager_; 194 content::DownloadManager* download_manager_;
178 DownloadSet downloads_observed_; 195 DownloadSet downloads_observed_;
179 bool waiting_for_zero_inprogress_; 196 bool waiting_for_zero_inprogress_;
180 197
181 DISALLOW_COPY_AND_ASSIGN(DownloadTestFlushObserver); 198 DISALLOW_COPY_AND_ASSIGN(DownloadTestFlushObserver);
182 }; 199 };
183 200
184 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_OBSERVER_H_ 201 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_OBSERVER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/download_test_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698