Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: net/tools/quic/test_tools/quic_test_client.h

Issue 2589983002: Create a QUIC wrapper around scoped_refptr. (Closed)
Patch Set: rm = nullptr Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/tools/quic/stateless_rejector.cc ('k') | net/tools/quic/test_tools/quic_test_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ 5 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_
6 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ 6 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 std::unique_ptr<ProofVerifier> proof_verifier); 106 std::unique_ptr<ProofVerifier> proof_verifier);
107 107
108 ~QuicTestClient() override; 108 ~QuicTestClient() override;
109 109
110 // Sets the |user_agent_id| of the |client_|. 110 // Sets the |user_agent_id| of the |client_|.
111 void SetUserAgentID(const std::string& user_agent_id); 111 void SetUserAgentID(const std::string& user_agent_id);
112 112
113 // Wraps data in a quic packet and sends it. 113 // Wraps data in a quic packet and sends it.
114 ssize_t SendData(const std::string& data, bool last_data); 114 ssize_t SendData(const std::string& data, bool last_data);
115 // As above, but |delegate| will be notified when |data| is ACKed. 115 // As above, but |delegate| will be notified when |data| is ACKed.
116 ssize_t SendData(const std::string& data, 116 ssize_t SendData(
117 bool last_data, 117 const std::string& data,
118 scoped_refptr<QuicAckListenerInterface> delegate); 118 bool last_data,
119 QuicReferenceCountedPointer<QuicAckListenerInterface> delegate);
119 120
120 // Clears any outstanding state and sends a simple GET of 'uri' to the 121 // Clears any outstanding state and sends a simple GET of 'uri' to the
121 // server. Returns 0 if the request failed and no bytes were written. 122 // server. Returns 0 if the request failed and no bytes were written.
122 ssize_t SendRequest(const std::string& uri); 123 ssize_t SendRequest(const std::string& uri);
123 // Sends requests for all the urls and waits for the responses. To process 124 // Sends requests for all the urls and waits for the responses. To process
124 // the individual responses as they are returned, the caller should use the 125 // the individual responses as they are returned, the caller should use the
125 // set the response_listener on the client(). 126 // set the response_listener on the client().
126 void SendRequestsAndWaitForResponses( 127 void SendRequestsAndWaitForResponses(
127 const std::vector<std::string>& url_list); 128 const std::vector<std::string>& url_list);
128 // Sends a request containing |headers| and |body| and returns the number of 129 // Sends a request containing |headers| and |body| and returns the number of
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // Returns nullptr if the maximum number of streams have already been created. 213 // Returns nullptr if the maximum number of streams have already been created.
213 QuicSpdyClientStream* GetOrCreateStream(); 214 QuicSpdyClientStream* GetOrCreateStream();
214 215
215 // Calls GetOrCreateStream(), sends the request on the stream, and 216 // Calls GetOrCreateStream(), sends the request on the stream, and
216 // stores the request in case it needs to be resent. If |headers| is 217 // stores the request in case it needs to be resent. If |headers| is
217 // null, only the body will be sent on the stream. 218 // null, only the body will be sent on the stream.
218 ssize_t GetOrCreateStreamAndSendRequest( 219 ssize_t GetOrCreateStreamAndSendRequest(
219 const SpdyHeaderBlock* headers, 220 const SpdyHeaderBlock* headers,
220 base::StringPiece body, 221 base::StringPiece body,
221 bool fin, 222 bool fin,
222 scoped_refptr<QuicAckListenerInterface> delegate); 223 QuicReferenceCountedPointer<QuicAckListenerInterface> delegate);
223 224
224 QuicRstStreamErrorCode stream_error() { return stream_error_; } 225 QuicRstStreamErrorCode stream_error() { return stream_error_; }
225 QuicErrorCode connection_error(); 226 QuicErrorCode connection_error();
226 227
227 MockableQuicClient* client(); 228 MockableQuicClient* client();
228 229
229 // cert_common_name returns the common name value of the server's certificate, 230 // cert_common_name returns the common name value of the server's certificate,
230 // or the empty string if no certificate was presented. 231 // or the empty string if no certificate was presented.
231 const std::string& cert_common_name() const; 232 const std::string& cert_common_name() const;
232 233
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 void Initialize(); 270 void Initialize();
270 271
271 void set_client(MockableQuicClient* client) { client_.reset(client); } 272 void set_client(MockableQuicClient* client) { client_.reset(client); }
272 273
273 protected: 274 protected:
274 QuicTestClient(); 275 QuicTestClient();
275 276
276 private: 277 private:
277 class TestClientDataToResend : public QuicClient::QuicDataToResend { 278 class TestClientDataToResend : public QuicClient::QuicDataToResend {
278 public: 279 public:
279 TestClientDataToResend(std::unique_ptr<SpdyHeaderBlock> headers, 280 TestClientDataToResend(
280 base::StringPiece body, 281 std::unique_ptr<SpdyHeaderBlock> headers,
281 bool fin, 282 base::StringPiece body,
282 QuicTestClient* test_client, 283 bool fin,
283 scoped_refptr<QuicAckListenerInterface> delegate); 284 QuicTestClient* test_client,
285 QuicReferenceCountedPointer<QuicAckListenerInterface> delegate);
284 286
285 ~TestClientDataToResend() override; 287 ~TestClientDataToResend() override;
286 288
287 void Resend() override; 289 void Resend() override;
288 290
289 protected: 291 protected:
290 QuicTestClient* test_client_; 292 QuicTestClient* test_client_;
291 scoped_refptr<QuicAckListenerInterface> delegate_; 293 QuicReferenceCountedPointer<QuicAckListenerInterface> delegate_;
292 }; 294 };
293 295
294 // Given |uri|, populates the fields in |headers| for a simple GET 296 // Given |uri|, populates the fields in |headers| for a simple GET
295 // request. If |uri| is a relative URL, the QuicServerId will be 297 // request. If |uri| is a relative URL, the QuicServerId will be
296 // use to specify the authority. 298 // use to specify the authority.
297 bool PopulateHeaderBlockFromUrl(const std::string& uri, 299 bool PopulateHeaderBlockFromUrl(const std::string& uri,
298 SpdyHeaderBlock* headers); 300 SpdyHeaderBlock* headers);
299 301
300 bool HaveActiveStream(); 302 bool HaveActiveStream();
301 303
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 std::string override_sni_; 346 std::string override_sni_;
345 347
346 DISALLOW_COPY_AND_ASSIGN(QuicTestClient); 348 DISALLOW_COPY_AND_ASSIGN(QuicTestClient);
347 }; 349 };
348 350
349 } // namespace test 351 } // namespace test
350 352
351 } // namespace net 353 } // namespace net
352 354
353 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_ 355 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_CLIENT_H_
OLDNEW
« no previous file with comments | « net/tools/quic/stateless_rejector.cc ('k') | net/tools/quic/test_tools/quic_test_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698