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

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

Issue 2799333002: Clear the received slices in DownloadItemImpl when etag changed. (Closed)
Patch Set: Address the uma issue. Created 3 years, 8 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 "content/browser/download/download_manager_impl.h" 5 #include "content/browser/download/download_manager_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 virtual ~MockDownloadFileFactory() {} 290 virtual ~MockDownloadFileFactory() {}
291 291
292 // Overridden method from DownloadFileFactory 292 // Overridden method from DownloadFileFactory
293 MOCK_METHOD2(MockCreateFile, 293 MOCK_METHOD2(MockCreateFile,
294 MockDownloadFile*(const DownloadSaveInfo&, ByteStreamReader*)); 294 MockDownloadFile*(const DownloadSaveInfo&, ByteStreamReader*));
295 295
296 DownloadFile* CreateFile( 296 DownloadFile* CreateFile(
297 std::unique_ptr<DownloadSaveInfo> save_info, 297 std::unique_ptr<DownloadSaveInfo> save_info,
298 const base::FilePath& default_download_directory, 298 const base::FilePath& default_download_directory,
299 std::unique_ptr<ByteStreamReader> byte_stream, 299 std::unique_ptr<ByteStreamReader> byte_stream,
300 const std::vector<DownloadItem::ReceivedSlice>& received_slices,
301 const net::NetLogWithSource& net_log, 300 const net::NetLogWithSource& net_log,
302 base::WeakPtr<DownloadDestinationObserver> observer) override { 301 base::WeakPtr<DownloadDestinationObserver> observer) override {
303 return MockCreateFile(*save_info, byte_stream.get()); 302 return MockCreateFile(*save_info, byte_stream.get());
304 } 303 }
305 }; 304 };
306 305
307 class MockBrowserContext : public BrowserContext { 306 class MockBrowserContext : public BrowserContext {
308 public: 307 public:
309 MockBrowserContext() { 308 MockBrowserContext() {
310 content::BrowserContext::Initialize(this, base::FilePath()); 309 content::BrowserContext::Initialize(this, base::FilePath());
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 EXPECT_CALL(GetMockDownloadItem(1), Remove()).Times(0); 648 EXPECT_CALL(GetMockDownloadItem(1), Remove()).Times(0);
650 649
651 base::Callback<bool(const GURL&)> url_filter = 650 base::Callback<bool(const GURL&)> url_filter =
652 GetSingleURLFilter(download_urls_[0]); 651 GetSingleURLFilter(download_urls_[0]);
653 int remove_count = download_manager_->RemoveDownloadsByURLAndTime( 652 int remove_count = download_manager_->RemoveDownloadsByURLAndTime(
654 url_filter, base::Time(), base::Time::Max()); 653 url_filter, base::Time(), base::Time::Max());
655 EXPECT_EQ(remove_count, 1); 654 EXPECT_EQ(remove_count, 1);
656 } 655 }
657 656
658 } // namespace content 657 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_manager_impl.cc ('k') | content/browser/download/mock_download_file.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698