| 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 #ifndef NET_REPORTING_REPORTING_TEST_UTIL_H_ | 5 #ifndef NET_REPORTING_REPORTING_TEST_UTIL_H_ |
| 6 #define NET_REPORTING_REPORTING_TEST_UTIL_H_ | 6 #define NET_REPORTING_REPORTING_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class SimpleTestTickClock; | 22 class SimpleTestTickClock; |
| 23 class Value; | 23 class Value; |
| 24 } // namespace base | 24 } // namespace base |
| 25 | 25 |
| 26 namespace url { | 26 namespace url { |
| 27 class Origin; | 27 class Origin; |
| 28 } // namespace url | 28 } // namespace url |
| 29 | 29 |
| 30 namespace net { | 30 namespace net { |
| 31 | 31 |
| 32 class ReportingBrowsingDataRemover; |
| 32 class ReportingCache; | 33 class ReportingCache; |
| 33 struct ReportingClient; | 34 struct ReportingClient; |
| 34 class ReportingGarbageCollector; | 35 class ReportingGarbageCollector; |
| 35 | 36 |
| 36 // Finds a particular client (by origin and endpoint) in the cache and returns | 37 // Finds a particular client (by origin and endpoint) in the cache and returns |
| 37 // it (or nullptr if not found). | 38 // it (or nullptr if not found). |
| 38 const ReportingClient* FindClientInCache(const ReportingCache* cache, | 39 const ReportingClient* FindClientInCache(const ReportingCache* cache, |
| 39 const url::Origin& origin, | 40 const url::Origin& origin, |
| 40 const GURL& endpoint); | 41 const GURL& endpoint); |
| 41 | 42 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 ReportingCache* cache() { return context_->cache(); } | 139 ReportingCache* cache() { return context_->cache(); } |
| 139 ReportingEndpointManager* endpoint_manager() { | 140 ReportingEndpointManager* endpoint_manager() { |
| 140 return context_->endpoint_manager(); | 141 return context_->endpoint_manager(); |
| 141 } | 142 } |
| 142 ReportingDeliveryAgent* delivery_agent() { | 143 ReportingDeliveryAgent* delivery_agent() { |
| 143 return context_->delivery_agent(); | 144 return context_->delivery_agent(); |
| 144 } | 145 } |
| 145 ReportingGarbageCollector* garbage_collector() { | 146 ReportingGarbageCollector* garbage_collector() { |
| 146 return context_->garbage_collector(); | 147 return context_->garbage_collector(); |
| 147 } | 148 } |
| 149 ReportingBrowsingDataRemover* browsing_data_remover() { |
| 150 return context_->browsing_data_remover(); |
| 151 } |
| 148 | 152 |
| 149 ReportingPersister* persister() { return context_->persister(); } | 153 ReportingPersister* persister() { return context_->persister(); } |
| 150 | 154 |
| 151 base::TimeTicks yesterday(); | 155 base::TimeTicks yesterday(); |
| 152 base::TimeTicks now(); | 156 base::TimeTicks now(); |
| 153 base::TimeTicks tomorrow(); | 157 base::TimeTicks tomorrow(); |
| 154 | 158 |
| 155 const std::vector<std::unique_ptr<TestReportingUploader::PendingUpload>>& | 159 const std::vector<std::unique_ptr<TestReportingUploader::PendingUpload>>& |
| 156 pending_uploads() { | 160 pending_uploads() { |
| 157 return uploader()->pending_uploads(); | 161 return uploader()->pending_uploads(); |
| 158 } | 162 } |
| 159 | 163 |
| 160 private: | 164 private: |
| 161 void CreateContext(const ReportingPolicy& policy, | 165 void CreateContext(const ReportingPolicy& policy, |
| 162 base::Time now, | 166 base::Time now, |
| 163 base::TimeTicks now_ticks); | 167 base::TimeTicks now_ticks); |
| 164 | 168 |
| 165 std::unique_ptr<TestReportingContext> context_; | 169 std::unique_ptr<TestReportingContext> context_; |
| 166 | 170 |
| 167 DISALLOW_COPY_AND_ASSIGN(ReportingTestBase); | 171 DISALLOW_COPY_AND_ASSIGN(ReportingTestBase); |
| 168 }; | 172 }; |
| 169 | 173 |
| 170 } // namespace net | 174 } // namespace net |
| 171 | 175 |
| 172 #endif // NET_REPORING_REPORTING_TEST_UTIL_H_ | 176 #endif // NET_REPORING_REPORTING_TEST_UTIL_H_ |
| OLD | NEW |