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

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

Issue 629203002: Replace OVERRIDE and FINAL with override and final in content/public/[a-s]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 19 matching lines...) Expand all
30 virtual ~DownloadUpdatedObserver(); 30 virtual ~DownloadUpdatedObserver();
31 31
32 // Returns when either the event has been seen (at least once since 32 // Returns when either the event has been seen (at least once since
33 // object construction) or the item is destroyed. Return value indicates 33 // object construction) or the item is destroyed. Return value indicates
34 // if the wait ended because the item was seen (true) or the object 34 // if the wait ended because the item was seen (true) or the object
35 // destroyed (false). 35 // destroyed (false).
36 bool WaitForEvent(); 36 bool WaitForEvent();
37 37
38 private: 38 private:
39 // DownloadItem::Observer 39 // DownloadItem::Observer
40 virtual void OnDownloadUpdated(DownloadItem* item) OVERRIDE; 40 virtual void OnDownloadUpdated(DownloadItem* item) override;
41 virtual void OnDownloadDestroyed(DownloadItem* item) OVERRIDE; 41 virtual void OnDownloadDestroyed(DownloadItem* item) override;
42 42
43 DownloadItem* item_; 43 DownloadItem* item_;
44 EventFilter filter_; 44 EventFilter filter_;
45 bool waiting_; 45 bool waiting_;
46 bool event_seen_; 46 bool event_seen_;
47 47
48 DISALLOW_COPY_AND_ASSIGN(DownloadUpdatedObserver); 48 DISALLOW_COPY_AND_ASSIGN(DownloadUpdatedObserver);
49 }; 49 };
50 50
51 // Detects changes to the downloads after construction. 51 // Detects changes to the downloads after construction.
(...skipping 24 matching lines...) Expand all
76 76
77 virtual ~DownloadTestObserver(); 77 virtual ~DownloadTestObserver();
78 78
79 // Wait for one of the finish conditions. 79 // Wait for one of the finish conditions.
80 void WaitForFinished(); 80 void WaitForFinished();
81 81
82 // Return true if we reached one of the finish conditions. 82 // Return true if we reached one of the finish conditions.
83 bool IsFinished() const; 83 bool IsFinished() const;
84 84
85 // DownloadItem::Observer 85 // DownloadItem::Observer
86 virtual void OnDownloadUpdated(DownloadItem* download) OVERRIDE; 86 virtual void OnDownloadUpdated(DownloadItem* download) override;
87 virtual void OnDownloadDestroyed(DownloadItem* download) OVERRIDE; 87 virtual void OnDownloadDestroyed(DownloadItem* download) override;
88 88
89 // DownloadManager::Observer 89 // DownloadManager::Observer
90 virtual void OnDownloadCreated( 90 virtual void OnDownloadCreated(
91 DownloadManager* manager, DownloadItem* item) OVERRIDE; 91 DownloadManager* manager, DownloadItem* item) override;
92 virtual void ManagerGoingDown(DownloadManager* manager) OVERRIDE; 92 virtual void ManagerGoingDown(DownloadManager* manager) override;
93 93
94 size_t NumDangerousDownloadsSeen() const; 94 size_t NumDangerousDownloadsSeen() const;
95 95
96 size_t NumDownloadsSeenInState(DownloadItem::DownloadState state) const; 96 size_t NumDownloadsSeenInState(DownloadItem::DownloadState state) const;
97 97
98 protected: 98 protected:
99 // Only to be called by derived classes' constructors. 99 // Only to be called by derived classes' constructors.
100 virtual void Init(); 100 virtual void Init();
101 101
102 // Called to see if a download item is in a final state. 102 // Called to see if a download item is in a final state.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // download items have entered a terminal state (DownloadItem::IsDone() is 174 // download items have entered a terminal state (DownloadItem::IsDone() is
175 // true). 175 // true).
176 DownloadTestObserverTerminal( 176 DownloadTestObserverTerminal(
177 DownloadManager* download_manager, 177 DownloadManager* download_manager,
178 size_t wait_count, 178 size_t wait_count,
179 DangerousDownloadAction dangerous_download_action); 179 DangerousDownloadAction dangerous_download_action);
180 180
181 virtual ~DownloadTestObserverTerminal(); 181 virtual ~DownloadTestObserverTerminal();
182 182
183 private: 183 private:
184 virtual bool IsDownloadInFinalState(DownloadItem* download) OVERRIDE; 184 virtual bool IsDownloadInFinalState(DownloadItem* download) override;
185 185
186 DISALLOW_COPY_AND_ASSIGN(DownloadTestObserverTerminal); 186 DISALLOW_COPY_AND_ASSIGN(DownloadTestObserverTerminal);
187 }; 187 };
188 188
189 // Detects changes to the downloads after construction. 189 // Detects changes to the downloads after construction.
190 // Finishes when a specified number of downloads change to the 190 // Finishes when a specified number of downloads change to the
191 // IN_PROGRESS state, or when the download manager is destroyed. 191 // IN_PROGRESS state, or when the download manager is destroyed.
192 // Dangerous downloads are accepted. 192 // Dangerous downloads are accepted.
193 // Callers may either probe for the finished state, or wait on it. 193 // Callers may either probe for the finished state, or wait on it.
194 class DownloadTestObserverInProgress : public DownloadTestObserver { 194 class DownloadTestObserverInProgress : public DownloadTestObserver {
195 public: 195 public:
196 // Create an object that will be considered finished when |wait_count| 196 // Create an object that will be considered finished when |wait_count|
197 // download items have entered state |IN_PROGRESS|. 197 // download items have entered state |IN_PROGRESS|.
198 DownloadTestObserverInProgress( 198 DownloadTestObserverInProgress(
199 DownloadManager* download_manager, size_t wait_count); 199 DownloadManager* download_manager, size_t wait_count);
200 200
201 virtual ~DownloadTestObserverInProgress(); 201 virtual ~DownloadTestObserverInProgress();
202 202
203 private: 203 private:
204 virtual bool IsDownloadInFinalState(DownloadItem* download) OVERRIDE; 204 virtual bool IsDownloadInFinalState(DownloadItem* download) override;
205 205
206 DISALLOW_COPY_AND_ASSIGN(DownloadTestObserverInProgress); 206 DISALLOW_COPY_AND_ASSIGN(DownloadTestObserverInProgress);
207 }; 207 };
208 208
209 class DownloadTestObserverInterrupted : public DownloadTestObserver { 209 class DownloadTestObserverInterrupted : public DownloadTestObserver {
210 public: 210 public:
211 // Create an object that will be considered finished when |wait_count| 211 // Create an object that will be considered finished when |wait_count|
212 // download items are interrupted. 212 // download items are interrupted.
213 DownloadTestObserverInterrupted( 213 DownloadTestObserverInterrupted(
214 DownloadManager* download_manager, 214 DownloadManager* download_manager,
215 size_t wait_count, 215 size_t wait_count,
216 DangerousDownloadAction dangerous_download_action); 216 DangerousDownloadAction dangerous_download_action);
217 217
218 virtual ~DownloadTestObserverInterrupted(); 218 virtual ~DownloadTestObserverInterrupted();
219 219
220 private: 220 private:
221 virtual bool IsDownloadInFinalState(DownloadItem* download) OVERRIDE; 221 virtual bool IsDownloadInFinalState(DownloadItem* download) override;
222 222
223 DISALLOW_COPY_AND_ASSIGN(DownloadTestObserverInterrupted); 223 DISALLOW_COPY_AND_ASSIGN(DownloadTestObserverInterrupted);
224 }; 224 };
225 225
226 // The WaitForFlush() method on this class returns after: 226 // The WaitForFlush() method on this class returns after:
227 // * There are no IN_PROGRESS download items remaining on the 227 // * There are no IN_PROGRESS download items remaining on the
228 // DownloadManager. 228 // DownloadManager.
229 // * There have been two round trip messages through the file and 229 // * There have been two round trip messages through the file and
230 // IO threads. 230 // IO threads.
231 // This almost certainly means that a Download cancel has propagated through 231 // This almost certainly means that a Download cancel has propagated through
232 // the system. 232 // the system.
233 class DownloadTestFlushObserver 233 class DownloadTestFlushObserver
234 : public DownloadManager::Observer, 234 : public DownloadManager::Observer,
235 public DownloadItem::Observer, 235 public DownloadItem::Observer,
236 public base::RefCountedThreadSafe<DownloadTestFlushObserver> { 236 public base::RefCountedThreadSafe<DownloadTestFlushObserver> {
237 public: 237 public:
238 explicit DownloadTestFlushObserver(DownloadManager* download_manager); 238 explicit DownloadTestFlushObserver(DownloadManager* download_manager);
239 239
240 void WaitForFlush(); 240 void WaitForFlush();
241 241
242 // DownloadsManager observer methods. 242 // DownloadsManager observer methods.
243 virtual void OnDownloadCreated( 243 virtual void OnDownloadCreated(
244 DownloadManager* manager, 244 DownloadManager* manager,
245 DownloadItem* item) OVERRIDE; 245 DownloadItem* item) override;
246 246
247 // DownloadItem observer methods. 247 // DownloadItem observer methods.
248 virtual void OnDownloadUpdated(DownloadItem* download) OVERRIDE; 248 virtual void OnDownloadUpdated(DownloadItem* download) override;
249 virtual void OnDownloadDestroyed(DownloadItem* download) OVERRIDE; 249 virtual void OnDownloadDestroyed(DownloadItem* download) override;
250 250
251 protected: 251 protected:
252 friend class base::RefCountedThreadSafe<DownloadTestFlushObserver>; 252 friend class base::RefCountedThreadSafe<DownloadTestFlushObserver>;
253 253
254 virtual ~DownloadTestFlushObserver(); 254 virtual ~DownloadTestFlushObserver();
255 255
256 private: 256 private:
257 typedef std::set<DownloadItem*> DownloadSet; 257 typedef std::set<DownloadItem*> DownloadSet;
258 258
259 // If we're waiting for that flush point, check the number 259 // If we're waiting for that flush point, check the number
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 307
308 // We are in the message loop. 308 // We are in the message loop.
309 bool waiting_; 309 bool waiting_;
310 310
311 DISALLOW_COPY_AND_ASSIGN(DownloadTestItemCreationObserver); 311 DISALLOW_COPY_AND_ASSIGN(DownloadTestItemCreationObserver);
312 }; 312 };
313 313
314 } // namespace content` 314 } // namespace content`
315 315
316 #endif // CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_ 316 #endif // CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_
OLDNEW
« no previous file with comments | « content/public/test/content_test_suite_base.cc ('k') | content/public/test/fake_speech_recognition_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698