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); | 920 content::RunAllPendingInMessageLoop(content::BrowserThread::UI); |
gab
2017/07/20 16:54:31
Can remove this line too as RunAllBlockingPoolTask
Sigurður Ásgeirsson
2017/07/20 17:23:21
Done.
| |
921 | 921 |
922 // Validate that the correct files were downloaded. | 922 // Validate that the correct files were downloaded. |
923 download_items.clear(); | 923 download_items.clear(); |
924 GetDownloads(browser(), &download_items); | 924 GetDownloads(browser(), &download_items); |
925 ASSERT_EQ(downloads_expected, download_items.size()); | 925 ASSERT_EQ(downloads_expected, download_items.size()); |
926 | 926 |
927 if (download_info.show_download_item) { | 927 if (download_info.show_download_item) { |
928 // Find the last download item. | 928 // Find the last download item. |
929 DownloadItem* item = download_items[0]; | 929 DownloadItem* item = download_items[0]; |
930 for (size_t d = 1; d < downloads_expected; ++d) { | 930 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, | 3877 browser(), 1, |
3878 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); | 3878 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); |
3879 ui_test_utils::NavigateToURL(browser(), extension_url); | 3879 ui_test_utils::NavigateToURL(browser(), extension_url); |
3880 | 3880 |
3881 observer->WaitForFinished(); | 3881 observer->WaitForFinished(); |
3882 | 3882 |
3883 // Download shelf should close. | 3883 // Download shelf should close. |
3884 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 3884 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
3885 } | 3885 } |
3886 #endif // defined(OS_CHROMEOS) | 3886 #endif // defined(OS_CHROMEOS) |
OLD | NEW |