| 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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 // Verify that the files have the expected data and size. | 768 // Verify that the files have the expected data and size. |
| 769 // |file1| should be full of '*'s, and |file2| should be the same as the | 769 // |file1| should be full of '*'s, and |file2| should be the same as the |
| 770 // source file. | 770 // source file. |
| 771 base::FilePath file1(download1->GetTargetFilePath()); | 771 base::FilePath file1(download1->GetTargetFilePath()); |
| 772 size_t file_size1 = URLRequestSlowDownloadJob::kFirstDownloadSize + | 772 size_t file_size1 = URLRequestSlowDownloadJob::kFirstDownloadSize + |
| 773 URLRequestSlowDownloadJob::kSecondDownloadSize; | 773 URLRequestSlowDownloadJob::kSecondDownloadSize; |
| 774 std::string expected_contents(file_size1, '*'); | 774 std::string expected_contents(file_size1, '*'); |
| 775 ASSERT_TRUE(VerifyFile(file1, expected_contents, file_size1)); | 775 ASSERT_TRUE(VerifyFile(file1, expected_contents, file_size1)); |
| 776 | 776 |
| 777 base::FilePath file2(download2->GetTargetFilePath()); | 777 base::FilePath file2(download2->GetTargetFilePath()); |
| 778 ASSERT_TRUE(file_util::ContentsEqual( | 778 ASSERT_TRUE(base::ContentsEqual( |
| 779 file2, GetTestFilePath("download", "download-test.lib"))); | 779 file2, GetTestFilePath("download", "download-test.lib"))); |
| 780 } | 780 } |
| 781 | 781 |
| 782 // Try to cancel just before we release the download file, by delaying final | 782 // Try to cancel just before we release the download file, by delaying final |
| 783 // rename callback. | 783 // rename callback. |
| 784 IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelAtFinalRename) { | 784 IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelAtFinalRename) { |
| 785 // Setup new factory. | 785 // Setup new factory. |
| 786 DownloadFileWithDelayFactory* file_factory = | 786 DownloadFileWithDelayFactory* file_factory = |
| 787 new DownloadFileWithDelayFactory(); | 787 new DownloadFileWithDelayFactory(); |
| 788 DownloadManagerImpl* download_manager(DownloadManagerForShell(shell())); | 788 DownloadManagerImpl* download_manager(DownloadManagerForShell(shell())); |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1567 // Start the second download and wait until it's done. The test server is | 1567 // Start the second download and wait until it's done. The test server is |
| 1568 // single threaded. The response to this download request should follow the | 1568 // single threaded. The response to this download request should follow the |
| 1569 // response to the previous resumption request. | 1569 // response to the previous resumption request. |
| 1570 GURL url2(test_server()->GetURL("rangereset?size=100&rst_limit=0&token=x")); | 1570 GURL url2(test_server()->GetURL("rangereset?size=100&rst_limit=0&token=x")); |
| 1571 DownloadAndWait(shell(), url2, DownloadItem::COMPLETE); | 1571 DownloadAndWait(shell(), url2, DownloadItem::COMPLETE); |
| 1572 | 1572 |
| 1573 EXPECT_TRUE(EnsureNoPendingDownloads()); | 1573 EXPECT_TRUE(EnsureNoPendingDownloads()); |
| 1574 } | 1574 } |
| 1575 | 1575 |
| 1576 } // namespace content | 1576 } // namespace content |
| OLD | NEW |