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/download_create_info.h" | 8 #include "content/browser/download/download_create_info.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_request_handle.h" | 10 #include "content/browser/download/download_request_handle.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 info_->download_id = | 106 info_->download_id = |
107 content::DownloadId(kValidDownloadItemIdDomain, ++next_id); | 107 content::DownloadId(kValidDownloadItemIdDomain, ++next_id); |
108 info_->prompt_user_for_save_location = false; | 108 info_->prompt_user_for_save_location = false; |
109 info_->url_chain.push_back(GURL()); | 109 info_->url_chain.push_back(GURL()); |
110 info_->state = state; | 110 info_->state = state; |
111 | 111 |
112 MockRequestHandle* request_handle = | 112 MockRequestHandle* request_handle = |
113 new testing::NiceMock<MockRequestHandle>; | 113 new testing::NiceMock<MockRequestHandle>; |
114 DownloadItem* download = | 114 DownloadItem* download = |
115 new DownloadItemImpl(&delegate_, *(info_.get()), | 115 new DownloadItemImpl(&delegate_, *(info_.get()), |
116 request_handle, false); | 116 request_handle, false, net::BoundNetLog()); |
117 allocated_downloads_.insert(download); | 117 allocated_downloads_.insert(download); |
118 return download; | 118 return download; |
119 } | 119 } |
120 | 120 |
121 // Destroy a previously created download item. | 121 // Destroy a previously created download item. |
122 void DestroyDownloadItem(DownloadItem* item) { | 122 void DestroyDownloadItem(DownloadItem* item) { |
123 allocated_downloads_.erase(item); | 123 allocated_downloads_.erase(item); |
124 delete item; | 124 delete item; |
125 } | 125 } |
126 | 126 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 item->SetExternalData(&external_data_test_string, test3); | 335 item->SetExternalData(&external_data_test_string, test3); |
336 EXPECT_EQ(static_cast<DownloadItem::ExternalData*>(test3), | 336 EXPECT_EQ(static_cast<DownloadItem::ExternalData*>(test3), |
337 item->GetExternalData(&external_data_test_string)); | 337 item->GetExternalData(&external_data_test_string)); |
338 DestroyDownloadItem(item); | 338 DestroyDownloadItem(item); |
339 EXPECT_EQ(3, destructor_called); | 339 EXPECT_EQ(3, destructor_called); |
340 } | 340 } |
341 | 341 |
342 TEST(MockDownloadItem, Compiles) { | 342 TEST(MockDownloadItem, Compiles) { |
343 MockDownloadItem mock_item; | 343 MockDownloadItem mock_item; |
344 } | 344 } |
OLD | NEW |