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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 2421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2432 // Finish running rest of tasks. | 2432 // Finish running rest of tasks. |
2433 base::RunLoop().RunUntilIdle(); | 2433 base::RunLoop().RunUntilIdle(); |
2434 helper.VerifyDataConsumed(); | 2434 helper.VerifyDataConsumed(); |
2435 } | 2435 } |
2436 | 2436 |
2437 // Send a spdy request to www.google.com that gets redirected to www.foo.com. | 2437 // Send a spdy request to www.google.com that gets redirected to www.foo.com. |
2438 TEST_P(SpdyNetworkTransactionTest, RedirectGetRequest) { | 2438 TEST_P(SpdyNetworkTransactionTest, RedirectGetRequest) { |
2439 scoped_ptr<SpdyHeaderBlock> headers( | 2439 scoped_ptr<SpdyHeaderBlock> headers( |
2440 spdy_util_.ConstructGetHeaderBlock("http://www.google.com/")); | 2440 spdy_util_.ConstructGetHeaderBlock("http://www.google.com/")); |
2441 (*headers)["user-agent"] = ""; | 2441 (*headers)["user-agent"] = ""; |
2442 (*headers)["accept-encoding"] = "gzip,deflate"; | 2442 (*headers)["accept-encoding"] = "gzip, deflate"; |
2443 scoped_ptr<SpdyHeaderBlock> headers2( | 2443 scoped_ptr<SpdyHeaderBlock> headers2( |
2444 spdy_util_.ConstructGetHeaderBlock("http://www.foo.com/index.php")); | 2444 spdy_util_.ConstructGetHeaderBlock("http://www.foo.com/index.php")); |
2445 (*headers2)["user-agent"] = ""; | 2445 (*headers2)["user-agent"] = ""; |
2446 (*headers2)["accept-encoding"] = "gzip,deflate"; | 2446 (*headers2)["accept-encoding"] = "gzip, deflate"; |
2447 | 2447 |
2448 // Setup writes/reads to www.google.com | 2448 // Setup writes/reads to www.google.com |
2449 scoped_ptr<SpdyFrame> req( | 2449 scoped_ptr<SpdyFrame> req( |
2450 spdy_util_.ConstructSpdySyn(1, *headers, LOWEST, false, true)); | 2450 spdy_util_.ConstructSpdySyn(1, *headers, LOWEST, false, true)); |
2451 scoped_ptr<SpdyFrame> req2( | 2451 scoped_ptr<SpdyFrame> req2( |
2452 spdy_util_.ConstructSpdySyn(1, *headers2, LOWEST, false, true)); | 2452 spdy_util_.ConstructSpdySyn(1, *headers2, LOWEST, false, true)); |
2453 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReplyRedirect(1)); | 2453 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReplyRedirect(1)); |
2454 MockWrite writes[] = { | 2454 MockWrite writes[] = { |
2455 CreateMockWrite(*req, 1), | 2455 CreateMockWrite(*req, 1), |
2456 }; | 2456 }; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2511 EXPECT_TRUE(data2.at_read_eof()); | 2511 EXPECT_TRUE(data2.at_read_eof()); |
2512 EXPECT_TRUE(data2.at_write_eof()); | 2512 EXPECT_TRUE(data2.at_write_eof()); |
2513 } | 2513 } |
2514 | 2514 |
2515 // Send a spdy request to www.google.com. Get a pushed stream that redirects to | 2515 // Send a spdy request to www.google.com. Get a pushed stream that redirects to |
2516 // www.foo.com. | 2516 // www.foo.com. |
2517 TEST_P(SpdyNetworkTransactionTest, RedirectServerPush) { | 2517 TEST_P(SpdyNetworkTransactionTest, RedirectServerPush) { |
2518 scoped_ptr<SpdyHeaderBlock> headers( | 2518 scoped_ptr<SpdyHeaderBlock> headers( |
2519 spdy_util_.ConstructGetHeaderBlock("http://www.google.com/")); | 2519 spdy_util_.ConstructGetHeaderBlock("http://www.google.com/")); |
2520 (*headers)["user-agent"] = ""; | 2520 (*headers)["user-agent"] = ""; |
2521 (*headers)["accept-encoding"] = "gzip,deflate"; | 2521 (*headers)["accept-encoding"] = "gzip, deflate"; |
2522 | 2522 |
2523 // Setup writes/reads to www.google.com | 2523 // Setup writes/reads to www.google.com |
2524 scoped_ptr<SpdyFrame> req( | 2524 scoped_ptr<SpdyFrame> req( |
2525 spdy_util_.ConstructSpdySyn(1, *headers, LOWEST, false, true)); | 2525 spdy_util_.ConstructSpdySyn(1, *headers, LOWEST, false, true)); |
2526 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 2526 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
2527 scoped_ptr<SpdyFrame> rep( | 2527 scoped_ptr<SpdyFrame> rep( |
2528 spdy_util_.ConstructSpdyPush(NULL, | 2528 spdy_util_.ConstructSpdyPush(NULL, |
2529 0, | 2529 0, |
2530 2, | 2530 2, |
2531 1, | 2531 1, |
(...skipping 12 matching lines...) Expand all Loading... |
2544 CreateMockRead(*rep, 3), | 2544 CreateMockRead(*rep, 3), |
2545 CreateMockRead(*body, 4), | 2545 CreateMockRead(*body, 4), |
2546 MockRead(ASYNC, ERR_IO_PENDING, 5), // Force a pause | 2546 MockRead(ASYNC, ERR_IO_PENDING, 5), // Force a pause |
2547 MockRead(ASYNC, 0, 0, 7) // EOF | 2547 MockRead(ASYNC, 0, 0, 7) // EOF |
2548 }; | 2548 }; |
2549 | 2549 |
2550 // Setup writes/reads to www.foo.com | 2550 // Setup writes/reads to www.foo.com |
2551 scoped_ptr<SpdyHeaderBlock> headers2( | 2551 scoped_ptr<SpdyHeaderBlock> headers2( |
2552 spdy_util_.ConstructGetHeaderBlock("http://www.foo.com/index.php")); | 2552 spdy_util_.ConstructGetHeaderBlock("http://www.foo.com/index.php")); |
2553 (*headers2)["user-agent"] = ""; | 2553 (*headers2)["user-agent"] = ""; |
2554 (*headers2)["accept-encoding"] = "gzip,deflate"; | 2554 (*headers2)["accept-encoding"] = "gzip, deflate"; |
2555 scoped_ptr<SpdyFrame> req2( | 2555 scoped_ptr<SpdyFrame> req2( |
2556 spdy_util_.ConstructSpdySyn(1, *headers2, LOWEST, false, true)); | 2556 spdy_util_.ConstructSpdySyn(1, *headers2, LOWEST, false, true)); |
2557 scoped_ptr<SpdyFrame> resp2(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 2557 scoped_ptr<SpdyFrame> resp2(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
2558 scoped_ptr<SpdyFrame> body2(spdy_util_.ConstructSpdyBodyFrame(1, true)); | 2558 scoped_ptr<SpdyFrame> body2(spdy_util_.ConstructSpdyBodyFrame(1, true)); |
2559 MockWrite writes2[] = { | 2559 MockWrite writes2[] = { |
2560 CreateMockWrite(*req2, 1), | 2560 CreateMockWrite(*req2, 1), |
2561 }; | 2561 }; |
2562 MockRead reads2[] = { | 2562 MockRead reads2[] = { |
2563 CreateMockRead(*resp2, 2), | 2563 CreateMockRead(*resp2, 2), |
2564 CreateMockRead(*body2, 3), | 2564 CreateMockRead(*body2, 3), |
(...skipping 4048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6613 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6613 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
6614 scoped_ptr<SSLSocketDataProvider> ssl_provider( | 6614 scoped_ptr<SSLSocketDataProvider> ssl_provider( |
6615 new SSLSocketDataProvider(ASYNC, OK)); | 6615 new SSLSocketDataProvider(ASYNC, OK)); |
6616 // Set to TLS_RSA_WITH_NULL_MD5 | 6616 // Set to TLS_RSA_WITH_NULL_MD5 |
6617 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6617 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
6618 | 6618 |
6619 RunTLSUsageCheckTest(ssl_provider.Pass()); | 6619 RunTLSUsageCheckTest(ssl_provider.Pass()); |
6620 } | 6620 } |
6621 | 6621 |
6622 } // namespace net | 6622 } // namespace net |
OLD | NEW |