| 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 12 matching lines...) Expand all Loading... |
| 23 class SimpleTestTickClock; | 23 class SimpleTestTickClock; |
| 24 class Value; | 24 class Value; |
| 25 } // namespace base | 25 } // namespace base |
| 26 | 26 |
| 27 namespace url { | 27 namespace url { |
| 28 class Origin; | 28 class Origin; |
| 29 } // namespace url | 29 } // namespace url |
| 30 | 30 |
| 31 namespace net { | 31 namespace net { |
| 32 | 32 |
| 33 class ReportingBrowsingDataRemover; |
| 33 class ReportingCache; | 34 class ReportingCache; |
| 34 struct ReportingClient; | 35 struct ReportingClient; |
| 35 class ReportingGarbageCollector; | 36 class ReportingGarbageCollector; |
| 36 | 37 |
| 37 // Finds a particular client (by origin and endpoint) in the cache and returns | 38 // Finds a particular client (by origin and endpoint) in the cache and returns |
| 38 // it (or nullptr if not found). | 39 // it (or nullptr if not found). |
| 39 const ReportingClient* FindClientInCache(const ReportingCache* cache, | 40 const ReportingClient* FindClientInCache(const ReportingCache* cache, |
| 40 const url::Origin& origin, | 41 const url::Origin& origin, |
| 41 const GURL& endpoint); | 42 const GURL& endpoint); |
| 42 | 43 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 ReportingCache* cache() { return context_->cache(); } | 168 ReportingCache* cache() { return context_->cache(); } |
| 168 ReportingEndpointManager* endpoint_manager() { | 169 ReportingEndpointManager* endpoint_manager() { |
| 169 return context_->endpoint_manager(); | 170 return context_->endpoint_manager(); |
| 170 } | 171 } |
| 171 ReportingDeliveryAgent* delivery_agent() { | 172 ReportingDeliveryAgent* delivery_agent() { |
| 172 return context_->delivery_agent(); | 173 return context_->delivery_agent(); |
| 173 } | 174 } |
| 174 ReportingGarbageCollector* garbage_collector() { | 175 ReportingGarbageCollector* garbage_collector() { |
| 175 return context_->garbage_collector(); | 176 return context_->garbage_collector(); |
| 176 } | 177 } |
| 178 ReportingBrowsingDataRemover* browsing_data_remover() { |
| 179 return context_->browsing_data_remover(); |
| 180 } |
| 177 | 181 |
| 178 ReportingPersister* persister() { return context_->persister(); } | 182 ReportingPersister* persister() { return context_->persister(); } |
| 179 | 183 |
| 180 base::TimeTicks yesterday(); | 184 base::TimeTicks yesterday(); |
| 181 base::TimeTicks now(); | 185 base::TimeTicks now(); |
| 182 base::TimeTicks tomorrow(); | 186 base::TimeTicks tomorrow(); |
| 183 | 187 |
| 184 const std::vector<std::unique_ptr<TestReportingUploader::PendingUpload>>& | 188 const std::vector<std::unique_ptr<TestReportingUploader::PendingUpload>>& |
| 185 pending_uploads() { | 189 pending_uploads() { |
| 186 return uploader()->pending_uploads(); | 190 return uploader()->pending_uploads(); |
| 187 } | 191 } |
| 188 | 192 |
| 189 private: | 193 private: |
| 190 void CreateAndInitializeContext( | 194 void CreateAndInitializeContext( |
| 191 const ReportingPolicy& policy, | 195 const ReportingPolicy& policy, |
| 192 std::unique_ptr<const base::Value> persisted_data, | 196 std::unique_ptr<const base::Value> persisted_data, |
| 193 base::Time now, | 197 base::Time now, |
| 194 base::TimeTicks now_ticks); | 198 base::TimeTicks now_ticks); |
| 195 | 199 |
| 196 std::unique_ptr<TestReportingContext> context_; | 200 std::unique_ptr<TestReportingContext> context_; |
| 197 | 201 |
| 198 DISALLOW_COPY_AND_ASSIGN(ReportingTestBase); | 202 DISALLOW_COPY_AND_ASSIGN(ReportingTestBase); |
| 199 }; | 203 }; |
| 200 | 204 |
| 201 } // namespace net | 205 } // namespace net |
| 202 | 206 |
| 203 #endif // NET_REPORING_REPORTING_TEST_UTIL_H_ | 207 #endif // NET_REPORING_REPORTING_TEST_UTIL_H_ |
| OLD | NEW |