OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/task.h" | 10 #include "base/task.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 | 14 |
| 15 using content::BrowserThread; |
| 16 |
15 // These functions take scoped_refptr's to DownloadManager because they | 17 // These functions take scoped_refptr's to DownloadManager because they |
16 // are posted to message queues, and hence may execute arbitrarily after | 18 // are posted to message queues, and hence may execute arbitrarily after |
17 // their actual posting. Once posted, there is no connection between | 19 // their actual posting. Once posted, there is no connection between |
18 // these routines and the DownloadTestObserver class from which they came, | 20 // these routines and the DownloadTestObserver class from which they came, |
19 // so the DownloadTestObserver's reference to the DownloadManager cannot | 21 // so the DownloadTestObserver's reference to the DownloadManager cannot |
20 // be counted on to keep the DownloadManager around. | 22 // be counted on to keep the DownloadManager around. |
21 | 23 |
22 // Fake user click on "Accept". | 24 // Fake user click on "Accept". |
23 void AcceptDangerousDownload(scoped_refptr<DownloadManager> download_manager, | 25 void AcceptDangerousDownload(scoped_refptr<DownloadManager> download_manager, |
24 int32 download_id) { | 26 int32 download_id) { |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 if (--cycle) { | 290 if (--cycle) { |
289 BrowserThread::PostTask( | 291 BrowserThread::PostTask( |
290 BrowserThread::UI, FROM_HERE, | 292 BrowserThread::UI, FROM_HERE, |
291 NewRunnableMethod(this, &DownloadTestFlushObserver::PingFileThread, | 293 NewRunnableMethod(this, &DownloadTestFlushObserver::PingFileThread, |
292 cycle)); | 294 cycle)); |
293 } else { | 295 } else { |
294 BrowserThread::PostTask( | 296 BrowserThread::PostTask( |
295 BrowserThread::UI, FROM_HERE, new MessageLoop::QuitTask()); | 297 BrowserThread::UI, FROM_HERE, new MessageLoop::QuitTask()); |
296 } | 298 } |
297 } | 299 } |
OLD | NEW |