| 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 "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 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "content/public/browser/zoom_level_delegate.h" | 36 #include "content/public/browser/zoom_level_delegate.h" |
| 37 #include "content/public/test/mock_download_item.h" | 37 #include "content/public/test/mock_download_item.h" |
| 38 #include "content/public/test/test_browser_context.h" | 38 #include "content/public/test/test_browser_context.h" |
| 39 #include "content/public/test/test_browser_thread.h" | 39 #include "content/public/test/test_browser_thread.h" |
| 40 #include "net/base/net_util.h" | 40 #include "net/base/net_util.h" |
| 41 #include "net/log/net_log.h" | 41 #include "net/log/net_log.h" |
| 42 #include "testing/gmock/include/gmock/gmock.h" | 42 #include "testing/gmock/include/gmock/gmock.h" |
| 43 #include "testing/gmock_mutant.h" | 43 #include "testing/gmock_mutant.h" |
| 44 #include "testing/gtest/include/gtest/gtest.h" | 44 #include "testing/gtest/include/gtest/gtest.h" |
| 45 #include "url/origin.h" | 45 #include "url/origin.h" |
| 46 #include "url/origin_filter.h" |
| 46 | 47 |
| 47 using ::testing::AllOf; | 48 using ::testing::AllOf; |
| 48 using ::testing::DoAll; | 49 using ::testing::DoAll; |
| 49 using ::testing::Eq; | 50 using ::testing::Eq; |
| 50 using ::testing::Ref; | 51 using ::testing::Ref; |
| 51 using ::testing::Return; | 52 using ::testing::Return; |
| 52 using ::testing::ReturnRef; | 53 using ::testing::ReturnRef; |
| 53 using ::testing::SetArgPointee; | 54 using ::testing::SetArgPointee; |
| 54 using ::testing::StrictMock; | 55 using ::testing::StrictMock; |
| 55 using ::testing::_; | 56 using ::testing::_; |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 for (uint32_t i = 0; i < 2; ++i) { | 714 for (uint32_t i = 0; i < 2; ++i) { |
| 714 MockDownloadItemImpl& item(AddItemToManager()); | 715 MockDownloadItemImpl& item(AddItemToManager()); |
| 715 EXPECT_CALL(item, GetStartTime()).WillRepeatedly(Return(now)); | 716 EXPECT_CALL(item, GetStartTime()).WillRepeatedly(Return(now)); |
| 716 EXPECT_CALL(item, GetState()) | 717 EXPECT_CALL(item, GetState()) |
| 717 .WillRepeatedly(Return(DownloadItem::COMPLETE)); | 718 .WillRepeatedly(Return(DownloadItem::COMPLETE)); |
| 718 } | 719 } |
| 719 | 720 |
| 720 EXPECT_CALL(GetMockDownloadItem(0), Remove()); | 721 EXPECT_CALL(GetMockDownloadItem(0), Remove()); |
| 721 EXPECT_CALL(GetMockDownloadItem(1), Remove()).Times(0); | 722 EXPECT_CALL(GetMockDownloadItem(1), Remove()).Times(0); |
| 722 | 723 |
| 723 url::Origin origin_to_clear(download_urls_[0]); | 724 std::vector<url::Origin> whitelist; |
| 725 whitelist.push_back(url::Origin(download_urls_[0])); |
| 726 scoped_ptr<url::OriginFilter> filter = |
| 727 url::OriginFilter::AsWhitelist(whitelist); |
| 724 int remove_count = download_manager_->RemoveDownloadsByOriginAndTime( | 728 int remove_count = download_manager_->RemoveDownloadsByOriginAndTime( |
| 725 origin_to_clear, base::Time(), base::Time::Max()); | 729 filter.get(), base::Time(), base::Time::Max()); |
| 726 EXPECT_EQ(remove_count, 1); | 730 EXPECT_EQ(remove_count, 1); |
| 727 } | 731 } |
| 728 | 732 |
| 729 } // namespace content | 733 } // namespace content |
| OLD | NEW |