1 // Copyright (c) 2021 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_CLIENT_SESSION_CACHE_PEER_H_
6 #define QUICHE_QUIC_TEST_TOOLS_QUIC_CLIENT_SESSION_CACHE_PEER_H_
7 
8 #include "quiche/quic/core/crypto/quic_client_session_cache.h"
9 
10 namespace quic {
11 namespace test {
12 
13 class QuicClientSessionCachePeer {
14  public:
GetToken(QuicClientSessionCache * cache,const QuicServerId & server_id)15   static std::string GetToken(QuicClientSessionCache* cache,
16                               const QuicServerId& server_id) {
17     auto iter = cache->cache_.Lookup(server_id);
18     if (iter == cache->cache_.end()) {
19       return {};
20     }
21     return iter->second->token;
22   }
23 
HasEntry(QuicClientSessionCache * cache,const QuicServerId & server_id)24   static bool HasEntry(QuicClientSessionCache* cache,
25                        const QuicServerId& server_id) {
26     return cache->cache_.Lookup(server_id) != cache->cache_.end();
27   }
28 };
29 
30 }  // namespace test
31 }  // namespace quic
32 
33 #endif  // QUICHE_QUIC_TEST_TOOLS_QUIC_CLIENT_SESSION_CACHE_PEER_H_
34