OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "net/base/net_log_unittest.h" | 7 #include "net/base/net_log_unittest.h" |
8 #include "net/http/http_transaction_unittest.h" | 8 #include "net/http/http_transaction_unittest.h" |
9 #include "net/spdy/spdy_http_stream.h" | 9 #include "net/spdy/spdy_http_stream.h" |
10 #include "net/spdy/spdy_network_transaction.h" | 10 #include "net/spdy/spdy_network_transaction.h" |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 helper.AddData(data.get()); | 1017 helper.AddData(data.get()); |
1018 helper.RunPreTestSetup(); | 1018 helper.RunPreTestSetup(); |
1019 helper.RunDefaultTest(); | 1019 helper.RunDefaultTest(); |
1020 TransactionHelperResult out = helper.output(); | 1020 TransactionHelperResult out = helper.output(); |
1021 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); | 1021 EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv); |
1022 } | 1022 } |
1023 | 1023 |
1024 // The client upon cancellation tries to send a RST_STREAM frame. The mock | 1024 // The client upon cancellation tries to send a RST_STREAM frame. The mock |
1025 // socket causes the TCP write to return zero. This test checks that the client | 1025 // socket causes the TCP write to return zero. This test checks that the client |
1026 // tries to queue up the RST_STREAM frame again. | 1026 // tries to queue up the RST_STREAM frame again. |
1027 TEST_P(SpdyNetworkTransactionTest, SocketWriteReturnsZero) { | 1027 TEST_P(SpdyNetworkTransactionTest, DISABLED_SocketWriteReturnsZero) { |
1028 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 1028 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
1029 scoped_ptr<spdy::SpdyFrame> rst( | 1029 scoped_ptr<spdy::SpdyFrame> rst( |
1030 ConstructSpdyRstStream(1, spdy::CANCEL)); | 1030 ConstructSpdyRstStream(1, spdy::CANCEL)); |
1031 MockWrite writes[] = { | 1031 MockWrite writes[] = { |
1032 CreateMockWrite(*req.get(), 1), | 1032 CreateMockWrite(*req.get(), 1), |
1033 MockWrite(true, 0, 0, 3), | 1033 MockWrite(true, 0, 0, 3), |
1034 CreateMockWrite(*rst.get(), 4), | 1034 CreateMockWrite(*rst.get(), 4), |
1035 }; | 1035 }; |
1036 | 1036 |
1037 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); | 1037 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 EXPECT_EQ(ERR_IO_PENDING, rv); | 1300 EXPECT_EQ(ERR_IO_PENDING, rv); |
1301 helper.ResetTrans(); // Cancel the transaction. | 1301 helper.ResetTrans(); // Cancel the transaction. |
1302 | 1302 |
1303 // Flush the MessageLoop while the SpdySessionDependencies (in particular, the | 1303 // Flush the MessageLoop while the SpdySessionDependencies (in particular, the |
1304 // MockClientSocketFactory) are still alive. | 1304 // MockClientSocketFactory) are still alive. |
1305 MessageLoop::current()->RunAllPending(); | 1305 MessageLoop::current()->RunAllPending(); |
1306 helper.VerifyDataNotConsumed(); | 1306 helper.VerifyDataNotConsumed(); |
1307 } | 1307 } |
1308 | 1308 |
1309 // Verify that the client sends a Rst Frame upon cancelling the stream. | 1309 // Verify that the client sends a Rst Frame upon cancelling the stream. |
1310 TEST_P(SpdyNetworkTransactionTest, CancelledTransactionSendRst) { | 1310 TEST_P(SpdyNetworkTransactionTest, DISABLED_CancelledTransactionSendRst) { |
1311 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 1311 scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
1312 scoped_ptr<spdy::SpdyFrame> rst( | 1312 scoped_ptr<spdy::SpdyFrame> rst( |
1313 ConstructSpdyRstStream(1, spdy::CANCEL)); | 1313 ConstructSpdyRstStream(1, spdy::CANCEL)); |
1314 MockWrite writes[] = { | 1314 MockWrite writes[] = { |
1315 CreateMockWrite(*req, 1), | 1315 CreateMockWrite(*req, 1), |
1316 CreateMockWrite(*rst, 3), | 1316 CreateMockWrite(*rst, 3), |
1317 }; | 1317 }; |
1318 | 1318 |
1319 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); | 1319 scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); |
1320 MockRead reads[] = { | 1320 MockRead reads[] = { |
(...skipping 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3164 rv = ReadTransaction(trans.get(), &response_data); | 3164 rv = ReadTransaction(trans.get(), &response_data); |
3165 EXPECT_EQ(OK, rv); | 3165 EXPECT_EQ(OK, rv); |
3166 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 3166 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
3167 EXPECT_EQ("hello!", response_data); | 3167 EXPECT_EQ("hello!", response_data); |
3168 } | 3168 } |
3169 | 3169 |
3170 helper.VerifyDataConsumed(); | 3170 helper.VerifyDataConsumed(); |
3171 } | 3171 } |
3172 } | 3172 } |
3173 } // namespace net | 3173 } // namespace net |
OLD | NEW |