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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 DownloadManager* manager = DownloadManagerForShell(shell()); | 579 DownloadManager* manager = DownloadManagerForShell(shell()); |
580 manager->GetDelegate()->Shutdown(); | 580 manager->GetDelegate()->Shutdown(); |
581 manager->SetDelegate(test_delegate_.get()); | 581 manager->SetDelegate(test_delegate_.get()); |
582 test_delegate_->SetDownloadManager(manager); | 582 test_delegate_->SetDownloadManager(manager); |
583 | 583 |
584 BrowserThread::PostTask( | 584 BrowserThread::PostTask( |
585 BrowserThread::IO, FROM_HERE, | 585 BrowserThread::IO, FROM_HERE, |
586 base::Bind(&net::URLRequestSlowDownloadJob::AddUrlHandler)); | 586 base::Bind(&net::URLRequestSlowDownloadJob::AddUrlHandler)); |
587 base::FilePath mock_base(GetTestFilePath("download", "")); | 587 base::FilePath mock_base(GetTestFilePath("download", "")); |
588 BrowserThread::PostTask( | 588 BrowserThread::PostTask( |
589 BrowserThread::IO, | 589 BrowserThread::IO, FROM_HERE, |
590 FROM_HERE, | |
591 base::Bind( | 590 base::Bind( |
592 &net::URLRequestMockHTTPJob::AddUrlHandler, | 591 &net::URLRequestMockHTTPJob::AddUrlHandlers, mock_base, |
593 mock_base, | |
594 make_scoped_refptr(content::BrowserThread::GetBlockingPool()))); | 592 make_scoped_refptr(content::BrowserThread::GetBlockingPool()))); |
595 } | 593 } |
596 | 594 |
597 TestShellDownloadManagerDelegate* GetDownloadManagerDelegate() { | 595 TestShellDownloadManagerDelegate* GetDownloadManagerDelegate() { |
598 return test_delegate_.get(); | 596 return test_delegate_.get(); |
599 } | 597 } |
600 | 598 |
601 // Create a DownloadTestObserverTerminal that will wait for the | 599 // Create a DownloadTestObserverTerminal that will wait for the |
602 // specified number of downloads to finish. | 600 // specified number of downloads to finish. |
603 DownloadTestObserver* CreateWaiter( | 601 DownloadTestObserver* CreateWaiter( |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 ASSERT_TRUE(test_server.InitializeAndWaitUntilReady()); | 1810 ASSERT_TRUE(test_server.InitializeAndWaitUntilReady()); |
1813 | 1811 |
1814 GURL url = test_server.GetURL("/empty.bin"); | 1812 GURL url = test_server.GetURL("/empty.bin"); |
1815 test_server.ServeFilesFromDirectory(GetTestFilePath("download", "")); | 1813 test_server.ServeFilesFromDirectory(GetTestFilePath("download", "")); |
1816 | 1814 |
1817 NavigateToURLAndWaitForDownload(shell(), url, DownloadItem::COMPLETE); | 1815 NavigateToURLAndWaitForDownload(shell(), url, DownloadItem::COMPLETE); |
1818 // That's it. This should work without crashing. | 1816 // That's it. This should work without crashing. |
1819 } | 1817 } |
1820 | 1818 |
1821 } // namespace content | 1819 } // namespace content |
OLD | NEW |