OLD | NEW |
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 #include "net/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/pending_task.h" | 10 #include "base/pending_task.h" |
11 #include "base/string_piece.h" | 11 #include "base/string_piece.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "net/base/cert_test_util.h" | 13 #include "net/base/cert_test_util.h" |
14 #include "net/base/host_cache.h" | 14 #include "net/base/host_cache.h" |
15 #include "net/base/io_buffer.h" | 15 #include "net/base/io_buffer.h" |
16 #include "net/base/ip_endpoint.h" | 16 #include "net/base/ip_endpoint.h" |
17 #include "net/base/net_log_unittest.h" | 17 #include "net/base/net_log_unittest.h" |
| 18 #include "net/base/request_priority.h" |
18 #include "net/base/test_data_directory.h" | 19 #include "net/base/test_data_directory.h" |
19 #include "net/base/test_data_stream.h" | 20 #include "net/base/test_data_stream.h" |
20 #include "net/spdy/spdy_http_utils.h" | 21 #include "net/spdy/spdy_http_utils.h" |
21 #include "net/spdy/spdy_io_buffer.h" | 22 #include "net/spdy/spdy_io_buffer.h" |
22 #include "net/spdy/spdy_session_pool.h" | 23 #include "net/spdy/spdy_session_pool.h" |
23 #include "net/spdy/spdy_session_test_util.h" | 24 #include "net/spdy/spdy_session_test_util.h" |
24 #include "net/spdy/spdy_stream.h" | 25 #include "net/spdy/spdy_stream.h" |
25 #include "net/spdy/spdy_stream_test_util.h" | 26 #include "net/spdy/spdy_stream_test_util.h" |
26 #include "net/spdy/spdy_test_util_common.h" | 27 #include "net/spdy/spdy_test_util_common.h" |
27 #include "net/spdy/spdy_test_util_spdy3.h" | 28 #include "net/spdy/spdy_test_util_spdy3.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // Give the session a SPDY3 framer. | 311 // Give the session a SPDY3 framer. |
311 session->buffered_spdy_framer_.reset(new BufferedSpdyFramer(3, false)); | 312 session->buffered_spdy_framer_.reset(new BufferedSpdyFramer(3, false)); |
312 | 313 |
313 // Create the associated stream and add to active streams. | 314 // Create the associated stream and add to active streams. |
314 scoped_ptr<SpdyHeaderBlock> request_headers(new SpdyHeaderBlock); | 315 scoped_ptr<SpdyHeaderBlock> request_headers(new SpdyHeaderBlock); |
315 (*request_headers)[":scheme"] = "http"; | 316 (*request_headers)[":scheme"] = "http"; |
316 (*request_headers)[":host"] = "www.google.com"; | 317 (*request_headers)[":host"] = "www.google.com"; |
317 (*request_headers)[":path"] = "/"; | 318 (*request_headers)[":path"] = "/"; |
318 | 319 |
319 scoped_refptr<SpdyStream> stream( | 320 scoped_refptr<SpdyStream> stream( |
320 new SpdyStream(session, false, session->net_log_)); | 321 new SpdyStream(session, std::string(), DEFAULT_PRIORITY, |
| 322 kSpdyStreamInitialWindowSize, |
| 323 kSpdyStreamInitialWindowSize, |
| 324 false, session->net_log_)); |
321 stream->set_spdy_headers(request_headers.Pass()); | 325 stream->set_spdy_headers(request_headers.Pass()); |
322 session->ActivateStream(stream); | 326 session->ActivateStream(stream); |
323 | 327 |
324 SpdyHeaderBlock headers; | 328 SpdyHeaderBlock headers; |
325 headers[":scheme"] = "http"; | 329 headers[":scheme"] = "http"; |
326 headers[":host"] = "www.google.com"; | 330 headers[":host"] = "www.google.com"; |
327 headers[":path"] = "/a.dat"; | 331 headers[":path"] = "/a.dat"; |
328 session->OnSynStream(2, 1, 0, 0, true, false, headers); | 332 session->OnSynStream(2, 1, 0, 0, true, false, headers); |
329 | 333 |
330 // Verify that there is one unclaimed push stream. | 334 // Verify that there is one unclaimed push stream. |
(...skipping 2639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2970 EXPECT_EQ(0, delegate1.body_data_sent()); | 2974 EXPECT_EQ(0, delegate1.body_data_sent()); |
2971 | 2975 |
2972 EXPECT_TRUE(delegate2.send_headers_completed()); | 2976 EXPECT_TRUE(delegate2.send_headers_completed()); |
2973 EXPECT_EQ("200", delegate2.GetResponseHeaderValue(":status")); | 2977 EXPECT_EQ("200", delegate2.GetResponseHeaderValue(":status")); |
2974 EXPECT_EQ("HTTP/1.1", delegate2.GetResponseHeaderValue(":version")); | 2978 EXPECT_EQ("HTTP/1.1", delegate2.GetResponseHeaderValue(":version")); |
2975 EXPECT_EQ("", delegate2.received_data()); | 2979 EXPECT_EQ("", delegate2.received_data()); |
2976 EXPECT_EQ(0, delegate2.body_data_sent()); | 2980 EXPECT_EQ(0, delegate2.body_data_sent()); |
2977 } | 2981 } |
2978 | 2982 |
2979 } // namespace net | 2983 } // namespace net |
OLD | NEW |