| 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/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 IN_PROC_BROWSER_TEST_F(DragDownloadFileTest, DragDownloadFileTest_Complete) { | 111 IN_PROC_BROWSER_TEST_F(DragDownloadFileTest, DragDownloadFileTest_Complete) { |
| 112 base::FilePath name(downloads_directory().AppendASCII( | 112 base::FilePath name(downloads_directory().AppendASCII( |
| 113 "DragDownloadFileTest_Complete.txt")); | 113 "DragDownloadFileTest_Complete.txt")); |
| 114 GURL url(URLRequestMockHTTPJob::GetMockUrl(base::FilePath(FILE_PATH_LITERAL( | 114 GURL url(URLRequestMockHTTPJob::GetMockUrl(base::FilePath(FILE_PATH_LITERAL( |
| 115 "download-test.lib")))); | 115 "download-test.lib")))); |
| 116 Referrer referrer; | 116 Referrer referrer; |
| 117 std::string referrer_encoding; | 117 std::string referrer_encoding; |
| 118 net::FileStream* stream = NULL; | 118 net::FileStream* stream = NULL; |
| 119 #if defined(OS_POSIX) | |
| 120 stream = CreateFileStreamForDrop( | |
| 121 &name, GetContentClient()->browser()->GetNetLog()); | |
| 122 #endif | |
| 123 SetUpServer(); | 119 SetUpServer(); |
| 124 DragDownloadFile* file = new DragDownloadFile( | 120 DragDownloadFile* file = new DragDownloadFile( |
| 125 name, scoped_ptr<net::FileStream>(stream), url, referrer, | 121 name, scoped_ptr<net::FileStream>(stream), url, referrer, |
| 126 referrer_encoding, shell()->web_contents()); | 122 referrer_encoding, shell()->web_contents()); |
| 127 scoped_refptr<MockDownloadFileObserver> observer( | 123 scoped_refptr<MockDownloadFileObserver> observer( |
| 128 new MockDownloadFileObserver()); | 124 new MockDownloadFileObserver()); |
| 129 EXPECT_CALL(*observer, OnDownloadCompleted(_)).WillOnce(InvokeWithoutArgs( | 125 EXPECT_CALL(*observer, OnDownloadCompleted(_)).WillOnce(InvokeWithoutArgs( |
| 130 this, &DragDownloadFileTest::Succeed)); | 126 this, &DragDownloadFileTest::Succeed)); |
| 131 ON_CALL(*observer, OnDownloadAborted()).WillByDefault(InvokeWithoutArgs( | 127 ON_CALL(*observer, OnDownloadAborted()).WillByDefault(InvokeWithoutArgs( |
| 132 this, &DragDownloadFileTest::FailFast)); | 128 this, &DragDownloadFileTest::FailFast)); |
| 133 file->Start(observer); | 129 file->Start(observer); |
| 134 RunMessageLoop(); | 130 RunMessageLoop(); |
| 135 } | 131 } |
| 136 | 132 |
| 137 // TODO(benjhayden): Test Stop(). | 133 // TODO(benjhayden): Test Stop(). |
| 138 | 134 |
| 139 } // namespace content | 135 } // namespace content |
| OLD | NEW |