| 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 "chrome/browser/download/download_browsertest.h" | 5 #include "chrome/browser/download/download_browsertest.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 downloads_expected++; | 909 downloads_expected++; |
| 910 observer->WaitForFinished(); | 910 observer->WaitForFinished(); |
| 911 DownloadItem::DownloadState final_state = | 911 DownloadItem::DownloadState final_state = |
| 912 (download_info.reason == content::DOWNLOAD_INTERRUPT_REASON_NONE) ? | 912 (download_info.reason == content::DOWNLOAD_INTERRUPT_REASON_NONE) ? |
| 913 DownloadItem::COMPLETE : | 913 DownloadItem::COMPLETE : |
| 914 DownloadItem::INTERRUPTED; | 914 DownloadItem::INTERRUPTED; |
| 915 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(final_state)); | 915 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(final_state)); |
| 916 } | 916 } |
| 917 | 917 |
| 918 // Wait till the |DownloadFile|s are destroyed. | 918 // Wait till the |DownloadFile|s are destroyed. |
| 919 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); | 919 content::RunAllBlockingPoolTasksUntilIdle(); |
| 920 content::RunAllPendingInMessageLoop(content::BrowserThread::UI); | |
| 921 | 920 |
| 922 // Validate that the correct files were downloaded. | 921 // Validate that the correct files were downloaded. |
| 923 download_items.clear(); | 922 download_items.clear(); |
| 924 GetDownloads(browser(), &download_items); | 923 GetDownloads(browser(), &download_items); |
| 925 ASSERT_EQ(downloads_expected, download_items.size()); | 924 ASSERT_EQ(downloads_expected, download_items.size()); |
| 926 | 925 |
| 927 if (download_info.show_download_item) { | 926 if (download_info.show_download_item) { |
| 928 // Find the last download item. | 927 // Find the last download item. |
| 929 DownloadItem* item = download_items[0]; | 928 DownloadItem* item = download_items[0]; |
| 930 for (size_t d = 1; d < downloads_expected; ++d) { | 929 for (size_t d = 1; d < downloads_expected; ++d) { |
| (...skipping 2946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3877 browser(), 1, | 3876 browser(), 1, |
| 3878 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); | 3877 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); |
| 3879 ui_test_utils::NavigateToURL(browser(), extension_url); | 3878 ui_test_utils::NavigateToURL(browser(), extension_url); |
| 3880 | 3879 |
| 3881 observer->WaitForFinished(); | 3880 observer->WaitForFinished(); |
| 3882 | 3881 |
| 3883 // Download shelf should close. | 3882 // Download shelf should close. |
| 3884 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 3883 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
| 3885 } | 3884 } |
| 3886 #endif // defined(OS_CHROMEOS) | 3885 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |