| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 BrowserThread::PostTask(BrowserThread::UI, | 55 BrowserThread::PostTask(BrowserThread::UI, |
| 56 FROM_HERE, | 56 FROM_HERE, |
| 57 base::MessageLoopForUI::current()->QuitClosure()); | 57 base::MessageLoopForUI::current()->QuitClosure()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void FailFast() { | 60 void FailFast() { |
| 61 CHECK(false); | 61 CHECK(false); |
| 62 } | 62 } |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 virtual void SetUpOnMainThread() OVERRIDE { | 65 virtual void SetUpOnMainThread() override { |
| 66 ASSERT_TRUE(downloads_directory_.CreateUniqueTempDir()); | 66 ASSERT_TRUE(downloads_directory_.CreateUniqueTempDir()); |
| 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", "")); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 .WillOnce(InvokeWithoutArgs(this, &DragDownloadFileTest::Succeed)); | 129 .WillOnce(InvokeWithoutArgs(this, &DragDownloadFileTest::Succeed)); |
| 130 ON_CALL(*observer.get(), OnDownloadAborted()) | 130 ON_CALL(*observer.get(), OnDownloadAborted()) |
| 131 .WillByDefault(InvokeWithoutArgs(this, &DragDownloadFileTest::FailFast)); | 131 .WillByDefault(InvokeWithoutArgs(this, &DragDownloadFileTest::FailFast)); |
| 132 file->Start(observer.get()); | 132 file->Start(observer.get()); |
| 133 RunMessageLoop(); | 133 RunMessageLoop(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 // TODO(benjhayden): Test Stop(). | 136 // TODO(benjhayden): Test Stop(). |
| 137 | 137 |
| 138 } // namespace content | 138 } // namespace content |
| OLD | NEW |