Chromium Code Reviews| 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..5f59c449953353e774df7d718c3a31caf85dae9a |
| --- /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 "net/reporting/reporting_cache.h" |
| +#include "net/reporting/reporting_client.h" |
| +#include "url/gurl.h" |
| +#include "url/origin.h" |
| + |
| +namespace net { |
| + |
| +const ReportingClient* FindClientInCache(const ReportingCache* cache, |
| + const url::Origin& origin, |
| + const GURL& endpoint) { |
| + std::vector<const ReportingClient*> clients; |
| + cache->GetClients(&clients); |
|
jkarlin
2017/03/17 15:07:03
Is a GetClientsForOriginAndEndpoint in order? Or i
Julia Tuttle
2017/03/21 18:41:03
It's only useful for testing; I'll switch to GetCl
|
| + for (const ReportingClient* client : clients) { |
| + if (client->origin == origin && client->endpoint == endpoint) |
| + return client; |
| + } |
| + return nullptr; |
| +} |
| + |
| +} // namespace net |