| 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 #include "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "content/browser/download/download_file_factory.h" | 8 #include "content/browser/download/download_file_factory.h" |
| 9 #include "content/browser/download/download_file_impl.h" | 9 #include "content/browser/download/download_file_impl.h" |
| 10 #include "content/browser/download/download_item_impl.h" | 10 #include "content/browser/download/download_item_impl.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 ShellDownloadManagerDelegate* delegate = | 66 ShellDownloadManagerDelegate* delegate = |
| 67 static_cast<ShellDownloadManagerDelegate*>( | 67 static_cast<ShellDownloadManagerDelegate*>( |
| 68 shell()->web_contents()->GetBrowserContext() | 68 shell()->web_contents()->GetBrowserContext() |
| 69 ->GetDownloadManagerDelegate()); | 69 ->GetDownloadManagerDelegate()); |
| 70 delegate->SetDownloadBehaviorForTesting(downloads_directory()); | 70 delegate->SetDownloadBehaviorForTesting(downloads_directory()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void SetUpServer() { | 73 void SetUpServer() { |
| 74 base::FilePath mock_base(GetTestFilePath("download", "")); | 74 base::FilePath mock_base(GetTestFilePath("download", "")); |
| 75 BrowserThread::PostTask( | 75 BrowserThread::PostTask( |
| 76 BrowserThread::IO, | 76 BrowserThread::IO, FROM_HERE, |
| 77 FROM_HERE, | |
| 78 base::Bind( | 77 base::Bind( |
| 79 &net::URLRequestMockHTTPJob::AddUrlHandler, | 78 &net::URLRequestMockHTTPJob::AddUrlHandlers, mock_base, |
| 80 mock_base, | |
| 81 make_scoped_refptr(content::BrowserThread::GetBlockingPool()))); | 79 make_scoped_refptr(content::BrowserThread::GetBlockingPool()))); |
| 82 } | 80 } |
| 83 | 81 |
| 84 const base::FilePath& downloads_directory() const { | 82 const base::FilePath& downloads_directory() const { |
| 85 return downloads_directory_.path(); | 83 return downloads_directory_.path(); |
| 86 } | 84 } |
| 87 | 85 |
| 88 private: | 86 private: |
| 89 base::ScopedTempDir downloads_directory_; | 87 base::ScopedTempDir downloads_directory_; |
| 90 | 88 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 .WillOnce(InvokeWithoutArgs(this, &DragDownloadFileTest::Succeed)); | 126 .WillOnce(InvokeWithoutArgs(this, &DragDownloadFileTest::Succeed)); |
| 129 ON_CALL(*observer.get(), OnDownloadAborted()) | 127 ON_CALL(*observer.get(), OnDownloadAborted()) |
| 130 .WillByDefault(InvokeWithoutArgs(this, &DragDownloadFileTest::FailFast)); | 128 .WillByDefault(InvokeWithoutArgs(this, &DragDownloadFileTest::FailFast)); |
| 131 file->Start(observer.get()); | 129 file->Start(observer.get()); |
| 132 RunMessageLoop(); | 130 RunMessageLoop(); |
| 133 } | 131 } |
| 134 | 132 |
| 135 // TODO(benjhayden): Test Stop(). | 133 // TODO(benjhayden): Test Stop(). |
| 136 | 134 |
| 137 } // namespace content | 135 } // namespace content |
| OLD | NEW |