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 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2489 OrderedSocketData data2(reads2, arraysize(reads2), | 2489 OrderedSocketData data2(reads2, arraysize(reads2), |
2490 writes2, arraysize(writes2)); | 2490 writes2, arraysize(writes2)); |
2491 | 2491 |
2492 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN | 2492 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN |
2493 TestDelegate d; | 2493 TestDelegate d; |
2494 { | 2494 { |
2495 SpdyURLRequestContext spdy_url_request_context( | 2495 SpdyURLRequestContext spdy_url_request_context( |
2496 GetParam().protocol, | 2496 GetParam().protocol, |
2497 false /* force_spdy_over_ssl*/, | 2497 false /* force_spdy_over_ssl*/, |
2498 true /* force_spdy_always */); | 2498 true /* force_spdy_always */); |
2499 net::URLRequest r(GURL("http://www.google.com/"), | 2499 scoped_ptr<URLRequest> r( |
2500 DEFAULT_PRIORITY, | 2500 spdy_url_request_context.CreateRequest(GURL("http://www.google.com/"), |
2501 &d, | 2501 DEFAULT_PRIORITY, |
2502 &spdy_url_request_context); | 2502 &d, |
| 2503 NULL)); |
2503 spdy_url_request_context.socket_factory(). | 2504 spdy_url_request_context.socket_factory(). |
2504 AddSocketDataProvider(&data); | 2505 AddSocketDataProvider(&data); |
2505 spdy_url_request_context.socket_factory(). | 2506 spdy_url_request_context.socket_factory(). |
2506 AddSocketDataProvider(&data2); | 2507 AddSocketDataProvider(&data2); |
2507 | 2508 |
2508 d.set_quit_on_redirect(true); | 2509 d.set_quit_on_redirect(true); |
2509 r.Start(); | 2510 r->Start(); |
2510 base::RunLoop().Run(); | 2511 base::RunLoop().Run(); |
2511 | 2512 |
2512 EXPECT_EQ(1, d.received_redirect_count()); | 2513 EXPECT_EQ(1, d.received_redirect_count()); |
2513 | 2514 |
2514 r.FollowDeferredRedirect(); | 2515 r->FollowDeferredRedirect(); |
2515 base::RunLoop().Run(); | 2516 base::RunLoop().Run(); |
2516 EXPECT_EQ(1, d.response_started_count()); | 2517 EXPECT_EQ(1, d.response_started_count()); |
2517 EXPECT_FALSE(d.received_data_before_response()); | 2518 EXPECT_FALSE(d.received_data_before_response()); |
2518 EXPECT_EQ(net::URLRequestStatus::SUCCESS, r.status().status()); | 2519 EXPECT_EQ(net::URLRequestStatus::SUCCESS, r->status().status()); |
2519 std::string contents("hello!"); | 2520 std::string contents("hello!"); |
2520 EXPECT_EQ(contents, d.data_received()); | 2521 EXPECT_EQ(contents, d.data_received()); |
2521 } | 2522 } |
2522 EXPECT_TRUE(data.at_read_eof()); | 2523 EXPECT_TRUE(data.at_read_eof()); |
2523 EXPECT_TRUE(data.at_write_eof()); | 2524 EXPECT_TRUE(data.at_write_eof()); |
2524 EXPECT_TRUE(data2.at_read_eof()); | 2525 EXPECT_TRUE(data2.at_read_eof()); |
2525 EXPECT_TRUE(data2.at_write_eof()); | 2526 EXPECT_TRUE(data2.at_write_eof()); |
2526 } | 2527 } |
2527 | 2528 |
2528 // Send a spdy request to www.google.com. Get a pushed stream that redirects to | 2529 // Send a spdy request to www.google.com. Get a pushed stream that redirects to |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2583 writes2, arraysize(writes2)); | 2584 writes2, arraysize(writes2)); |
2584 | 2585 |
2585 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN | 2586 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN |
2586 TestDelegate d; | 2587 TestDelegate d; |
2587 TestDelegate d2; | 2588 TestDelegate d2; |
2588 SpdyURLRequestContext spdy_url_request_context( | 2589 SpdyURLRequestContext spdy_url_request_context( |
2589 GetParam().protocol, | 2590 GetParam().protocol, |
2590 false /* force_spdy_over_ssl*/, | 2591 false /* force_spdy_over_ssl*/, |
2591 true /* force_spdy_always */); | 2592 true /* force_spdy_always */); |
2592 { | 2593 { |
2593 net::URLRequest r(GURL("http://www.google.com/"), | 2594 scoped_ptr<URLRequest> r( |
2594 DEFAULT_PRIORITY, | 2595 spdy_url_request_context.CreateRequest(GURL("http://www.google.com/"), |
2595 &d, | 2596 DEFAULT_PRIORITY, |
2596 &spdy_url_request_context); | 2597 &d, |
| 2598 NULL)); |
2597 spdy_url_request_context.socket_factory(). | 2599 spdy_url_request_context.socket_factory(). |
2598 AddSocketDataProvider(&data); | 2600 AddSocketDataProvider(&data); |
2599 | 2601 |
2600 r.Start(); | 2602 r->Start(); |
2601 base::RunLoop().Run(); | 2603 base::RunLoop().Run(); |
2602 | 2604 |
2603 EXPECT_EQ(0, d.received_redirect_count()); | 2605 EXPECT_EQ(0, d.received_redirect_count()); |
2604 std::string contents("hello!"); | 2606 std::string contents("hello!"); |
2605 EXPECT_EQ(contents, d.data_received()); | 2607 EXPECT_EQ(contents, d.data_received()); |
2606 | 2608 |
2607 net::URLRequest r2(GURL("http://www.google.com/foo.dat"), | 2609 scoped_ptr<URLRequest> r2( |
2608 DEFAULT_PRIORITY, | 2610 spdy_url_request_context.CreateRequest( |
2609 &d2, | 2611 GURL("http://www.google.com/foo.dat"), |
2610 &spdy_url_request_context); | 2612 DEFAULT_PRIORITY, |
| 2613 &d2, |
| 2614 NULL)); |
2611 spdy_url_request_context.socket_factory(). | 2615 spdy_url_request_context.socket_factory(). |
2612 AddSocketDataProvider(&data2); | 2616 AddSocketDataProvider(&data2); |
2613 | 2617 |
2614 d2.set_quit_on_redirect(true); | 2618 d2.set_quit_on_redirect(true); |
2615 r2.Start(); | 2619 r2->Start(); |
2616 base::RunLoop().Run(); | 2620 base::RunLoop().Run(); |
2617 EXPECT_EQ(1, d2.received_redirect_count()); | 2621 EXPECT_EQ(1, d2.received_redirect_count()); |
2618 | 2622 |
2619 r2.FollowDeferredRedirect(); | 2623 r2->FollowDeferredRedirect(); |
2620 base::RunLoop().Run(); | 2624 base::RunLoop().Run(); |
2621 EXPECT_EQ(1, d2.response_started_count()); | 2625 EXPECT_EQ(1, d2.response_started_count()); |
2622 EXPECT_FALSE(d2.received_data_before_response()); | 2626 EXPECT_FALSE(d2.received_data_before_response()); |
2623 EXPECT_EQ(net::URLRequestStatus::SUCCESS, r2.status().status()); | 2627 EXPECT_EQ(net::URLRequestStatus::SUCCESS, r2->status().status()); |
2624 std::string contents2("hello!"); | 2628 std::string contents2("hello!"); |
2625 EXPECT_EQ(contents2, d2.data_received()); | 2629 EXPECT_EQ(contents2, d2.data_received()); |
2626 } | 2630 } |
2627 data.CompleteRead(); | 2631 data.CompleteRead(); |
2628 data2.CompleteRead(); | 2632 data2.CompleteRead(); |
2629 EXPECT_TRUE(data.at_read_eof()); | 2633 EXPECT_TRUE(data.at_read_eof()); |
2630 EXPECT_TRUE(data.at_write_eof()); | 2634 EXPECT_TRUE(data.at_write_eof()); |
2631 EXPECT_TRUE(data2.at_read_eof()); | 2635 EXPECT_TRUE(data2.at_read_eof()); |
2632 EXPECT_TRUE(data2.at_write_eof()); | 2636 EXPECT_TRUE(data2.at_write_eof()); |
2633 } | 2637 } |
(...skipping 3928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6562 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6566 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
6563 scoped_ptr<SSLSocketDataProvider> ssl_provider( | 6567 scoped_ptr<SSLSocketDataProvider> ssl_provider( |
6564 new SSLSocketDataProvider(ASYNC, OK)); | 6568 new SSLSocketDataProvider(ASYNC, OK)); |
6565 // Set to TLS_RSA_WITH_NULL_MD5 | 6569 // Set to TLS_RSA_WITH_NULL_MD5 |
6566 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6570 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
6567 | 6571 |
6568 RunTLSUsageCheckTest(ssl_provider.Pass()); | 6572 RunTLSUsageCheckTest(ssl_provider.Pass()); |
6569 } | 6573 } |
6570 | 6574 |
6571 } // namespace net | 6575 } // namespace net |
OLD | NEW |