| 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 #include <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "chrome/browser/download/download_test_observer.h" | 11 #include "chrome/browser/download/download_test_observer.h" |
| 12 #include "chrome/test/base/ui_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 #include "content/public/browser/download_url_parameters.h" |
| 14 | 15 |
| 15 using content::BrowserThread; | 16 using content::BrowserThread; |
| 16 using content::DownloadItem; | 17 using content::DownloadItem; |
| 17 using content::DownloadManager; | 18 using content::DownloadManager; |
| 18 | 19 |
| 19 // These functions take scoped_refptr's to DownloadManager because they | 20 // These functions take scoped_refptr's to DownloadManager because they |
| 20 // are posted to message queues, and hence may execute arbitrarily after | 21 // are posted to message queues, and hence may execute arbitrarily after |
| 21 // their actual posting. Once posted, there is no connection between | 22 // their actual posting. Once posted, there is no connection between |
| 22 // these routines and the DownloadTestObserver class from which | 23 // these routines and the DownloadTestObserver class from which |
| 23 // they came, so the DownloadTestObserver's reference to the | 24 // they came, so the DownloadTestObserver's reference to the |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 388 |
| 388 download_id_ = download_id; | 389 download_id_ = download_id; |
| 389 error_ = error; | 390 error_ = error; |
| 390 ++called_back_count_; | 391 ++called_back_count_; |
| 391 DCHECK_EQ(1u, called_back_count_); | 392 DCHECK_EQ(1u, called_back_count_); |
| 392 | 393 |
| 393 if (waiting_) | 394 if (waiting_) |
| 394 MessageLoopForUI::current()->Quit(); | 395 MessageLoopForUI::current()->Quit(); |
| 395 } | 396 } |
| 396 | 397 |
| 397 const content::DownloadManager::OnStartedCallback | 398 const content::DownloadUrlParameters::OnStartedCallback |
| 398 DownloadTestItemCreationObserver::callback() { | 399 DownloadTestItemCreationObserver::callback() { |
| 399 return base::Bind( | 400 return base::Bind( |
| 400 &DownloadTestItemCreationObserver::DownloadItemCreationCallback, this); | 401 &DownloadTestItemCreationObserver::DownloadItemCreationCallback, this); |
| 401 } | 402 } |
| 402 | 403 |
| OLD | NEW |