Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: content/browser/download/download_manager_impl_unittest.cc

Issue 667943003: Standardize usage of virtual/override/final in content/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 MockDownloadManagerDelegate::MockDownloadManagerDelegate() {} 205 MockDownloadManagerDelegate::MockDownloadManagerDelegate() {}
206 206
207 MockDownloadManagerDelegate::~MockDownloadManagerDelegate() {} 207 MockDownloadManagerDelegate::~MockDownloadManagerDelegate() {}
208 208
209 class MockDownloadItemFactory 209 class MockDownloadItemFactory
210 : public DownloadItemFactory, 210 : public DownloadItemFactory,
211 public base::SupportsWeakPtr<MockDownloadItemFactory> { 211 public base::SupportsWeakPtr<MockDownloadItemFactory> {
212 public: 212 public:
213 MockDownloadItemFactory(); 213 MockDownloadItemFactory();
214 virtual ~MockDownloadItemFactory(); 214 ~MockDownloadItemFactory() override;
215 215
216 // Access to map of created items. 216 // Access to map of created items.
217 // TODO(rdsmith): Could add type (save page, persisted, etc.) 217 // TODO(rdsmith): Could add type (save page, persisted, etc.)
218 // functionality if it's ever needed by consumers. 218 // functionality if it's ever needed by consumers.
219 219
220 // Returns NULL if no item of that id is present. 220 // Returns NULL if no item of that id is present.
221 MockDownloadItemImpl* GetItem(int id); 221 MockDownloadItemImpl* GetItem(int id);
222 222
223 // Remove and return an item made by the factory. 223 // Remove and return an item made by the factory.
224 // Generally used during teardown. 224 // Generally used during teardown.
225 MockDownloadItemImpl* PopItem(); 225 MockDownloadItemImpl* PopItem();
226 226
227 // Should be called when the item of this id is removed so that 227 // Should be called when the item of this id is removed so that
228 // we don't keep dangling pointers. 228 // we don't keep dangling pointers.
229 void RemoveItem(int id); 229 void RemoveItem(int id);
230 230
231 // Overridden methods from DownloadItemFactory. 231 // Overridden methods from DownloadItemFactory.
232 virtual DownloadItemImpl* CreatePersistedItem( 232 DownloadItemImpl* CreatePersistedItem(
233 DownloadItemImplDelegate* delegate, 233 DownloadItemImplDelegate* delegate,
234 uint32 download_id, 234 uint32 download_id,
235 const base::FilePath& current_path, 235 const base::FilePath& current_path,
236 const base::FilePath& target_path, 236 const base::FilePath& target_path,
237 const std::vector<GURL>& url_chain, 237 const std::vector<GURL>& url_chain,
238 const GURL& referrer_url, 238 const GURL& referrer_url,
239 const std::string& mime_type, 239 const std::string& mime_type,
240 const std::string& original_mime_type, 240 const std::string& original_mime_type,
241 const base::Time& start_time, 241 const base::Time& start_time,
242 const base::Time& end_time, 242 const base::Time& end_time,
243 const std::string& etag, 243 const std::string& etag,
244 const std::string& last_modofied, 244 const std::string& last_modofied,
245 int64 received_bytes, 245 int64 received_bytes,
246 int64 total_bytes, 246 int64 total_bytes,
247 DownloadItem::DownloadState state, 247 DownloadItem::DownloadState state,
248 DownloadDangerType danger_type, 248 DownloadDangerType danger_type,
249 DownloadInterruptReason interrupt_reason, 249 DownloadInterruptReason interrupt_reason,
250 bool opened, 250 bool opened,
251 const net::BoundNetLog& bound_net_log) override; 251 const net::BoundNetLog& bound_net_log) override;
252 virtual DownloadItemImpl* CreateActiveItem( 252 DownloadItemImpl* CreateActiveItem(
253 DownloadItemImplDelegate* delegate, 253 DownloadItemImplDelegate* delegate,
254 uint32 download_id, 254 uint32 download_id,
255 const DownloadCreateInfo& info, 255 const DownloadCreateInfo& info,
256 const net::BoundNetLog& bound_net_log) override; 256 const net::BoundNetLog& bound_net_log) override;
257 virtual DownloadItemImpl* CreateSavePageItem( 257 DownloadItemImpl* CreateSavePageItem(
258 DownloadItemImplDelegate* delegate, 258 DownloadItemImplDelegate* delegate,
259 uint32 download_id, 259 uint32 download_id,
260 const base::FilePath& path, 260 const base::FilePath& path,
261 const GURL& url, 261 const GURL& url,
262 const std::string& mime_type, 262 const std::string& mime_type,
263 scoped_ptr<DownloadRequestHandleInterface> request_handle, 263 scoped_ptr<DownloadRequestHandleInterface> request_handle,
264 const net::BoundNetLog& bound_net_log) override; 264 const net::BoundNetLog& bound_net_log) override;
265 265
266 private: 266 private:
267 std::map<uint32, MockDownloadItemImpl*> items_; 267 std::map<uint32, MockDownloadItemImpl*> items_;
268 DownloadItemImplDelegate item_delegate_; 268 DownloadItemImplDelegate item_delegate_;
269 269
270 DISALLOW_COPY_AND_ASSIGN(MockDownloadItemFactory); 270 DISALLOW_COPY_AND_ASSIGN(MockDownloadItemFactory);
271 }; 271 };
272 272
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 .WillOnce(Return()); 680 .WillOnce(Return());
681 EXPECT_CALL(GetMockDownloadItem(3), Remove()) 681 EXPECT_CALL(GetMockDownloadItem(3), Remove())
682 .Times(0); 682 .Times(0);
683 683
684 download_manager_->RemoveAllDownloads(); 684 download_manager_->RemoveAllDownloads();
685 // Because we're mocking the download item, the Remove call doesn't 685 // Because we're mocking the download item, the Remove call doesn't
686 // result in them being removed from the DownloadManager list. 686 // result in them being removed from the DownloadManager list.
687 } 687 }
688 688
689 } // namespace content 689 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_manager_impl.cc ('k') | content/browser/download/download_request_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698