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

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

Issue 17760008: [SPDY] Enable tests for SPDY/3.1 and SPDY/4 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_stream_unittest.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 <string>
9 #include <vector>
10
8 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
10 #include "crypto/ec_private_key.h" 13 #include "crypto/ec_private_key.h"
11 #include "crypto/ec_signature_creator.h" 14 #include "crypto/ec_signature_creator.h"
12 #include "net/base/completion_callback.h" 15 #include "net/base/completion_callback.h"
13 #include "net/base/request_priority.h" 16 #include "net/base/request_priority.h"
14 #include "net/base/test_completion_callback.h" 17 #include "net/base/test_completion_callback.h"
15 #include "net/cert/cert_verifier.h" 18 #include "net/cert/cert_verifier.h"
16 #include "net/dns/mock_host_resolver.h" 19 #include "net/dns/mock_host_resolver.h"
17 #include "net/http/http_auth_handler_factory.h" 20 #include "net/http/http_auth_handler_factory.h"
(...skipping 18 matching lines...) Expand all
36 class SpdySession; 39 class SpdySession;
37 class SpdyStream; 40 class SpdyStream;
38 class SpdyStreamRequest; 41 class SpdyStreamRequest;
39 42
40 // Default upload data used by both, mock objects and framer when creating 43 // Default upload data used by both, mock objects and framer when creating
41 // data frames. 44 // data frames.
42 const char kDefaultURL[] = "http://www.google.com"; 45 const char kDefaultURL[] = "http://www.google.com";
43 const char kUploadData[] = "hello!"; 46 const char kUploadData[] = "hello!";
44 const int kUploadDataSize = arraysize(kUploadData)-1; 47 const int kUploadDataSize = arraysize(kUploadData)-1;
45 48
49 // SpdyNextProtos returns a vector of NPN protocol strings for negotiating
50 // SPDY.
51 std::vector<std::string> SpdyNextProtos();
52
46 // Chop a frame into an array of MockWrites. 53 // Chop a frame into an array of MockWrites.
47 // |data| is the frame to chop. 54 // |data| is the frame to chop.
48 // |length| is the length of the frame to chop. 55 // |length| is the length of the frame to chop.
49 // |num_chunks| is the number of chunks to create. 56 // |num_chunks| is the number of chunks to create.
50 MockWrite* ChopWriteFrame(const char* data, int length, int num_chunks); 57 MockWrite* ChopWriteFrame(const char* data, int length, int num_chunks);
51 58
52 // Chop a SpdyFrame into an array of MockWrites. 59 // Chop a SpdyFrame into an array of MockWrites.
53 // |frame| is the frame to chop. 60 // |frame| is the frame to chop.
54 // |num_chunks| is the number of chunks to create. 61 // |num_chunks| is the number of chunks to create.
55 MockWrite* ChopWriteFrame(const SpdyFrame& frame, int num_chunks); 62 MockWrite* ChopWriteFrame(const SpdyFrame& frame, int num_chunks);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 DISALLOW_COPY_AND_ASSIGN(SpdySessionPoolPeer); 248 DISALLOW_COPY_AND_ASSIGN(SpdySessionPoolPeer);
242 }; 249 };
243 250
244 // TODO(ttuttle): Move these somewhere more widely-accessible; surely this is 251 // TODO(ttuttle): Move these somewhere more widely-accessible; surely this is
245 // not the only place that needs such functions. 252 // not the only place that needs such functions.
246 NextProto NextProtoFromSpdyVersion(SpdyMajorVersion spdy_version); 253 NextProto NextProtoFromSpdyVersion(SpdyMajorVersion spdy_version);
247 // TODO(akalin): Merge this with NPNToSpdyVersion() in 254 // TODO(akalin): Merge this with NPNToSpdyVersion() in
248 // spdy_session.cc. 255 // spdy_session.cc.
249 SpdyMajorVersion SpdyVersionFromNextProto(NextProto next_proto); 256 SpdyMajorVersion SpdyVersionFromNextProto(NextProto next_proto);
250 257
258 AlternateProtocol AlternateProtocolFromNextProto(NextProto next_proto);
259
251 class SpdyTestUtil { 260 class SpdyTestUtil {
252 public: 261 public:
253 explicit SpdyTestUtil(NextProto protocol); 262 explicit SpdyTestUtil(NextProto protocol);
254 263
255 // Add the appropriate headers to put |url| into |block|. 264 // Add the appropriate headers to put |url| into |block|.
256 void AddUrlToHeaderBlock(base::StringPiece url, 265 void AddUrlToHeaderBlock(base::StringPiece url,
257 SpdyHeaderBlock* headers) const; 266 SpdyHeaderBlock* headers) const;
258 267
259 scoped_ptr<SpdyHeaderBlock> ConstructGetHeaderBlock( 268 scoped_ptr<SpdyHeaderBlock> ConstructGetHeaderBlock(
260 base::StringPiece url) const; 269 base::StringPiece url) const;
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 base::StringPiece url, 498 base::StringPiece url,
490 int64* content_length) const; 499 int64* content_length) const;
491 500
492 const NextProto protocol_; 501 const NextProto protocol_;
493 const SpdyMajorVersion spdy_version_; 502 const SpdyMajorVersion spdy_version_;
494 }; 503 };
495 504
496 } // namespace net 505 } // namespace net
497 506
498 #endif // NET_SPDY_SPDY_TEST_UTIL_COMMON_H_ 507 #endif // NET_SPDY_SPDY_TEST_UTIL_COMMON_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_stream_unittest.cc ('k') | net/spdy/spdy_test_util_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698