| 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 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1790 std::vector<DownloadItem*> downloads; | 1790 std::vector<DownloadItem*> downloads; |
| 1791 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); | 1791 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); |
| 1792 ASSERT_EQ(1u, downloads.size()); | 1792 ASSERT_EQ(1u, downloads.size()); |
| 1793 | 1793 |
| 1794 EXPECT_EQ(FILE_PATH_LITERAL("suggested-filename"), | 1794 EXPECT_EQ(FILE_PATH_LITERAL("suggested-filename"), |
| 1795 downloads[0]->GetTargetFilePath().BaseName().value()); | 1795 downloads[0]->GetTargetFilePath().BaseName().value()); |
| 1796 ASSERT_TRUE(origin_one.ShutdownAndWaitUntilComplete()); | 1796 ASSERT_TRUE(origin_one.ShutdownAndWaitUntilComplete()); |
| 1797 ASSERT_TRUE(origin_two.ShutdownAndWaitUntilComplete()); | 1797 ASSERT_TRUE(origin_two.ShutdownAndWaitUntilComplete()); |
| 1798 } | 1798 } |
| 1799 | 1799 |
| 1800 // The file empty.bin is served with a MIME type of application/octet-stream. |
| 1801 // The content body is empty. Make sure this case is handled properly and we |
| 1802 // don't regress on http://crbug.com/320394. |
| 1803 IN_PROC_BROWSER_TEST_F(DownloadContentTest, DownloadGZipWithNoContent) { |
| 1804 EmbeddedTestServer test_server; |
| 1805 ASSERT_TRUE(test_server.InitializeAndWaitUntilReady()); |
| 1806 |
| 1807 GURL url = test_server.GetURL("/empty.bin"); |
| 1808 test_server.ServeFilesFromDirectory(GetTestFilePath("download", "")); |
| 1809 |
| 1810 NavigateToURLAndWaitForDownload(shell(), url, DownloadItem::COMPLETE); |
| 1811 // That's it. This should work without crashing. |
| 1812 } |
| 1813 |
| 1800 } // namespace content | 1814 } // namespace content |
| OLD | NEW |