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 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 IN_PROC_BROWSER_TEST_P(DownloadResumptionContentTest, | 1474 IN_PROC_BROWSER_TEST_P(DownloadResumptionContentTest, |
1475 RecoverFromInitFileError) { | 1475 RecoverFromInitFileError) { |
1476 TestDownloadRequestHandler request_handler; | 1476 TestDownloadRequestHandler request_handler; |
1477 request_handler.StartServing(TestDownloadRequestHandler::Parameters()); | 1477 request_handler.StartServing(TestDownloadRequestHandler::Parameters()); |
1478 | 1478 |
1479 // Setup the error injector. | 1479 // Setup the error injector. |
1480 scoped_refptr<TestFileErrorInjector> injector(TestFileErrorInjector::Create( | 1480 scoped_refptr<TestFileErrorInjector> injector(TestFileErrorInjector::Create( |
1481 DownloadManagerForShell(initiator_shell_for_resumption()))); | 1481 DownloadManagerForShell(initiator_shell_for_resumption()))); |
1482 | 1482 |
1483 const TestFileErrorInjector::FileErrorInfo err = { | 1483 const TestFileErrorInjector::FileErrorInfo err = { |
1484 request_handler.url().spec(), | |
1485 TestFileErrorInjector::FILE_OPERATION_INITIALIZE, 0, | 1484 TestFileErrorInjector::FILE_OPERATION_INITIALIZE, 0, |
1486 DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE}; | 1485 DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE}; |
1487 injector->AddError(err); | 1486 injector->AddError(err); |
1488 injector->InjectErrors(); | 1487 injector->InjectErrors(); |
1489 | 1488 |
1490 // Start and watch for interrupt. | 1489 // Start and watch for interrupt. |
1491 DownloadItem* download(StartDownloadAndReturnItem( | 1490 DownloadItem* download(StartDownloadAndReturnItem( |
1492 initiator_shell_for_resumption(), request_handler.url())); | 1491 initiator_shell_for_resumption(), request_handler.url())); |
1493 WaitForInterrupt(download); | 1492 WaitForInterrupt(download); |
1494 ASSERT_EQ(DownloadItem::INTERRUPTED, download->GetState()); | 1493 ASSERT_EQ(DownloadItem::INTERRUPTED, download->GetState()); |
(...skipping 24 matching lines...) Expand all Loading... |
1519 IN_PROC_BROWSER_TEST_P(DownloadResumptionContentTest, | 1518 IN_PROC_BROWSER_TEST_P(DownloadResumptionContentTest, |
1520 RecoverFromIntermediateFileRenameError) { | 1519 RecoverFromIntermediateFileRenameError) { |
1521 TestDownloadRequestHandler request_handler; | 1520 TestDownloadRequestHandler request_handler; |
1522 request_handler.StartServing(TestDownloadRequestHandler::Parameters()); | 1521 request_handler.StartServing(TestDownloadRequestHandler::Parameters()); |
1523 | 1522 |
1524 // Setup the error injector. | 1523 // Setup the error injector. |
1525 scoped_refptr<TestFileErrorInjector> injector(TestFileErrorInjector::Create( | 1524 scoped_refptr<TestFileErrorInjector> injector(TestFileErrorInjector::Create( |
1526 DownloadManagerForShell(initiator_shell_for_resumption()))); | 1525 DownloadManagerForShell(initiator_shell_for_resumption()))); |
1527 | 1526 |
1528 const TestFileErrorInjector::FileErrorInfo err = { | 1527 const TestFileErrorInjector::FileErrorInfo err = { |
1529 request_handler.url().spec(), | |
1530 TestFileErrorInjector::FILE_OPERATION_RENAME_UNIQUIFY, 0, | 1528 TestFileErrorInjector::FILE_OPERATION_RENAME_UNIQUIFY, 0, |
1531 DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE}; | 1529 DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE}; |
1532 injector->AddError(err); | 1530 injector->AddError(err); |
1533 injector->InjectErrors(); | 1531 injector->InjectErrors(); |
1534 | 1532 |
1535 // Start and watch for interrupt. | 1533 // Start and watch for interrupt. |
1536 DownloadItem* download(StartDownloadAndReturnItem( | 1534 DownloadItem* download(StartDownloadAndReturnItem( |
1537 initiator_shell_for_resumption(), request_handler.url())); | 1535 initiator_shell_for_resumption(), request_handler.url())); |
1538 WaitForInterrupt(download); | 1536 WaitForInterrupt(download); |
1539 ASSERT_EQ(DownloadItem::INTERRUPTED, download->GetState()); | 1537 ASSERT_EQ(DownloadItem::INTERRUPTED, download->GetState()); |
(...skipping 27 matching lines...) Expand all Loading... |
1567 TestDownloadRequestHandler request_handler; | 1565 TestDownloadRequestHandler request_handler; |
1568 request_handler.StartServing(TestDownloadRequestHandler::Parameters()); | 1566 request_handler.StartServing(TestDownloadRequestHandler::Parameters()); |
1569 | 1567 |
1570 // Setup the error injector. | 1568 // Setup the error injector. |
1571 scoped_refptr<TestFileErrorInjector> injector(TestFileErrorInjector::Create( | 1569 scoped_refptr<TestFileErrorInjector> injector(TestFileErrorInjector::Create( |
1572 DownloadManagerForShell(initiator_shell_for_resumption()))); | 1570 DownloadManagerForShell(initiator_shell_for_resumption()))); |
1573 | 1571 |
1574 DownloadManagerForShell(initiator_shell_for_resumption()) | 1572 DownloadManagerForShell(initiator_shell_for_resumption()) |
1575 ->RemoveAllDownloads(); | 1573 ->RemoveAllDownloads(); |
1576 TestFileErrorInjector::FileErrorInfo err = { | 1574 TestFileErrorInjector::FileErrorInfo err = { |
1577 request_handler.url().spec(), | |
1578 TestFileErrorInjector::FILE_OPERATION_RENAME_ANNOTATE, 0, | 1575 TestFileErrorInjector::FILE_OPERATION_RENAME_ANNOTATE, 0, |
1579 DOWNLOAD_INTERRUPT_REASON_FILE_FAILED}; | 1576 DOWNLOAD_INTERRUPT_REASON_FILE_FAILED}; |
1580 injector->AddError(err); | 1577 injector->AddError(err); |
1581 injector->InjectErrors(); | 1578 injector->InjectErrors(); |
1582 | 1579 |
1583 // Start and watch for interrupt. | 1580 // Start and watch for interrupt. |
1584 DownloadItem* download(StartDownloadAndReturnItem( | 1581 DownloadItem* download(StartDownloadAndReturnItem( |
1585 initiator_shell_for_resumption(), request_handler.url())); | 1582 initiator_shell_for_resumption(), request_handler.url())); |
1586 WaitForInterrupt(download); | 1583 WaitForInterrupt(download); |
1587 ASSERT_EQ(DownloadItem::INTERRUPTED, download->GetState()); | 1584 ASSERT_EQ(DownloadItem::INTERRUPTED, download->GetState()); |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2136 | 2133 |
2137 std::vector<DownloadItem*> downloads; | 2134 std::vector<DownloadItem*> downloads; |
2138 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); | 2135 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); |
2139 ASSERT_EQ(1u, downloads.size()); | 2136 ASSERT_EQ(1u, downloads.size()); |
2140 | 2137 |
2141 EXPECT_EQ(FILE_PATH_LITERAL("Jumboshrimp.txt"), | 2138 EXPECT_EQ(FILE_PATH_LITERAL("Jumboshrimp.txt"), |
2142 downloads[0]->GetTargetFilePath().BaseName().value()); | 2139 downloads[0]->GetTargetFilePath().BaseName().value()); |
2143 } | 2140 } |
2144 | 2141 |
2145 } // namespace content | 2142 } // namespace content |
OLD | NEW |