OLD | NEW |
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // | 57 // |
58 // Callers may either probe for the finished state, or wait on it. | 58 // Callers may either probe for the finished state, or wait on it. |
59 class DownloadTestObserver : public DownloadManager::Observer, | 59 class DownloadTestObserver : public DownloadManager::Observer, |
60 public DownloadItem::Observer { | 60 public DownloadItem::Observer { |
61 public: | 61 public: |
62 // Action an observer should take if a dangerous download is encountered. | 62 // Action an observer should take if a dangerous download is encountered. |
63 enum DangerousDownloadAction { | 63 enum DangerousDownloadAction { |
64 ON_DANGEROUS_DOWNLOAD_ACCEPT, // Accept the download | 64 ON_DANGEROUS_DOWNLOAD_ACCEPT, // Accept the download |
65 ON_DANGEROUS_DOWNLOAD_DENY, // Deny the download | 65 ON_DANGEROUS_DOWNLOAD_DENY, // Deny the download |
66 ON_DANGEROUS_DOWNLOAD_FAIL, // Fail if a dangerous download is seen | 66 ON_DANGEROUS_DOWNLOAD_FAIL, // Fail if a dangerous download is seen |
67 ON_DANGEROUS_DOWNLOAD_IGNORE // Make it the callers problem. | 67 ON_DANGEROUS_DOWNLOAD_IGNORE, // Make it the callers problem. |
| 68 ON_DANGEROUS_DOWNLOAD_QUIT // Will set final state without decision. |
68 }; | 69 }; |
69 | 70 |
70 // Create an object that will be considered finished when |wait_count| | 71 // Create an object that will be considered finished when |wait_count| |
71 // download items have entered a terminal state. | 72 // download items have entered a terminal state. |
72 DownloadTestObserver(DownloadManager* download_manager, | 73 DownloadTestObserver(DownloadManager* download_manager, |
73 size_t wait_count, | 74 size_t wait_count, |
74 DangerousDownloadAction dangerous_download_action); | 75 DangerousDownloadAction dangerous_download_action); |
75 | 76 |
76 virtual ~DownloadTestObserver(); | 77 virtual ~DownloadTestObserver(); |
77 | 78 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 304 |
304 // We are in the message loop. | 305 // We are in the message loop. |
305 bool waiting_; | 306 bool waiting_; |
306 | 307 |
307 DISALLOW_COPY_AND_ASSIGN(DownloadTestItemCreationObserver); | 308 DISALLOW_COPY_AND_ASSIGN(DownloadTestItemCreationObserver); |
308 }; | 309 }; |
309 | 310 |
310 } // namespace content` | 311 } // namespace content` |
311 | 312 |
312 #endif // CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_ | 313 #endif // CONTENT_TEST_DOWNLOAD_TEST_OBSERVER_H_ |
OLD | NEW |