| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 2391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2402 GURL document_url = embedded_test_server()->GetURL( | 2402 GURL document_url = embedded_test_server()->GetURL( |
| 2403 "/download/download-attribute.html?target=about:version"); | 2403 "/download/download-attribute.html?target=about:version"); |
| 2404 DownloadItem* download = StartDownloadAndReturnItem(shell(), document_url); | 2404 DownloadItem* download = StartDownloadAndReturnItem(shell(), document_url); |
| 2405 WaitForInterrupt(download); | 2405 WaitForInterrupt(download); |
| 2406 | 2406 |
| 2407 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST, | 2407 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST, |
| 2408 download->GetLastReason()); | 2408 download->GetLastReason()); |
| 2409 EXPECT_FALSE(download->CanResume()); | 2409 EXPECT_FALSE(download->CanResume()); |
| 2410 } | 2410 } |
| 2411 | 2411 |
| 2412 IN_PROC_BROWSER_TEST_F(DownloadContentTest, DownloadAttributeBlobURL) { |
| 2413 ASSERT_TRUE(embedded_test_server()->Start()); |
| 2414 |
| 2415 GURL document_url = |
| 2416 embedded_test_server()->GetURL("/download/download-attribute-blob.html"); |
| 2417 DownloadItem* download = StartDownloadAndReturnItem(shell(), document_url); |
| 2418 WaitForCompletion(download); |
| 2419 |
| 2420 EXPECT_STREQ(FILE_PATH_LITERAL("suggested-filename.txt"), |
| 2421 download->GetTargetFilePath().BaseName().value().c_str()); |
| 2422 } |
| 2423 |
| 2412 // The file empty.bin is served with a MIME type of application/octet-stream. | 2424 // The file empty.bin is served with a MIME type of application/octet-stream. |
| 2413 // The content body is empty. Make sure this case is handled properly and we | 2425 // The content body is empty. Make sure this case is handled properly and we |
| 2414 // don't regress on http://crbug.com/320394. | 2426 // don't regress on http://crbug.com/320394. |
| 2415 IN_PROC_BROWSER_TEST_F(DownloadContentTest, DownloadGZipWithNoContent) { | 2427 IN_PROC_BROWSER_TEST_F(DownloadContentTest, DownloadGZipWithNoContent) { |
| 2416 GURL url = net::URLRequestMockHTTPJob::GetMockUrl("empty.bin"); | 2428 GURL url = net::URLRequestMockHTTPJob::GetMockUrl("empty.bin"); |
| 2417 NavigateToURLAndWaitForDownload(shell(), url, DownloadItem::COMPLETE); | 2429 NavigateToURLAndWaitForDownload(shell(), url, DownloadItem::COMPLETE); |
| 2418 // That's it. This should work without crashing. | 2430 // That's it. This should work without crashing. |
| 2419 } | 2431 } |
| 2420 | 2432 |
| 2421 // Make sure that sniffed MIME types are correctly passed through to the | 2433 // Make sure that sniffed MIME types are correctly passed through to the |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2442 | 2454 |
| 2443 std::vector<DownloadItem*> downloads; | 2455 std::vector<DownloadItem*> downloads; |
| 2444 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); | 2456 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); |
| 2445 ASSERT_EQ(1u, downloads.size()); | 2457 ASSERT_EQ(1u, downloads.size()); |
| 2446 | 2458 |
| 2447 EXPECT_EQ(FILE_PATH_LITERAL("Jumboshrimp.txt"), | 2459 EXPECT_EQ(FILE_PATH_LITERAL("Jumboshrimp.txt"), |
| 2448 downloads[0]->GetTargetFilePath().BaseName().value()); | 2460 downloads[0]->GetTargetFilePath().BaseName().value()); |
| 2449 } | 2461 } |
| 2450 | 2462 |
| 2451 } // namespace content | 2463 } // namespace content |
| OLD | NEW |