| 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 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2475 OrderedSocketData data2(reads2, arraysize(reads2), | 2475 OrderedSocketData data2(reads2, arraysize(reads2), |
| 2476 writes2, arraysize(writes2)); | 2476 writes2, arraysize(writes2)); |
| 2477 | 2477 |
| 2478 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN | 2478 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN |
| 2479 TestDelegate d; | 2479 TestDelegate d; |
| 2480 { | 2480 { |
| 2481 SpdyURLRequestContext spdy_url_request_context( | 2481 SpdyURLRequestContext spdy_url_request_context( |
| 2482 GetParam().protocol, | 2482 GetParam().protocol, |
| 2483 false /* force_spdy_over_ssl*/, | 2483 false /* force_spdy_over_ssl*/, |
| 2484 true /* force_spdy_always */); | 2484 true /* force_spdy_always */); |
| 2485 net::URLRequest r(GURL("http://www.google.com/"), | 2485 scoped_ptr<URLRequest> r( |
| 2486 DEFAULT_PRIORITY, | 2486 spdy_url_request_context.CreateRequest(GURL("http://www.google.com/"), |
| 2487 &d, | 2487 DEFAULT_PRIORITY, |
| 2488 &spdy_url_request_context); | 2488 &d, |
| 2489 NULL)); |
| 2489 spdy_url_request_context.socket_factory(). | 2490 spdy_url_request_context.socket_factory(). |
| 2490 AddSocketDataProvider(&data); | 2491 AddSocketDataProvider(&data); |
| 2491 spdy_url_request_context.socket_factory(). | 2492 spdy_url_request_context.socket_factory(). |
| 2492 AddSocketDataProvider(&data2); | 2493 AddSocketDataProvider(&data2); |
| 2493 | 2494 |
| 2494 d.set_quit_on_redirect(true); | 2495 d.set_quit_on_redirect(true); |
| 2495 r.Start(); | 2496 r->Start(); |
| 2496 base::RunLoop().Run(); | 2497 base::RunLoop().Run(); |
| 2497 | 2498 |
| 2498 EXPECT_EQ(1, d.received_redirect_count()); | 2499 EXPECT_EQ(1, d.received_redirect_count()); |
| 2499 | 2500 |
| 2500 r.FollowDeferredRedirect(); | 2501 r->FollowDeferredRedirect(); |
| 2501 base::RunLoop().Run(); | 2502 base::RunLoop().Run(); |
| 2502 EXPECT_EQ(1, d.response_started_count()); | 2503 EXPECT_EQ(1, d.response_started_count()); |
| 2503 EXPECT_FALSE(d.received_data_before_response()); | 2504 EXPECT_FALSE(d.received_data_before_response()); |
| 2504 EXPECT_EQ(net::URLRequestStatus::SUCCESS, r.status().status()); | 2505 EXPECT_EQ(net::URLRequestStatus::SUCCESS, r->status().status()); |
| 2505 std::string contents("hello!"); | 2506 std::string contents("hello!"); |
| 2506 EXPECT_EQ(contents, d.data_received()); | 2507 EXPECT_EQ(contents, d.data_received()); |
| 2507 } | 2508 } |
| 2508 EXPECT_TRUE(data.at_read_eof()); | 2509 EXPECT_TRUE(data.at_read_eof()); |
| 2509 EXPECT_TRUE(data.at_write_eof()); | 2510 EXPECT_TRUE(data.at_write_eof()); |
| 2510 EXPECT_TRUE(data2.at_read_eof()); | 2511 EXPECT_TRUE(data2.at_read_eof()); |
| 2511 EXPECT_TRUE(data2.at_write_eof()); | 2512 EXPECT_TRUE(data2.at_write_eof()); |
| 2512 } | 2513 } |
| 2513 | 2514 |
| 2514 // 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 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2569 writes2, arraysize(writes2)); | 2570 writes2, arraysize(writes2)); |
| 2570 | 2571 |
| 2571 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN | 2572 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN |
| 2572 TestDelegate d; | 2573 TestDelegate d; |
| 2573 TestDelegate d2; | 2574 TestDelegate d2; |
| 2574 SpdyURLRequestContext spdy_url_request_context( | 2575 SpdyURLRequestContext spdy_url_request_context( |
| 2575 GetParam().protocol, | 2576 GetParam().protocol, |
| 2576 false /* force_spdy_over_ssl*/, | 2577 false /* force_spdy_over_ssl*/, |
| 2577 true /* force_spdy_always */); | 2578 true /* force_spdy_always */); |
| 2578 { | 2579 { |
| 2579 net::URLRequest r(GURL("http://www.google.com/"), | 2580 scoped_ptr<URLRequest> r( |
| 2580 DEFAULT_PRIORITY, | 2581 spdy_url_request_context.CreateRequest(GURL("http://www.google.com/"), |
| 2581 &d, | 2582 DEFAULT_PRIORITY, |
| 2582 &spdy_url_request_context); | 2583 &d, |
| 2584 NULL)); |
| 2583 spdy_url_request_context.socket_factory(). | 2585 spdy_url_request_context.socket_factory(). |
| 2584 AddSocketDataProvider(&data); | 2586 AddSocketDataProvider(&data); |
| 2585 | 2587 |
| 2586 r.Start(); | 2588 r->Start(); |
| 2587 base::RunLoop().Run(); | 2589 base::RunLoop().Run(); |
| 2588 | 2590 |
| 2589 EXPECT_EQ(0, d.received_redirect_count()); | 2591 EXPECT_EQ(0, d.received_redirect_count()); |
| 2590 std::string contents("hello!"); | 2592 std::string contents("hello!"); |
| 2591 EXPECT_EQ(contents, d.data_received()); | 2593 EXPECT_EQ(contents, d.data_received()); |
| 2592 | 2594 |
| 2593 net::URLRequest r2(GURL("http://www.google.com/foo.dat"), | 2595 scoped_ptr<URLRequest> r2( |
| 2594 DEFAULT_PRIORITY, | 2596 spdy_url_request_context.CreateRequest( |
| 2595 &d2, | 2597 GURL("http://www.google.com/foo.dat"), |
| 2596 &spdy_url_request_context); | 2598 DEFAULT_PRIORITY, |
| 2599 &d2, |
| 2600 NULL)); |
| 2597 spdy_url_request_context.socket_factory(). | 2601 spdy_url_request_context.socket_factory(). |
| 2598 AddSocketDataProvider(&data2); | 2602 AddSocketDataProvider(&data2); |
| 2599 | 2603 |
| 2600 d2.set_quit_on_redirect(true); | 2604 d2.set_quit_on_redirect(true); |
| 2601 r2.Start(); | 2605 r2->Start(); |
| 2602 base::RunLoop().Run(); | 2606 base::RunLoop().Run(); |
| 2603 EXPECT_EQ(1, d2.received_redirect_count()); | 2607 EXPECT_EQ(1, d2.received_redirect_count()); |
| 2604 | 2608 |
| 2605 r2.FollowDeferredRedirect(); | 2609 r2->FollowDeferredRedirect(); |
| 2606 base::RunLoop().Run(); | 2610 base::RunLoop().Run(); |
| 2607 EXPECT_EQ(1, d2.response_started_count()); | 2611 EXPECT_EQ(1, d2.response_started_count()); |
| 2608 EXPECT_FALSE(d2.received_data_before_response()); | 2612 EXPECT_FALSE(d2.received_data_before_response()); |
| 2609 EXPECT_EQ(net::URLRequestStatus::SUCCESS, r2.status().status()); | 2613 EXPECT_EQ(net::URLRequestStatus::SUCCESS, r2->status().status()); |
| 2610 std::string contents2("hello!"); | 2614 std::string contents2("hello!"); |
| 2611 EXPECT_EQ(contents2, d2.data_received()); | 2615 EXPECT_EQ(contents2, d2.data_received()); |
| 2612 } | 2616 } |
| 2613 data.CompleteRead(); | 2617 data.CompleteRead(); |
| 2614 data2.CompleteRead(); | 2618 data2.CompleteRead(); |
| 2615 EXPECT_TRUE(data.at_read_eof()); | 2619 EXPECT_TRUE(data.at_read_eof()); |
| 2616 EXPECT_TRUE(data.at_write_eof()); | 2620 EXPECT_TRUE(data.at_write_eof()); |
| 2617 EXPECT_TRUE(data2.at_read_eof()); | 2621 EXPECT_TRUE(data2.at_read_eof()); |
| 2618 EXPECT_TRUE(data2.at_write_eof()); | 2622 EXPECT_TRUE(data2.at_write_eof()); |
| 2619 } | 2623 } |
| (...skipping 3928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6548 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6552 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
| 6549 scoped_ptr<SSLSocketDataProvider> ssl_provider( | 6553 scoped_ptr<SSLSocketDataProvider> ssl_provider( |
| 6550 new SSLSocketDataProvider(ASYNC, OK)); | 6554 new SSLSocketDataProvider(ASYNC, OK)); |
| 6551 // Set to TLS_RSA_WITH_NULL_MD5 | 6555 // Set to TLS_RSA_WITH_NULL_MD5 |
| 6552 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6556 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
| 6553 | 6557 |
| 6554 RunTLSUsageCheckTest(ssl_provider.Pass()); | 6558 RunTLSUsageCheckTest(ssl_provider.Pass()); |
| 6555 } | 6559 } |
| 6556 | 6560 |
| 6557 } // namespace net | 6561 } // namespace net |
| OLD | NEW |