summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_test_util.cc
diff options
context:
space:
mode:
authorcbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 16:16:59 +0000
committercbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 16:16:59 +0000
commit018aabcf36470b5d2cd625d1b5e1ce4b70772138 (patch)
treebef5a32916a962632c57e18352ad17e8a1c086fd /net/spdy/spdy_test_util.cc
parentc8386693c8e8cb4b9da464a62d1004cb3cc8efff (diff)
downloadchromium_src-018aabcf36470b5d2cd625d1b5e1ce4b70772138.zip
chromium_src-018aabcf36470b5d2cd625d1b5e1ce4b70772138.tar.gz
chromium_src-018aabcf36470b5d2cd625d1b5e1ce4b70772138.tar.bz2
Add unit test for Basic authentication over SPDY.
BUG=46620 TEST=net_unittests --gtest_filter="*SpdyBasicAuth*" Review URL: http://codereview.chromium.org/4148009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64433 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_test_util.cc')
-rw-r--r--net/spdy/spdy_test_util.cc59
1 files changed, 26 insertions, 33 deletions
diff --git a/net/spdy/spdy_test_util.cc b/net/spdy/spdy_test_util.cc
index d3b82c0c6..896cd9d 100644
--- a/net/spdy/spdy_test_util.cc
+++ b/net/spdy/spdy_test_util.cc
@@ -519,23 +519,23 @@ spdy::SpdyFrame* ConstructSpdyPush(const char* const extra_headers[],
associated_stream_id);
}
-// Constructs a standard SPDY SYN_REPLY packet to match the SPDY GET.
-// |extra_headers| are the extra header-value pairs, which typically
-// will vary the most between calls.
+// Constructs a standard SPDY SYN_REPLY packet with the specified status code.
// Returns a SpdyFrame.
-spdy::SpdyFrame* ConstructSpdyGetSynReplyRedirect(int stream_id) {
- static const char* const kStandardGetHeaders[] = {
+spdy::SpdyFrame* ConstructSpdySynReplyError(
+ const char* const status,
+ const char* const* const extra_headers,
+ int extra_header_count,
+ int stream_id) {
+ const char* const kStandardGetHeaders[] = {
"hello",
"bye",
"status",
- "301 Moved Permanently",
- "location",
- "http://www.foo.com/index.php",
+ status,
"version",
"HTTP/1.1"
};
- return ConstructSpdyControlFrame(NULL,
- 0,
+ return ConstructSpdyControlFrame(extra_headers,
+ extra_header_count,
false,
stream_id,
LOWEST,
@@ -545,35 +545,28 @@ spdy::SpdyFrame* ConstructSpdyGetSynReplyRedirect(int stream_id) {
arraysize(kStandardGetHeaders));
}
+// Constructs a standard SPDY SYN_REPLY packet to match the SPDY GET.
+// |extra_headers| are the extra header-value pairs, which typically
+// will vary the most between calls.
+// Returns a SpdyFrame.
+spdy::SpdyFrame* ConstructSpdyGetSynReplyRedirect(int stream_id) {
+ static const char* const kExtraHeaders[] = {
+ "location",
+ "http://www.foo.com/index.php",
+ };
+ return ConstructSpdySynReplyError("301 Moved Permanently", kExtraHeaders,
+ arraysize(kExtraHeaders)/2, stream_id);
+}
+
// Constructs a standard SPDY SYN_REPLY packet with an Internal Server
// Error status code.
// Returns a SpdyFrame.
spdy::SpdyFrame* ConstructSpdySynReplyError(int stream_id) {
- return ConstructSpdySynReplyError("500 Internal Server Error", 1);
+ return ConstructSpdySynReplyError("500 Internal Server Error", NULL, 0, 1);
}
-// Constructs a standard SPDY SYN_REPLY packet with the specified status code.
-// Returns a SpdyFrame.
-spdy::SpdyFrame* ConstructSpdySynReplyError(const char* const status,
- int stream_id) {
- static const char* const kStandardGetHeaders[] = {
- "hello",
- "bye",
- "status",
- status,
- "version",
- "HTTP/1.1"
- };
- return ConstructSpdyControlFrame(NULL,
- 0,
- false,
- stream_id,
- LOWEST,
- spdy::SYN_REPLY,
- spdy::CONTROL_FLAG_NONE,
- kStandardGetHeaders,
- arraysize(kStandardGetHeaders));
-}
+
+
// Constructs a standard SPDY SYN_REPLY packet to match the SPDY GET.
// |extra_headers| are the extra header-value pairs, which typically