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

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

Issue 2421383003: Add operator==(const GURL&, const StringPiece&) to gurl.h (Closed)
Patch Set: remove comment Created 4 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
« no previous file with comments | « components/power/origin_power_map_unittest.cc ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <memory> 10 #include <memory>
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 DownloadItem::INTERRUPTED, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, 760 DownloadItem::INTERRUPTED, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
761 DOWNLOAD_INTERRUPT_REASON_SERVER_FAILED, false); 761 DOWNLOAD_INTERRUPT_REASON_SERVER_FAILED, false);
762 ASSERT_TRUE(persisted_item); 762 ASSERT_TRUE(persisted_item);
763 763
764 ASSERT_EQ(persisted_item, download_manager_->GetDownloadByGuid(kGuid)); 764 ASSERT_EQ(persisted_item, download_manager_->GetDownloadByGuid(kGuid));
765 } 765 }
766 766
767 namespace { 767 namespace {
768 768
769 base::Callback<bool(const GURL&)> GetSingleURLFilter(const GURL& url) { 769 base::Callback<bool(const GURL&)> GetSingleURLFilter(const GURL& url) {
770 return base::Bind(&GURL::operator==, base::Owned(new GURL(url))); 770 return base::Bind(static_cast<bool (*)(const GURL&, const GURL&)>(operator==),
771 GURL(url));
771 } 772 }
772 773
773 } // namespace 774 } // namespace
774 775
775 // Confirm that only downloads with the specified URL are removed. 776 // Confirm that only downloads with the specified URL are removed.
776 TEST_F(DownloadManagerTest, RemoveDownloadsByURL) { 777 TEST_F(DownloadManagerTest, RemoveDownloadsByURL) {
777 base::Time now(base::Time::Now()); 778 base::Time now(base::Time::Now());
778 for (uint32_t i = 0; i < 2; ++i) { 779 for (uint32_t i = 0; i < 2; ++i) {
779 MockDownloadItemImpl& item(AddItemToManager()); 780 MockDownloadItemImpl& item(AddItemToManager());
780 EXPECT_CALL(item, GetStartTime()).WillRepeatedly(Return(now)); 781 EXPECT_CALL(item, GetStartTime()).WillRepeatedly(Return(now));
781 EXPECT_CALL(item, GetState()) 782 EXPECT_CALL(item, GetState())
782 .WillRepeatedly(Return(DownloadItem::COMPLETE)); 783 .WillRepeatedly(Return(DownloadItem::COMPLETE));
783 } 784 }
784 785
785 EXPECT_CALL(GetMockDownloadItem(0), Remove()); 786 EXPECT_CALL(GetMockDownloadItem(0), Remove());
786 EXPECT_CALL(GetMockDownloadItem(1), Remove()).Times(0); 787 EXPECT_CALL(GetMockDownloadItem(1), Remove()).Times(0);
787 788
788 base::Callback<bool(const GURL&)> url_filter = 789 base::Callback<bool(const GURL&)> url_filter =
789 GetSingleURLFilter(download_urls_[0]); 790 GetSingleURLFilter(download_urls_[0]);
790 int remove_count = download_manager_->RemoveDownloadsByURLAndTime( 791 int remove_count = download_manager_->RemoveDownloadsByURLAndTime(
791 url_filter, base::Time(), base::Time::Max()); 792 url_filter, base::Time(), base::Time::Max());
792 EXPECT_EQ(remove_count, 1); 793 EXPECT_EQ(remove_count, 1);
793 } 794 }
794 795
795 } // namespace content 796 } // namespace content
OLDNEW
« no previous file with comments | « components/power/origin_power_map_unittest.cc ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698