| 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/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/stl_util.h" | 6 #include "base/stl_util.h" |
| 7 #include "base/threading/thread.h" | 7 #include "base/threading/thread.h" |
| 8 #include "content/browser/download/byte_stream.h" | 8 #include "content/browser/download/byte_stream.h" |
| 9 #include "content/browser/download/download_create_info.h" | 9 #include "content/browser/download/download_create_info.h" |
| 10 #include "content/browser/download/download_file_manager.h" | 10 #include "content/browser/download/download_file_manager.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 scoped_ptr<DownloadCreateInfo> info_; | 178 scoped_ptr<DownloadCreateInfo> info_; |
| 179 | 179 |
| 180 info_.reset(new DownloadCreateInfo()); | 180 info_.reset(new DownloadCreateInfo()); |
| 181 static int next_id; | 181 static int next_id; |
| 182 info_->download_id = | 182 info_->download_id = |
| 183 content::DownloadId(kValidDownloadItemIdDomain, ++next_id); | 183 content::DownloadId(kValidDownloadItemIdDomain, ++next_id); |
| 184 info_->prompt_user_for_save_location = false; | 184 info_->prompt_user_for_save_location = false; |
| 185 info_->url_chain.push_back(GURL()); | 185 info_->url_chain.push_back(GURL()); |
| 186 info_->state = state; | 186 info_->state = state; |
| 187 | 187 |
| 188 MockRequestHandle* request_handle = | 188 scoped_ptr<DownloadRequestHandleInterface> request_handle( |
| 189 new testing::NiceMock<MockRequestHandle>; | 189 new testing::NiceMock<MockRequestHandle>); |
| 190 DownloadItem* download = | 190 DownloadItem* download = |
| 191 new DownloadItemImpl(&delegate_, *(info_.get()), | 191 new DownloadItemImpl(&delegate_, *(info_.get()), |
| 192 request_handle, false, net::BoundNetLog()); | 192 request_handle.Pass(), false, net::BoundNetLog()); |
| 193 allocated_downloads_.insert(download); | 193 allocated_downloads_.insert(download); |
| 194 return download; | 194 return download; |
| 195 } | 195 } |
| 196 | 196 |
| 197 // Destroy a previously created download item. | 197 // Destroy a previously created download item. |
| 198 void DestroyDownloadItem(DownloadItem* item) { | 198 void DestroyDownloadItem(DownloadItem* item) { |
| 199 allocated_downloads_.erase(item); | 199 allocated_downloads_.erase(item); |
| 200 delete item; | 200 delete item; |
| 201 } | 201 } |
| 202 | 202 |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 DownloadItem* item = CreateDownloadItem(DownloadItem::IN_PROGRESS); | 588 DownloadItem* item = CreateDownloadItem(DownloadItem::IN_PROGRESS); |
| 589 | 589 |
| 590 EXPECT_EQ(false, item->GetFileExternallyRemoved()); | 590 EXPECT_EQ(false, item->GetFileExternallyRemoved()); |
| 591 item->OnDownloadedFileRemoved(); | 591 item->OnDownloadedFileRemoved(); |
| 592 EXPECT_EQ(true, item->GetFileExternallyRemoved()); | 592 EXPECT_EQ(true, item->GetFileExternallyRemoved()); |
| 593 } | 593 } |
| 594 | 594 |
| 595 TEST(MockDownloadItem, Compiles) { | 595 TEST(MockDownloadItem, Compiles) { |
| 596 MockDownloadItem mock_item; | 596 MockDownloadItem mock_item; |
| 597 } | 597 } |
| OLD | NEW |