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

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

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 unified diff | Download patch | Annotate | Revision Log
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 CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_ 5 #ifndef CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_
6 #define CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_ 6 #define CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 std::set<int32> dangerous_downloads_seen_; 163 std::set<int32> dangerous_downloads_seen_;
164 164
165 base::WeakPtrFactory<DownloadTestObserver> weak_factory_; 165 base::WeakPtrFactory<DownloadTestObserver> weak_factory_;
166 166
167 DISALLOW_COPY_AND_ASSIGN(DownloadTestObserver); 167 DISALLOW_COPY_AND_ASSIGN(DownloadTestObserver);
168 }; 168 };
169 169
170 class DownloadTestObserverTerminal : public DownloadTestObserver { 170 class DownloadTestObserverTerminal : public DownloadTestObserver {
171 public: 171 public:
172 // Create an object that will be considered finished when |wait_count| 172 // Create an object that will be considered finished when |wait_count|
173 // download items have entered a terminal state (any but IN_PROGRESS). 173 // download items have entered a terminal state (DownloadItem::IsDone() is
174 // true).
174 DownloadTestObserverTerminal( 175 DownloadTestObserverTerminal(
175 DownloadManager* download_manager, 176 DownloadManager* download_manager,
176 size_t wait_count, 177 size_t wait_count,
177 DangerousDownloadAction dangerous_download_action); 178 DangerousDownloadAction dangerous_download_action);
178 179
179 virtual ~DownloadTestObserverTerminal(); 180 virtual ~DownloadTestObserverTerminal();
180 181
181 private: 182 private:
182 virtual bool IsDownloadInFinalState(DownloadItem* download) OVERRIDE; 183 virtual bool IsDownloadInFinalState(DownloadItem* download) OVERRIDE;
183 184
(...skipping 13 matching lines...) Expand all
197 DownloadManager* download_manager, size_t wait_count); 198 DownloadManager* download_manager, size_t wait_count);
198 199
199 virtual ~DownloadTestObserverInProgress(); 200 virtual ~DownloadTestObserverInProgress();
200 201
201 private: 202 private:
202 virtual bool IsDownloadInFinalState(DownloadItem* download) OVERRIDE; 203 virtual bool IsDownloadInFinalState(DownloadItem* download) OVERRIDE;
203 204
204 DISALLOW_COPY_AND_ASSIGN(DownloadTestObserverInProgress); 205 DISALLOW_COPY_AND_ASSIGN(DownloadTestObserverInProgress);
205 }; 206 };
206 207
208 class DownloadTestObserverInterrupted : public DownloadTestObserver {
209 public:
210 // Create an object that will be considered finished when |wait_count|
211 // download items are interrupted.
212 DownloadTestObserverInterrupted(
213 DownloadManager* download_manager,
214 size_t wait_count,
215 DangerousDownloadAction dangerous_download_action);
216
217 virtual ~DownloadTestObserverInterrupted();
218
219 private:
220 virtual bool IsDownloadInFinalState(DownloadItem* download) OVERRIDE;
221
222 DISALLOW_COPY_AND_ASSIGN(DownloadTestObserverInterrupted);
223 };
224
207 // The WaitForFlush() method on this class returns after: 225 // The WaitForFlush() method on this class returns after:
208 // * There are no IN_PROGRESS download items remaining on the 226 // * There are no IN_PROGRESS download items remaining on the
209 // DownloadManager. 227 // DownloadManager.
210 // * There have been two round trip messages through the file and 228 // * There have been two round trip messages through the file and
211 // IO threads. 229 // IO threads.
212 // This almost certainly means that a Download cancel has propagated through 230 // This almost certainly means that a Download cancel has propagated through
213 // the system. 231 // the system.
214 class DownloadTestFlushObserver 232 class DownloadTestFlushObserver
215 : public DownloadManager::Observer, 233 : public DownloadManager::Observer,
216 public DownloadItem::Observer, 234 public DownloadItem::Observer,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 303
286 // We are in the message loop. 304 // We are in the message loop.
287 bool waiting_; 305 bool waiting_;
288 306
289 DISALLOW_COPY_AND_ASSIGN(DownloadTestItemCreationObserver); 307 DISALLOW_COPY_AND_ASSIGN(DownloadTestItemCreationObserver);
290 }; 308 };
291 309
292 } // namespace content` 310 } // namespace content`
293 311
294 #endif // CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_ 312 #endif // CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_browsertest.cc ('k') | content/public/test/download_test_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698