| 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 "content/browser/download/download_file_factory.h" | 7 #include "content/browser/download/download_file_factory.h" |
| 8 #include "content/browser/download/download_file_impl.h" | 8 #include "content/browser/download/download_file_impl.h" |
| 9 #include "content/browser/download/download_item_impl.h" | 9 #include "content/browser/download/download_item_impl.h" |
| 10 #include "content/browser/download/download_manager_impl.h" | 10 #include "content/browser/download/download_manager_impl.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 DISALLOW_COPY_AND_ASSIGN(DragDownloadFileTest); | 87 DISALLOW_COPY_AND_ASSIGN(DragDownloadFileTest); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 IN_PROC_BROWSER_TEST_F(DragDownloadFileTest, DragDownloadFileTest_NetError) { | 90 IN_PROC_BROWSER_TEST_F(DragDownloadFileTest, DragDownloadFileTest_NetError) { |
| 91 base::FilePath name(downloads_directory().AppendASCII( | 91 base::FilePath name(downloads_directory().AppendASCII( |
| 92 "DragDownloadFileTest_NetError.txt")); | 92 "DragDownloadFileTest_NetError.txt")); |
| 93 GURL url(URLRequestMockHTTPJob::GetMockUrl(base::FilePath(FILE_PATH_LITERAL( | 93 GURL url(URLRequestMockHTTPJob::GetMockUrl(base::FilePath(FILE_PATH_LITERAL( |
| 94 "download-test.lib")))); | 94 "download-test.lib")))); |
| 95 Referrer referrer; | 95 Referrer referrer; |
| 96 std::string referrer_encoding; | 96 std::string referrer_encoding; |
| 97 DragDownloadFile* file = new DragDownloadFile( | 97 DragDownloadFile* file = new DragDownloadFile(name, |
| 98 name, scoped_ptr<net::FileStream>(NULL), url, referrer, | 98 scoped_ptr<net::FileStream>(), |
| 99 referrer_encoding, shell()->web_contents()); | 99 url, |
| 100 referrer, |
| 101 referrer_encoding, |
| 102 shell()->web_contents()); |
| 100 scoped_refptr<MockDownloadFileObserver> observer( | 103 scoped_refptr<MockDownloadFileObserver> observer( |
| 101 new MockDownloadFileObserver()); | 104 new MockDownloadFileObserver()); |
| 102 EXPECT_CALL(*observer.get(), OnDownloadAborted()) | 105 EXPECT_CALL(*observer.get(), OnDownloadAborted()) |
| 103 .WillOnce(InvokeWithoutArgs(this, &DragDownloadFileTest::Succeed)); | 106 .WillOnce(InvokeWithoutArgs(this, &DragDownloadFileTest::Succeed)); |
| 104 ON_CALL(*observer.get(), OnDownloadCompleted(_)) | 107 ON_CALL(*observer.get(), OnDownloadCompleted(_)) |
| 105 .WillByDefault(InvokeWithoutArgs(this, &DragDownloadFileTest::FailFast)); | 108 .WillByDefault(InvokeWithoutArgs(this, &DragDownloadFileTest::FailFast)); |
| 106 file->Start(observer.get()); | 109 file->Start(observer.get()); |
| 107 RunMessageLoop(); | 110 RunMessageLoop(); |
| 108 } | 111 } |
| 109 | 112 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 125 .WillOnce(InvokeWithoutArgs(this, &DragDownloadFileTest::Succeed)); | 128 .WillOnce(InvokeWithoutArgs(this, &DragDownloadFileTest::Succeed)); |
| 126 ON_CALL(*observer.get(), OnDownloadAborted()) | 129 ON_CALL(*observer.get(), OnDownloadAborted()) |
| 127 .WillByDefault(InvokeWithoutArgs(this, &DragDownloadFileTest::FailFast)); | 130 .WillByDefault(InvokeWithoutArgs(this, &DragDownloadFileTest::FailFast)); |
| 128 file->Start(observer.get()); | 131 file->Start(observer.get()); |
| 129 RunMessageLoop(); | 132 RunMessageLoop(); |
| 130 } | 133 } |
| 131 | 134 |
| 132 // TODO(benjhayden): Test Stop(). | 135 // TODO(benjhayden): Test Stop(). |
| 133 | 136 |
| 134 } // namespace content | 137 } // namespace content |
| OLD | NEW |