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