Index: net/reporting/reporting_test_util.cc |
diff --git a/net/reporting/reporting_test_util.cc b/net/reporting/reporting_test_util.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c9b53840ab377692c23332673e8b1e17349e2b7c |
--- /dev/null |
+++ b/net/reporting/reporting_test_util.cc |
@@ -0,0 +1,28 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "net/reporting/reporting_test_util.h" |
+ |
+#include <vector> |
+ |
+#include "url/gurl.h" |
+#include "url/origin.h" |
+ |
+namespace net { |
+ |
+using Client = ReportingCache::Client; |
+ |
+const Client* FindClientInCache(const ReportingCache* cache, |
+ const url::Origin& origin, |
+ const GURL& endpoint) { |
+ std::vector<const Client*> clients; |
+ cache->GetClients(&clients); |
+ for (const Client* client : clients) { |
+ if (client->origin == origin && client->endpoint == endpoint) |
+ return client; |
+ } |
+ return nullptr; |
+} |
+ |
+} // namespace net |