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

Side by Side Diff: net/spdy/spdy_test_util_common.h

Issue 2686673003: Initial fuzzer for SpdySession (Closed)
Patch Set: Apply review feedback Created 3 years, 10 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/spdy/spdy_session_fuzzer.cc ('k') | net/spdy/spdy_test_util_common.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_SPDY_SPDY_TEST_UTIL_COMMON_H_ 5 #ifndef NET_SPDY_SPDY_TEST_UTIL_COMMON_H_
6 #define NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ 6 #define NET_SPDY_SPDY_TEST_UTIL_COMMON_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // Default set of dependencies -- "null" proxy service. 175 // Default set of dependencies -- "null" proxy service.
176 SpdySessionDependencies(); 176 SpdySessionDependencies();
177 177
178 // Custom proxy service dependency. 178 // Custom proxy service dependency.
179 explicit SpdySessionDependencies(std::unique_ptr<ProxyService> proxy_service); 179 explicit SpdySessionDependencies(std::unique_ptr<ProxyService> proxy_service);
180 180
181 ~SpdySessionDependencies(); 181 ~SpdySessionDependencies();
182 182
183 static std::unique_ptr<HttpNetworkSession> SpdyCreateSession( 183 static std::unique_ptr<HttpNetworkSession> SpdyCreateSession(
184 SpdySessionDependencies* session_deps); 184 SpdySessionDependencies* session_deps);
185
186 // Variant that ignores session_deps->socket_factory, and uses the passed in
187 // |factory| instead.
188 static std::unique_ptr<HttpNetworkSession> SpdyCreateSessionWithSocketFactory(
189 SpdySessionDependencies* session_deps,
190 ClientSocketFactory* factory);
185 static HttpNetworkSession::Params CreateSessionParams( 191 static HttpNetworkSession::Params CreateSessionParams(
186 SpdySessionDependencies* session_deps); 192 SpdySessionDependencies* session_deps);
187 193
188 // NOTE: host_resolver must be ordered before http_auth_handler_factory. 194 // NOTE: host_resolver must be ordered before http_auth_handler_factory.
189 std::unique_ptr<MockHostResolverBase> host_resolver; 195 std::unique_ptr<MockHostResolverBase> host_resolver;
190 std::unique_ptr<CertVerifier> cert_verifier; 196 std::unique_ptr<CertVerifier> cert_verifier;
191 std::unique_ptr<ChannelIDService> channel_id_service; 197 std::unique_ptr<ChannelIDService> channel_id_service;
192 std::unique_ptr<TransportSecurityState> transport_security_state; 198 std::unique_ptr<TransportSecurityState> transport_security_state;
193 std::unique_ptr<CTVerifier> cert_transparency_verifier; 199 std::unique_ptr<CTVerifier> cert_transparency_verifier;
194 std::unique_ptr<CTPolicyEnforcer> ct_policy_enforcer; 200 std::unique_ptr<CTPolicyEnforcer> ct_policy_enforcer;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 289
284 class SpdyTestUtil { 290 class SpdyTestUtil {
285 public: 291 public:
286 SpdyTestUtil(); 292 SpdyTestUtil();
287 ~SpdyTestUtil(); 293 ~SpdyTestUtil();
288 294
289 // Add the appropriate headers to put |url| into |block|. 295 // Add the appropriate headers to put |url| into |block|.
290 void AddUrlToHeaderBlock(base::StringPiece url, 296 void AddUrlToHeaderBlock(base::StringPiece url,
291 SpdyHeaderBlock* headers) const; 297 SpdyHeaderBlock* headers) const;
292 298
293 SpdyHeaderBlock ConstructGetHeaderBlock(base::StringPiece url) const; 299 static SpdyHeaderBlock ConstructGetHeaderBlock(base::StringPiece url);
294 SpdyHeaderBlock ConstructGetHeaderBlockForProxy(base::StringPiece url) const; 300 static SpdyHeaderBlock ConstructGetHeaderBlockForProxy(base::StringPiece url);
295 SpdyHeaderBlock ConstructHeadHeaderBlock(base::StringPiece url, 301 static SpdyHeaderBlock ConstructHeadHeaderBlock(base::StringPiece url,
296 int64_t content_length) const; 302 int64_t content_length);
297 SpdyHeaderBlock ConstructPostHeaderBlock(base::StringPiece url, 303 static SpdyHeaderBlock ConstructPostHeaderBlock(base::StringPiece url,
298 int64_t content_length) const; 304 int64_t content_length);
299 SpdyHeaderBlock ConstructPutHeaderBlock(base::StringPiece url, 305 static SpdyHeaderBlock ConstructPutHeaderBlock(base::StringPiece url,
300 int64_t content_length) const; 306 int64_t content_length);
301 307
302 // Construct an expected SPDY reply string from the given headers. 308 // Construct an expected SPDY reply string from the given headers.
303 std::string ConstructSpdyReplyString(const SpdyHeaderBlock& headers) const; 309 std::string ConstructSpdyReplyString(const SpdyHeaderBlock& headers) const;
304 310
305 // Construct an expected SPDY SETTINGS frame. 311 // Construct an expected SPDY SETTINGS frame.
306 // |settings| are the settings to set. 312 // |settings| are the settings to set.
307 // Returns the constructed frame. The caller takes ownership of the frame. 313 // Returns the constructed frame. The caller takes ownership of the frame.
308 SpdySerializedFrame ConstructSpdySettings(const SettingsMap& settings); 314 SpdySerializedFrame ConstructSpdySettings(const SettingsMap& settings);
309 315
310 // Constructs an expected SPDY SETTINGS acknowledgement frame. 316 // Constructs an expected SPDY SETTINGS acknowledgement frame.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 // Serialize a SpdyFrameIR with |headerless_spdy_framer_|. 499 // Serialize a SpdyFrameIR with |headerless_spdy_framer_|.
494 SpdySerializedFrame SerializeFrame(const SpdyFrameIR& frame_ir); 500 SpdySerializedFrame SerializeFrame(const SpdyFrameIR& frame_ir);
495 501
496 // Called when necessary (when it will affect stream dependency specification 502 // Called when necessary (when it will affect stream dependency specification
497 // when setting dependencies based on priorioties) to notify the utility 503 // when setting dependencies based on priorioties) to notify the utility
498 // class of stream destruction. 504 // class of stream destruction.
499 void UpdateWithStreamDestruction(int stream_id); 505 void UpdateWithStreamDestruction(int stream_id);
500 506
501 void set_default_url(const GURL& url) { default_url_ = url; } 507 void set_default_url(const GURL& url) { default_url_ = url; }
502 508
503 const char* GetMethodKey() const; 509 static const char* GetMethodKey();
504 const char* GetStatusKey() const; 510 static const char* GetStatusKey();
505 const char* GetHostKey() const; 511 static const char* GetHostKey();
506 const char* GetSchemeKey() const; 512 static const char* GetSchemeKey();
507 const char* GetPathKey() const; 513 static const char* GetPathKey();
508 514
509 private: 515 private:
510 // |content_length| may be NULL, in which case the content-length 516 // |content_length| may be NULL, in which case the content-length
511 // header will be omitted. 517 // header will be omitted.
512 SpdyHeaderBlock ConstructHeaderBlock(base::StringPiece method, 518 static SpdyHeaderBlock ConstructHeaderBlock(base::StringPiece method,
513 base::StringPiece url, 519 base::StringPiece url,
514 int64_t* content_length) const; 520 int64_t* content_length);
515 521
516 // Multiple SpdyFramers are required to keep track of header compression 522 // Multiple SpdyFramers are required to keep track of header compression
517 // state. 523 // state.
518 // Use to serialize frames (request or response) without headers. 524 // Use to serialize frames (request or response) without headers.
519 SpdyFramer headerless_spdy_framer_; 525 SpdyFramer headerless_spdy_framer_;
520 // Use to serialize request frames with headers. 526 // Use to serialize request frames with headers.
521 SpdyFramer request_spdy_framer_; 527 SpdyFramer request_spdy_framer_;
522 // Use to serialize response frames with headers. 528 // Use to serialize response frames with headers.
523 SpdyFramer response_spdy_framer_; 529 SpdyFramer response_spdy_framer_;
524 530
525 GURL default_url_; 531 GURL default_url_;
526 532
527 // Track a FIFO list of the stream_id of all created requests by priority. 533 // Track a FIFO list of the stream_id of all created requests by priority.
528 std::map<int, std::vector<int>> priority_to_stream_id_list_; 534 std::map<int, std::vector<int>> priority_to_stream_id_list_;
529 }; 535 };
530 536
531 } // namespace net 537 } // namespace net
532 538
533 #endif // NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ 539 #endif // NET_SPDY_SPDY_TEST_UTIL_COMMON_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_session_fuzzer.cc ('k') | net/spdy/spdy_test_util_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698