| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/string_piece.h" | 8 #include "base/string_piece.h" |
| 9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
| 10 #include "net/base/net_log_unittest.h" | 10 #include "net/base/net_log_unittest.h" |
| 11 #include "net/base/request_priority.h" |
| 11 #include "net/spdy/buffered_spdy_framer.h" | 12 #include "net/spdy/buffered_spdy_framer.h" |
| 12 #include "net/spdy/spdy_stream.h" | 13 #include "net/spdy/spdy_stream.h" |
| 13 #include "net/spdy/spdy_http_utils.h" | 14 #include "net/spdy/spdy_http_utils.h" |
| 14 #include "net/spdy/spdy_protocol.h" | 15 #include "net/spdy/spdy_protocol.h" |
| 15 #include "net/spdy/spdy_session.h" | 16 #include "net/spdy/spdy_session.h" |
| 16 #include "net/spdy/spdy_stream_test_util.h" | 17 #include "net/spdy/spdy_stream_test_util.h" |
| 17 #include "net/spdy/spdy_test_util_common.h" | 18 #include "net/spdy/spdy_test_util_common.h" |
| 18 #include "net/spdy/spdy_test_util_spdy3.h" | 19 #include "net/spdy/spdy_test_util_spdy3.h" |
| 19 #include "net/spdy/spdy_websocket_test_util_spdy3.h" | 20 #include "net/spdy/spdy_websocket_test_util_spdy3.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 OrderedSocketData data(reads, arraysize(reads), NULL, 0); | 224 OrderedSocketData data(reads, arraysize(reads), NULL, 0); |
| 224 MockConnect connect_data(SYNCHRONOUS, OK); | 225 MockConnect connect_data(SYNCHRONOUS, OK); |
| 225 data.set_connect_data(connect_data); | 226 data.set_connect_data(connect_data); |
| 226 | 227 |
| 227 session_deps_.socket_factory->AddSocketDataProvider(&data); | 228 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 228 | 229 |
| 229 InitializeSpdySession(spdy_session, host_port_pair_); | 230 InitializeSpdySession(spdy_session, host_port_pair_); |
| 230 BoundNetLog net_log; | 231 BoundNetLog net_log; |
| 231 | 232 |
| 232 // Conjure up a stream. | 233 // Conjure up a stream. |
| 233 scoped_refptr<SpdyStream> stream = new SpdyStream(spdy_session, | 234 scoped_refptr<SpdyStream> stream = |
| 234 true, | 235 new SpdyStream(spdy_session, |
| 235 net_log); | 236 std::string(), |
| 237 DEFAULT_PRIORITY, |
| 238 kSpdyStreamInitialWindowSize, |
| 239 kSpdyStreamInitialWindowSize, |
| 240 true, |
| 241 net_log); |
| 236 stream->set_stream_id(2); | 242 stream->set_stream_id(2); |
| 237 EXPECT_FALSE(stream->response_received()); | 243 EXPECT_FALSE(stream->response_received()); |
| 238 EXPECT_FALSE(stream->HasUrl()); | 244 EXPECT_FALSE(stream->HasUrl()); |
| 239 | 245 |
| 240 // Set a couple of headers. | 246 // Set a couple of headers. |
| 241 SpdyHeaderBlock response; | 247 SpdyHeaderBlock response; |
| 242 GURL url(kStreamUrl); | 248 GURL url(kStreamUrl); |
| 243 response[":host"] = url.host(); | 249 response[":host"] = url.host(); |
| 244 response[":scheme"] = url.scheme(); | 250 response[":scheme"] = url.scheme(); |
| 245 response[":path"] = url.path(); | 251 response[":path"] = url.path(); |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 EXPECT_EQ("HTTP/1.1", delegate.GetResponseHeaderValue(":version")); | 571 EXPECT_EQ("HTTP/1.1", delegate.GetResponseHeaderValue(":version")); |
| 566 EXPECT_EQ(std::string(kPostBody, kPostBodyLength), delegate.received_data()); | 572 EXPECT_EQ(std::string(kPostBody, kPostBodyLength), delegate.received_data()); |
| 567 EXPECT_EQ(static_cast<int>(kPostBodyLength), delegate.body_data_sent()); | 573 EXPECT_EQ(static_cast<int>(kPostBodyLength), delegate.body_data_sent()); |
| 568 } | 574 } |
| 569 | 575 |
| 570 } // namespace | 576 } // namespace |
| 571 | 577 |
| 572 } // namespace test | 578 } // namespace test |
| 573 | 579 |
| 574 } // namespace net | 580 } // namespace net |
| OLD | NEW |