| 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 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 #include <vector> | 10 #include <vector> |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 public: | 248 public: |
| 249 DownloadTestItemCreationObserver(); | 249 DownloadTestItemCreationObserver(); |
| 250 | 250 |
| 251 void WaitForDownloadItemCreation(); | 251 void WaitForDownloadItemCreation(); |
| 252 | 252 |
| 253 content::DownloadId download_id() const { return download_id_; } | 253 content::DownloadId download_id() const { return download_id_; } |
| 254 net::Error error() const { return error_; } | 254 net::Error error() const { return error_; } |
| 255 bool started() const { return called_back_count_ > 0; } | 255 bool started() const { return called_back_count_ > 0; } |
| 256 bool succeeded() const { return started() && (error_ == net::OK); } | 256 bool succeeded() const { return started() && (error_ == net::OK); } |
| 257 | 257 |
| 258 const content::DownloadManager::OnStartedCallback callback(); | 258 const content::DownloadUrlParameters::OnStartedCallback callback(); |
| 259 | 259 |
| 260 private: | 260 private: |
| 261 friend class base::RefCountedThreadSafe<DownloadTestItemCreationObserver>; | 261 friend class base::RefCountedThreadSafe<DownloadTestItemCreationObserver>; |
| 262 | 262 |
| 263 ~DownloadTestItemCreationObserver(); | 263 ~DownloadTestItemCreationObserver(); |
| 264 | 264 |
| 265 void DownloadItemCreationCallback(content::DownloadId download_id, | 265 void DownloadItemCreationCallback(content::DownloadId download_id, |
| 266 net::Error error); | 266 net::Error error); |
| 267 | 267 |
| 268 // The download creation information we received. | 268 // The download creation information we received. |
| 269 content::DownloadId download_id_; | 269 content::DownloadId download_id_; |
| 270 | 270 |
| 271 net::Error error_; | 271 net::Error error_; |
| 272 | 272 |
| 273 // Count of callbacks. | 273 // Count of callbacks. |
| 274 size_t called_back_count_; | 274 size_t called_back_count_; |
| 275 | 275 |
| 276 // We are in the message loop. | 276 // We are in the message loop. |
| 277 bool waiting_; | 277 bool waiting_; |
| 278 | 278 |
| 279 DISALLOW_COPY_AND_ASSIGN(DownloadTestItemCreationObserver); | 279 DISALLOW_COPY_AND_ASSIGN(DownloadTestItemCreationObserver); |
| 280 }; | 280 }; |
| 281 | 281 |
| 282 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_OBSERVER_H_ | 282 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_OBSERVER_H_ |
| OLD | NEW |