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 16 matching lines...) Expand all Loading... |
27 #include "content/public/test/browser_test_utils.h" | 27 #include "content/public/test/browser_test_utils.h" |
28 #include "content/public/test/content_browser_test.h" | 28 #include "content/public/test/content_browser_test.h" |
29 #include "content/public/test/content_browser_test_utils.h" | 29 #include "content/public/test/content_browser_test_utils.h" |
30 #include "content/public/test/download_test_observer.h" | 30 #include "content/public/test/download_test_observer.h" |
31 #include "content/public/test/test_file_error_injector.h" | 31 #include "content/public/test/test_file_error_injector.h" |
32 #include "content/public/test/test_utils.h" | 32 #include "content/public/test/test_utils.h" |
33 #include "content/shell/browser/shell.h" | 33 #include "content/shell/browser/shell.h" |
34 #include "content/shell/browser/shell_browser_context.h" | 34 #include "content/shell/browser/shell_browser_context.h" |
35 #include "content/shell/browser/shell_download_manager_delegate.h" | 35 #include "content/shell/browser/shell_download_manager_delegate.h" |
36 #include "content/shell/browser/shell_network_delegate.h" | 36 #include "content/shell/browser/shell_network_delegate.h" |
37 #include "content/test/net/url_request_mock_http_job.h" | |
38 #include "content/test/net/url_request_slow_download_job.h" | 37 #include "content/test/net/url_request_slow_download_job.h" |
39 #include "net/test/embedded_test_server/embedded_test_server.h" | 38 #include "net/test/embedded_test_server/embedded_test_server.h" |
40 #include "net/test/embedded_test_server/http_request.h" | 39 #include "net/test/embedded_test_server/http_request.h" |
41 #include "net/test/embedded_test_server/http_response.h" | 40 #include "net/test/embedded_test_server/http_response.h" |
42 #include "net/test/spawned_test_server/spawned_test_server.h" | 41 #include "net/test/spawned_test_server/spawned_test_server.h" |
| 42 #include "net/test/url_request/url_request_mock_http_job.h" |
43 #include "testing/gmock/include/gmock/gmock.h" | 43 #include "testing/gmock/include/gmock/gmock.h" |
44 #include "testing/gtest/include/gtest/gtest.h" | 44 #include "testing/gtest/include/gtest/gtest.h" |
45 #include "url/gurl.h" | 45 #include "url/gurl.h" |
46 | 46 |
47 using ::net::test_server::EmbeddedTestServer; | 47 using ::net::test_server::EmbeddedTestServer; |
48 using ::testing::AllOf; | 48 using ::testing::AllOf; |
49 using ::testing::Field; | 49 using ::testing::Field; |
50 using ::testing::InSequence; | 50 using ::testing::InSequence; |
51 using ::testing::Property; | 51 using ::testing::Property; |
52 using ::testing::Return; | 52 using ::testing::Return; |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 manager->GetDelegate()->Shutdown(); | 579 manager->GetDelegate()->Shutdown(); |
580 manager->SetDelegate(test_delegate_.get()); | 580 manager->SetDelegate(test_delegate_.get()); |
581 test_delegate_->SetDownloadManager(manager); | 581 test_delegate_->SetDownloadManager(manager); |
582 | 582 |
583 BrowserThread::PostTask( | 583 BrowserThread::PostTask( |
584 BrowserThread::IO, FROM_HERE, | 584 BrowserThread::IO, FROM_HERE, |
585 base::Bind(&URLRequestSlowDownloadJob::AddUrlHandler)); | 585 base::Bind(&URLRequestSlowDownloadJob::AddUrlHandler)); |
586 base::FilePath mock_base(GetTestFilePath("download", "")); | 586 base::FilePath mock_base(GetTestFilePath("download", "")); |
587 BrowserThread::PostTask( | 587 BrowserThread::PostTask( |
588 BrowserThread::IO, FROM_HERE, | 588 BrowserThread::IO, FROM_HERE, |
589 base::Bind(&URLRequestMockHTTPJob::AddUrlHandler, mock_base)); | 589 base::Bind( |
| 590 &net::URLRequestMockHTTPJob::AddUrlHandler, |
| 591 mock_base, |
| 592 content::BrowserThread::GetBlockingPool())); |
590 } | 593 } |
591 | 594 |
592 TestShellDownloadManagerDelegate* GetDownloadManagerDelegate() { | 595 TestShellDownloadManagerDelegate* GetDownloadManagerDelegate() { |
593 return test_delegate_.get(); | 596 return test_delegate_.get(); |
594 } | 597 } |
595 | 598 |
596 // Create a DownloadTestObserverTerminal that will wait for the | 599 // Create a DownloadTestObserverTerminal that will wait for the |
597 // specified number of downloads to finish. | 600 // specified number of downloads to finish. |
598 DownloadTestObserver* CreateWaiter( | 601 DownloadTestObserver* CreateWaiter( |
599 Shell* shell, int num_downloads) { | 602 Shell* shell, int num_downloads) { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 observer1->WaitForFinished(); | 794 observer1->WaitForFinished(); |
792 | 795 |
793 std::vector<DownloadItem*> downloads; | 796 std::vector<DownloadItem*> downloads; |
794 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); | 797 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); |
795 ASSERT_EQ(1u, downloads.size()); | 798 ASSERT_EQ(1u, downloads.size()); |
796 ASSERT_EQ(DownloadItem::IN_PROGRESS, downloads[0]->GetState()); | 799 ASSERT_EQ(DownloadItem::IN_PROGRESS, downloads[0]->GetState()); |
797 DownloadItem* download1 = downloads[0]; // The only download. | 800 DownloadItem* download1 = downloads[0]; // The only download. |
798 | 801 |
799 // Start the second download and wait until it's done. | 802 // Start the second download and wait until it's done. |
800 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); | 803 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); |
801 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); | 804 GURL url(net::URLRequestMockHTTPJob::GetMockUrl(file)); |
802 // Download the file and wait. | 805 // Download the file and wait. |
803 NavigateToURLAndWaitForDownload(shell(), url, DownloadItem::COMPLETE); | 806 NavigateToURLAndWaitForDownload(shell(), url, DownloadItem::COMPLETE); |
804 | 807 |
805 // Should now have 2 items on the manager. | 808 // Should now have 2 items on the manager. |
806 downloads.clear(); | 809 downloads.clear(); |
807 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); | 810 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); |
808 ASSERT_EQ(2u, downloads.size()); | 811 ASSERT_EQ(2u, downloads.size()); |
809 // We don't know the order of the downloads. | 812 // We don't know the order of the downloads. |
810 DownloadItem* download2 = downloads[(download1 == downloads[0]) ? 1 : 0]; | 813 DownloadItem* download2 = downloads[(download1 == downloads[0]) ? 1 : 0]; |
811 | 814 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 const char kTestMimeType[] = "application/x-test-mime-type"; | 849 const char kTestMimeType[] = "application/x-test-mime-type"; |
847 const char kTestFileType[] = "abc"; | 850 const char kTestFileType[] = "abc"; |
848 | 851 |
849 WebPluginInfo plugin_info; | 852 WebPluginInfo plugin_info; |
850 plugin_info.name = base::ASCIIToUTF16(kTestPluginName); | 853 plugin_info.name = base::ASCIIToUTF16(kTestPluginName); |
851 plugin_info.mime_types.push_back( | 854 plugin_info.mime_types.push_back( |
852 WebPluginMimeType(kTestMimeType, kTestFileType, "")); | 855 WebPluginMimeType(kTestMimeType, kTestFileType, "")); |
853 PluginServiceImpl::GetInstance()->RegisterInternalPlugin(plugin_info, false); | 856 PluginServiceImpl::GetInstance()->RegisterInternalPlugin(plugin_info, false); |
854 | 857 |
855 // The following is served with a Content-Type of application/octet-stream. | 858 // The following is served with a Content-Type of application/octet-stream. |
856 GURL url(URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kTestFilePath))); | 859 GURL url(net::URLRequestMockHTTPJob::GetMockUrl( |
| 860 base::FilePath(kTestFilePath))); |
857 NavigateToURLAndWaitForDownload(shell(), url, DownloadItem::COMPLETE); | 861 NavigateToURLAndWaitForDownload(shell(), url, DownloadItem::COMPLETE); |
858 } | 862 } |
859 #endif | 863 #endif |
860 | 864 |
861 // Try to cancel just before we release the download file, by delaying final | 865 // Try to cancel just before we release the download file, by delaying final |
862 // rename callback. | 866 // rename callback. |
863 IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelAtFinalRename) { | 867 IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelAtFinalRename) { |
864 // Setup new factory. | 868 // Setup new factory. |
865 DownloadFileWithDelayFactory* file_factory = | 869 DownloadFileWithDelayFactory* file_factory = |
866 new DownloadFileWithDelayFactory(); | 870 new DownloadFileWithDelayFactory(); |
867 DownloadManagerImpl* download_manager(DownloadManagerForShell(shell())); | 871 DownloadManagerImpl* download_manager(DownloadManagerForShell(shell())); |
868 download_manager->SetDownloadFileFactoryForTesting( | 872 download_manager->SetDownloadFileFactoryForTesting( |
869 scoped_ptr<DownloadFileFactory>(file_factory).Pass()); | 873 scoped_ptr<DownloadFileFactory>(file_factory).Pass()); |
870 | 874 |
871 // Create a download | 875 // Create a download |
872 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); | 876 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); |
873 NavigateToURL(shell(), URLRequestMockHTTPJob::GetMockUrl(file)); | 877 NavigateToURL(shell(), net::URLRequestMockHTTPJob::GetMockUrl(file)); |
874 | 878 |
875 // Wait until the first (intermediate file) rename and execute the callback. | 879 // Wait until the first (intermediate file) rename and execute the callback. |
876 file_factory->WaitForSomeCallback(); | 880 file_factory->WaitForSomeCallback(); |
877 std::vector<base::Closure> callbacks; | 881 std::vector<base::Closure> callbacks; |
878 file_factory->GetAllRenameCallbacks(&callbacks); | 882 file_factory->GetAllRenameCallbacks(&callbacks); |
879 ASSERT_EQ(1u, callbacks.size()); | 883 ASSERT_EQ(1u, callbacks.size()); |
880 callbacks[0].Run(); | 884 callbacks[0].Run(); |
881 callbacks.clear(); | 885 callbacks.clear(); |
882 | 886 |
883 // Wait until the second (final) rename callback is posted. | 887 // Wait until the second (final) rename callback is posted. |
(...skipping 28 matching lines...) Expand all Loading... |
912 GetDownloadManagerDelegate()->SetDelayedOpen(true); | 916 GetDownloadManagerDelegate()->SetDelayedOpen(true); |
913 | 917 |
914 // Setup new factory. | 918 // Setup new factory. |
915 DownloadFileWithDelayFactory* file_factory = | 919 DownloadFileWithDelayFactory* file_factory = |
916 new DownloadFileWithDelayFactory(); | 920 new DownloadFileWithDelayFactory(); |
917 download_manager->SetDownloadFileFactoryForTesting( | 921 download_manager->SetDownloadFileFactoryForTesting( |
918 scoped_ptr<DownloadFileFactory>(file_factory).Pass()); | 922 scoped_ptr<DownloadFileFactory>(file_factory).Pass()); |
919 | 923 |
920 // Create a download | 924 // Create a download |
921 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); | 925 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); |
922 NavigateToURL(shell(), URLRequestMockHTTPJob::GetMockUrl(file)); | 926 NavigateToURL(shell(), net::URLRequestMockHTTPJob::GetMockUrl(file)); |
923 | 927 |
924 // Wait until the first (intermediate file) rename and execute the callback. | 928 // Wait until the first (intermediate file) rename and execute the callback. |
925 file_factory->WaitForSomeCallback(); | 929 file_factory->WaitForSomeCallback(); |
926 std::vector<base::Closure> callbacks; | 930 std::vector<base::Closure> callbacks; |
927 file_factory->GetAllRenameCallbacks(&callbacks); | 931 file_factory->GetAllRenameCallbacks(&callbacks); |
928 ASSERT_EQ(1u, callbacks.size()); | 932 ASSERT_EQ(1u, callbacks.size()); |
929 callbacks[0].Run(); | 933 callbacks[0].Run(); |
930 callbacks.clear(); | 934 callbacks.clear(); |
931 | 935 |
932 // Wait until the second (final) rename callback is posted. | 936 // Wait until the second (final) rename callback is posted. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 GetDownloadManagerDelegate()->SetDelayedOpen(true); | 1026 GetDownloadManagerDelegate()->SetDelayedOpen(true); |
1023 | 1027 |
1024 // Setup new factory. | 1028 // Setup new factory. |
1025 DownloadFileWithDelayFactory* file_factory = | 1029 DownloadFileWithDelayFactory* file_factory = |
1026 new DownloadFileWithDelayFactory(); | 1030 new DownloadFileWithDelayFactory(); |
1027 download_manager->SetDownloadFileFactoryForTesting( | 1031 download_manager->SetDownloadFileFactoryForTesting( |
1028 scoped_ptr<DownloadFileFactory>(file_factory).Pass()); | 1032 scoped_ptr<DownloadFileFactory>(file_factory).Pass()); |
1029 | 1033 |
1030 // Create a download | 1034 // Create a download |
1031 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); | 1035 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); |
1032 NavigateToURL(shell(), URLRequestMockHTTPJob::GetMockUrl(file)); | 1036 NavigateToURL(shell(), net::URLRequestMockHTTPJob::GetMockUrl(file)); |
1033 | 1037 |
1034 // Wait until the first (intermediate file) rename and execute the callback. | 1038 // Wait until the first (intermediate file) rename and execute the callback. |
1035 file_factory->WaitForSomeCallback(); | 1039 file_factory->WaitForSomeCallback(); |
1036 std::vector<base::Closure> callbacks; | 1040 std::vector<base::Closure> callbacks; |
1037 file_factory->GetAllRenameCallbacks(&callbacks); | 1041 file_factory->GetAllRenameCallbacks(&callbacks); |
1038 ASSERT_EQ(1u, callbacks.size()); | 1042 ASSERT_EQ(1u, callbacks.size()); |
1039 callbacks[0].Run(); | 1043 callbacks[0].Run(); |
1040 callbacks.clear(); | 1044 callbacks.clear(); |
1041 | 1045 |
1042 // Wait until the second (final) rename callback is posted. | 1046 // Wait until the second (final) rename callback is posted. |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 {DownloadItem::COMPLETE, GetSafeBufferChunk() * 3}, | 1333 {DownloadItem::COMPLETE, GetSafeBufferChunk() * 3}, |
1330 }; | 1334 }; |
1331 | 1335 |
1332 recorder.CompareToExpectedRecord(expected_record, arraysize(expected_record)); | 1336 recorder.CompareToExpectedRecord(expected_record, arraysize(expected_record)); |
1333 } | 1337 } |
1334 | 1338 |
1335 IN_PROC_BROWSER_TEST_F(DownloadContentTest, ResumeWithFileInitError) { | 1339 IN_PROC_BROWSER_TEST_F(DownloadContentTest, ResumeWithFileInitError) { |
1336 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 1340 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
1337 switches::kEnableDownloadResumption); | 1341 switches::kEnableDownloadResumption); |
1338 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); | 1342 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); |
1339 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); | 1343 GURL url(net::URLRequestMockHTTPJob::GetMockUrl(file)); |
1340 | 1344 |
1341 // Setup the error injector. | 1345 // Setup the error injector. |
1342 scoped_refptr<TestFileErrorInjector> injector( | 1346 scoped_refptr<TestFileErrorInjector> injector( |
1343 TestFileErrorInjector::Create(DownloadManagerForShell(shell()))); | 1347 TestFileErrorInjector::Create(DownloadManagerForShell(shell()))); |
1344 | 1348 |
1345 TestFileErrorInjector::FileErrorInfo err = { | 1349 TestFileErrorInjector::FileErrorInfo err = { |
1346 url.spec(), | 1350 url.spec(), |
1347 TestFileErrorInjector::FILE_OPERATION_INITIALIZE, | 1351 TestFileErrorInjector::FILE_OPERATION_INITIALIZE, |
1348 0, | 1352 0, |
1349 DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE | 1353 DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE |
(...skipping 30 matching lines...) Expand all Loading... |
1380 download->Resume(); | 1384 download->Resume(); |
1381 completion_observer.WaitForEvent(); | 1385 completion_observer.WaitForEvent(); |
1382 EXPECT_EQ(download->GetState(), DownloadItem::COMPLETE); | 1386 EXPECT_EQ(download->GetState(), DownloadItem::COMPLETE); |
1383 } | 1387 } |
1384 | 1388 |
1385 IN_PROC_BROWSER_TEST_F(DownloadContentTest, | 1389 IN_PROC_BROWSER_TEST_F(DownloadContentTest, |
1386 ResumeWithFileIntermediateRenameError) { | 1390 ResumeWithFileIntermediateRenameError) { |
1387 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 1391 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
1388 switches::kEnableDownloadResumption); | 1392 switches::kEnableDownloadResumption); |
1389 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); | 1393 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); |
1390 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); | 1394 GURL url(net::URLRequestMockHTTPJob::GetMockUrl(file)); |
1391 | 1395 |
1392 // Setup the error injector. | 1396 // Setup the error injector. |
1393 scoped_refptr<TestFileErrorInjector> injector( | 1397 scoped_refptr<TestFileErrorInjector> injector( |
1394 TestFileErrorInjector::Create(DownloadManagerForShell(shell()))); | 1398 TestFileErrorInjector::Create(DownloadManagerForShell(shell()))); |
1395 | 1399 |
1396 TestFileErrorInjector::FileErrorInfo err = { | 1400 TestFileErrorInjector::FileErrorInfo err = { |
1397 url.spec(), | 1401 url.spec(), |
1398 TestFileErrorInjector::FILE_OPERATION_RENAME_UNIQUIFY, | 1402 TestFileErrorInjector::FILE_OPERATION_RENAME_UNIQUIFY, |
1399 0, | 1403 0, |
1400 DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE | 1404 DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 download, base::Bind(DownloadCompleteFilter)); | 1436 download, base::Bind(DownloadCompleteFilter)); |
1433 download->Resume(); | 1437 download->Resume(); |
1434 completion_observer.WaitForEvent(); | 1438 completion_observer.WaitForEvent(); |
1435 EXPECT_EQ(download->GetState(), DownloadItem::COMPLETE); | 1439 EXPECT_EQ(download->GetState(), DownloadItem::COMPLETE); |
1436 } | 1440 } |
1437 | 1441 |
1438 IN_PROC_BROWSER_TEST_F(DownloadContentTest, ResumeWithFileFinalRenameError) { | 1442 IN_PROC_BROWSER_TEST_F(DownloadContentTest, ResumeWithFileFinalRenameError) { |
1439 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 1443 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
1440 switches::kEnableDownloadResumption); | 1444 switches::kEnableDownloadResumption); |
1441 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); | 1445 base::FilePath file(FILE_PATH_LITERAL("download-test.lib")); |
1442 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); | 1446 GURL url(net::URLRequestMockHTTPJob::GetMockUrl(file)); |
1443 | 1447 |
1444 // Setup the error injector. | 1448 // Setup the error injector. |
1445 scoped_refptr<TestFileErrorInjector> injector( | 1449 scoped_refptr<TestFileErrorInjector> injector( |
1446 TestFileErrorInjector::Create(DownloadManagerForShell(shell()))); | 1450 TestFileErrorInjector::Create(DownloadManagerForShell(shell()))); |
1447 | 1451 |
1448 DownloadManagerForShell(shell())->RemoveAllDownloads(); | 1452 DownloadManagerForShell(shell())->RemoveAllDownloads(); |
1449 TestFileErrorInjector::FileErrorInfo err = { | 1453 TestFileErrorInjector::FileErrorInfo err = { |
1450 url.spec(), | 1454 url.spec(), |
1451 TestFileErrorInjector::FILE_OPERATION_RENAME_ANNOTATE, | 1455 TestFileErrorInjector::FILE_OPERATION_RENAME_ANNOTATE, |
1452 0, | 1456 0, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1547 | 1551 |
1548 // The intermediate file should now be gone. | 1552 // The intermediate file should now be gone. |
1549 EXPECT_FALSE(base::PathExists(intermediate_path)); | 1553 EXPECT_FALSE(base::PathExists(intermediate_path)); |
1550 } | 1554 } |
1551 | 1555 |
1552 // A completed download shouldn't delete the downloaded file when it is | 1556 // A completed download shouldn't delete the downloaded file when it is |
1553 // removed. | 1557 // removed. |
1554 { | 1558 { |
1555 // Start the second download and wait until it's done. | 1559 // Start the second download and wait until it's done. |
1556 base::FilePath file2(FILE_PATH_LITERAL("download-test.lib")); | 1560 base::FilePath file2(FILE_PATH_LITERAL("download-test.lib")); |
1557 GURL url2(URLRequestMockHTTPJob::GetMockUrl(file2)); | 1561 GURL url2(net::URLRequestMockHTTPJob::GetMockUrl(file2)); |
1558 scoped_ptr<DownloadTestObserver> completion_observer( | 1562 scoped_ptr<DownloadTestObserver> completion_observer( |
1559 CreateWaiter(shell(), 1)); | 1563 CreateWaiter(shell(), 1)); |
1560 DownloadItem* download(StartDownloadAndReturnItem(url2)); | 1564 DownloadItem* download(StartDownloadAndReturnItem(url2)); |
1561 completion_observer->WaitForFinished(); | 1565 completion_observer->WaitForFinished(); |
1562 | 1566 |
1563 // The target path should exist. | 1567 // The target path should exist. |
1564 base::FilePath target_path(download->GetTargetFilePath()); | 1568 base::FilePath target_path(download->GetTargetFilePath()); |
1565 EXPECT_TRUE(base::PathExists(target_path)); | 1569 EXPECT_TRUE(base::PathExists(target_path)); |
1566 download->Remove(); | 1570 download->Remove(); |
1567 RunAllPendingInMessageLoop(BrowserThread::FILE); | 1571 RunAllPendingInMessageLoop(BrowserThread::FILE); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 ASSERT_TRUE(test_server.InitializeAndWaitUntilReady()); | 1809 ASSERT_TRUE(test_server.InitializeAndWaitUntilReady()); |
1806 | 1810 |
1807 GURL url = test_server.GetURL("/empty.bin"); | 1811 GURL url = test_server.GetURL("/empty.bin"); |
1808 test_server.ServeFilesFromDirectory(GetTestFilePath("download", "")); | 1812 test_server.ServeFilesFromDirectory(GetTestFilePath("download", "")); |
1809 | 1813 |
1810 NavigateToURLAndWaitForDownload(shell(), url, DownloadItem::COMPLETE); | 1814 NavigateToURLAndWaitForDownload(shell(), url, DownloadItem::COMPLETE); |
1811 // That's it. This should work without crashing. | 1815 // That's it. This should work without crashing. |
1812 } | 1816 } |
1813 | 1817 |
1814 } // namespace content | 1818 } // namespace content |
OLD | NEW |