| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/scoped_temp_dir.h" | 8 #include "base/scoped_temp_dir.h" |
| 9 #include "base/test/test_file_util.h" | 9 #include "base/test/test_file_util.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // finished_downloads_ (done by OnDownloadUpdated). | 115 // finished_downloads_ (done by OnDownloadUpdated). |
| 116 std::vector<DownloadItem*> downloads; | 116 std::vector<DownloadItem*> downloads; |
| 117 download_manager_->SearchDownloads(string16(), &downloads); | 117 download_manager_->SearchDownloads(string16(), &downloads); |
| 118 | 118 |
| 119 std::vector<DownloadItem*>::iterator it = downloads.begin(); | 119 std::vector<DownloadItem*>::iterator it = downloads.begin(); |
| 120 for (; it != downloads.end(); ++it) { | 120 for (; it != downloads.end(); ++it) { |
| 121 OnDownloadUpdated(*it); // Safe to call multiple times; checks state. | 121 OnDownloadUpdated(*it); // Safe to call multiple times; checks state. |
| 122 | 122 |
| 123 std::set<DownloadItem*>::const_iterator | 123 std::set<DownloadItem*>::const_iterator |
| 124 finished_it(finished_downloads_.find(*it)); | 124 finished_it(finished_downloads_.find(*it)); |
| 125 std::set<DownloadItem*>::const_iterator | 125 std::set<DownloadItem*>::iterator |
| 126 observed_it(downloads_observed_.find(*it)); | 126 observed_it(downloads_observed_.find(*it)); |
| 127 | 127 |
| 128 // If it isn't finished and we're aren't observing it, start. | 128 // If it isn't finished and we're aren't observing it, start. |
| 129 if (finished_it == finished_downloads_.end() && | 129 if (finished_it == finished_downloads_.end() && |
| 130 observed_it == downloads_observed_.end()) { | 130 observed_it == downloads_observed_.end()) { |
| 131 (*it)->AddObserver(this); | 131 (*it)->AddObserver(this); |
| 132 downloads_observed_.insert(*it); | 132 downloads_observed_.insert(*it); |
| 133 continue; | 133 continue; |
| 134 } | 134 } |
| 135 | 135 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 browser(), URLRequestMockHTTPJob::GetMockUrl(file)); | 329 browser(), URLRequestMockHTTPJob::GetMockUrl(file)); |
| 330 observer->WaitForFinished(); | 330 observer->WaitForFinished(); |
| 331 | 331 |
| 332 // Download should not be finished; check state. | 332 // Download should not be finished; check state. |
| 333 EXPECT_TRUE(observer->select_file_dialog_seen()); | 333 EXPECT_TRUE(observer->select_file_dialog_seen()); |
| 334 EXPECT_EQ(1, browser()->tab_count()); | 334 EXPECT_EQ(1, browser()->tab_count()); |
| 335 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 335 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
| 336 } | 336 } |
| 337 | 337 |
| 338 } // namespace | 338 } // namespace |
| OLD | NEW |