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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/download/download_service.h" | 10 #include "chrome/browser/download/download_service.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 void CreateStalledDownloads(Browser* browser, int num_downloads) { | 107 void CreateStalledDownloads(Browser* browser, int num_downloads) { |
108 GURL url(URLRequestSlowDownloadJob::kKnownSizeUrl); | 108 GURL url(URLRequestSlowDownloadJob::kKnownSizeUrl); |
109 | 109 |
110 if (num_downloads == 0) | 110 if (num_downloads == 0) |
111 return; | 111 return; |
112 | 112 |
113 // Setup an observer waiting for the given number of downloads | 113 // Setup an observer waiting for the given number of downloads |
114 // to get to IN_PROGRESS. | 114 // to get to IN_PROGRESS. |
115 DownloadManager* download_manager = | 115 DownloadManager* download_manager = |
116 browser->profile()->GetDownloadManager(); | 116 browser->profile()->GetDownloadManager(); |
117 scoped_ptr<DownloadTestObserver> observer( | 117 scoped_ptr<DownloadTestObserverInProgress> observer( |
118 new DownloadTestObserver( | 118 new DownloadTestObserverInProgress(download_manager, num_downloads)); |
119 download_manager, num_downloads, | |
120 DownloadItem::IN_PROGRESS, | |
121 true, // Bail on select file. | |
122 DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL)); | |
123 | 119 |
124 // Set of that number of downloads. | 120 // Set of that number of downloads. |
125 while (num_downloads--) | 121 while (num_downloads--) |
126 ui_test_utils::NavigateToURLWithDisposition( | 122 ui_test_utils::NavigateToURLWithDisposition( |
127 browser, url, NEW_BACKGROUND_TAB, | 123 browser, url, NEW_BACKGROUND_TAB, |
128 ui_test_utils::BROWSER_TEST_NONE); | 124 ui_test_utils::BROWSER_TEST_NONE); |
129 | 125 |
130 // Wait for them. | 126 // Wait for them. |
131 observer->WaitForFinished(); | 127 observer->WaitForFinished(); |
132 } | 128 } |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 #define MAYBE_DownloadsCloseCheck_5 DownloadsCloseCheck_5 | 550 #define MAYBE_DownloadsCloseCheck_5 DownloadsCloseCheck_5 |
555 #endif | 551 #endif |
556 | 552 |
557 IN_PROC_BROWSER_TEST_F(BrowserCloseTest, MAYBE_DownloadsCloseCheck_5) { | 553 IN_PROC_BROWSER_TEST_F(BrowserCloseTest, MAYBE_DownloadsCloseCheck_5) { |
558 ASSERT_TRUE(SetupForDownloadCloseCheck()); | 554 ASSERT_TRUE(SetupForDownloadCloseCheck()); |
559 for (size_t i = 5 * arraysize(download_close_check_cases) / 6; | 555 for (size_t i = 5 * arraysize(download_close_check_cases) / 6; |
560 i < 6 * arraysize(download_close_check_cases) / 6; ++i) { | 556 i < 6 * arraysize(download_close_check_cases) / 6; ++i) { |
561 ExecuteDownloadCloseCheckCase(i); | 557 ExecuteDownloadCloseCheckCase(i); |
562 } | 558 } |
563 } | 559 } |
OLD | NEW |