| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "net/reporting/reporting_browsing_data_remover.h" | 5 #include "net/reporting/reporting_browsing_data_remover.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 data_type_mask |= ReportingBrowsingDataRemover::DATA_TYPE_REPORTS; | 28 data_type_mask |= ReportingBrowsingDataRemover::DATA_TYPE_REPORTS; |
| 29 if (remove_clients) | 29 if (remove_clients) |
| 30 data_type_mask |= ReportingBrowsingDataRemover::DATA_TYPE_CLIENTS; | 30 data_type_mask |= ReportingBrowsingDataRemover::DATA_TYPE_CLIENTS; |
| 31 | 31 |
| 32 base::Callback<bool(const GURL&)> origin_filter; | 32 base::Callback<bool(const GURL&)> origin_filter; |
| 33 if (!host.empty()) { | 33 if (!host.empty()) { |
| 34 origin_filter = | 34 origin_filter = |
| 35 base::Bind(&ReportingBrowsingDataRemoverTest::HostIs, host); | 35 base::Bind(&ReportingBrowsingDataRemoverTest::HostIs, host); |
| 36 } | 36 } |
| 37 | 37 |
| 38 ReportingBrowsingDataRemover::RemoveBrowsingData(context(), data_type_mask, | 38 browsing_data_remover()->RemoveBrowsingData(data_type_mask, origin_filter); |
| 39 origin_filter); | |
| 40 } | 39 } |
| 41 | 40 |
| 42 static bool HostIs(std::string host, const GURL& url) { | 41 static bool HostIs(std::string host, const GURL& url) { |
| 43 return url.host() == host; | 42 return url.host() == host; |
| 44 } | 43 } |
| 45 | 44 |
| 46 size_t report_count() { | 45 size_t report_count() { |
| 47 std::vector<const ReportingReport*> reports; | 46 std::vector<const ReportingReport*> reports; |
| 48 cache()->GetReports(&reports); | 47 cache()->GetReports(&reports); |
| 49 return reports.size(); | 48 return reports.size(); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 183 |
| 185 RemoveBrowsingData(/* remove_reports= */ false, /* remove_clients= */ true, | 184 RemoveBrowsingData(/* remove_reports= */ false, /* remove_clients= */ true, |
| 186 /* host= */ kUrl1_.host()); | 185 /* host= */ kUrl1_.host()); |
| 187 EXPECT_EQ(2u, report_count()); | 186 EXPECT_EQ(2u, report_count()); |
| 188 EXPECT_FALSE(FindClientInCache(cache(), kOrigin1_, kEndpoint_) != nullptr); | 187 EXPECT_FALSE(FindClientInCache(cache(), kOrigin1_, kEndpoint_) != nullptr); |
| 189 EXPECT_TRUE(FindClientInCache(cache(), kOrigin2_, kEndpoint_) != nullptr); | 188 EXPECT_TRUE(FindClientInCache(cache(), kOrigin2_, kEndpoint_) != nullptr); |
| 190 } | 189 } |
| 191 | 190 |
| 192 } // namespace | 191 } // namespace |
| 193 } // namespace net | 192 } // namespace net |
| OLD | NEW |