| 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 // This file contains download browser tests that are known to be runnable | 5 // This file contains download browser tests that are known to be runnable |
| 6 // in a pure content context. Over time tests should be migrated here. | 6 // in a pure content context. Over time tests should be migrated here. |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 CreateInProgressWaiter(shell(), 1)); | 694 CreateInProgressWaiter(shell(), 1)); |
| 695 NavigateToURL(shell(), GURL(URLRequestSlowDownloadJob::kUnknownSizeUrl)); | 695 NavigateToURL(shell(), GURL(URLRequestSlowDownloadJob::kUnknownSizeUrl)); |
| 696 observer->WaitForFinished(); | 696 observer->WaitForFinished(); |
| 697 | 697 |
| 698 std::vector<DownloadItem*> downloads; | 698 std::vector<DownloadItem*> downloads; |
| 699 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); | 699 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); |
| 700 ASSERT_EQ(1u, downloads.size()); | 700 ASSERT_EQ(1u, downloads.size()); |
| 701 ASSERT_EQ(DownloadItem::IN_PROGRESS, downloads[0]->GetState()); | 701 ASSERT_EQ(DownloadItem::IN_PROGRESS, downloads[0]->GetState()); |
| 702 | 702 |
| 703 // Cancel the download and wait for download system quiesce. | 703 // Cancel the download and wait for download system quiesce. |
| 704 downloads[0]->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); | 704 downloads[0]->Cancel(true); |
| 705 scoped_refptr<DownloadTestFlushObserver> flush_observer( | 705 scoped_refptr<DownloadTestFlushObserver> flush_observer( |
| 706 new DownloadTestFlushObserver(DownloadManagerForShell(shell()))); | 706 new DownloadTestFlushObserver(DownloadManagerForShell(shell()))); |
| 707 flush_observer->WaitForFlush(); | 707 flush_observer->WaitForFlush(); |
| 708 | 708 |
| 709 // Get the important info from other threads and check it. | 709 // Get the important info from other threads and check it. |
| 710 EXPECT_TRUE(EnsureNoPendingDownloads()); | 710 EXPECT_TRUE(EnsureNoPendingDownloads()); |
| 711 } | 711 } |
| 712 | 712 |
| 713 // Check that downloading multiple (in this case, 2) files does not result in | 713 // Check that downloading multiple (in this case, 2) files does not result in |
| 714 // corrupted files. | 714 // corrupted files. |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 // Start the second download and wait until it's done. | 1410 // Start the second download and wait until it's done. |
| 1411 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); | 1411 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); |
| 1412 GURL url2(URLRequestMockHTTPJob::GetMockUrl(file)); | 1412 GURL url2(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 1413 // Download the file and wait. | 1413 // Download the file and wait. |
| 1414 DownloadAndWait(shell(), url2, DownloadItem::COMPLETE); | 1414 DownloadAndWait(shell(), url2, DownloadItem::COMPLETE); |
| 1415 | 1415 |
| 1416 EXPECT_TRUE(EnsureNoPendingDownloads()); | 1416 EXPECT_TRUE(EnsureNoPendingDownloads()); |
| 1417 } | 1417 } |
| 1418 | 1418 |
| 1419 } // namespace content | 1419 } // namespace content |
| OLD | NEW |