| 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 <utility> | 6 #include <utility> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 2521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2532 &response, | 2532 &response, |
| 2533 &response2, | 2533 &response2, |
| 2534 expected_push_result); | 2534 expected_push_result); |
| 2535 | 2535 |
| 2536 // Verify the SYN_REPLY. | 2536 // Verify the SYN_REPLY. |
| 2537 EXPECT_TRUE(response.headers.get() != NULL); | 2537 EXPECT_TRUE(response.headers.get() != NULL); |
| 2538 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 2538 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 2539 | 2539 |
| 2540 // Verify the pushed stream. | 2540 // Verify the pushed stream. |
| 2541 EXPECT_TRUE(response2.headers.get() != NULL); | 2541 EXPECT_TRUE(response2.headers.get() != NULL); |
| 2542 EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine()); | 2542 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); |
| 2543 } | 2543 } |
| 2544 | 2544 |
| 2545 TEST_P(SpdyNetworkTransactionTest, ServerPushBeforeSynReply) { | 2545 TEST_P(SpdyNetworkTransactionTest, ServerPushBeforeSynReply) { |
| 2546 scoped_ptr<SpdyFrame> stream1_syn( | 2546 scoped_ptr<SpdyFrame> stream1_syn( |
| 2547 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); | 2547 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
| 2548 scoped_ptr<SpdyFrame> stream1_body( | 2548 scoped_ptr<SpdyFrame> stream1_body( |
| 2549 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 2549 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 2550 MockWrite writes[] = { | 2550 MockWrite writes[] = { |
| 2551 CreateMockWrite(*stream1_syn, 0), | 2551 CreateMockWrite(*stream1_syn, 0), |
| 2552 }; | 2552 }; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2575 &response, | 2575 &response, |
| 2576 &response2, | 2576 &response2, |
| 2577 expected_push_result); | 2577 expected_push_result); |
| 2578 | 2578 |
| 2579 // Verify the SYN_REPLY. | 2579 // Verify the SYN_REPLY. |
| 2580 EXPECT_TRUE(response.headers.get() != NULL); | 2580 EXPECT_TRUE(response.headers.get() != NULL); |
| 2581 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 2581 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 2582 | 2582 |
| 2583 // Verify the pushed stream. | 2583 // Verify the pushed stream. |
| 2584 EXPECT_TRUE(response2.headers.get() != NULL); | 2584 EXPECT_TRUE(response2.headers.get() != NULL); |
| 2585 EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine()); | 2585 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); |
| 2586 } | 2586 } |
| 2587 | 2587 |
| 2588 TEST_P(SpdyNetworkTransactionTest, ServerPushSingleDataFrame2) { | 2588 TEST_P(SpdyNetworkTransactionTest, ServerPushSingleDataFrame2) { |
| 2589 scoped_ptr<SpdyFrame> stream1_syn( | 2589 scoped_ptr<SpdyFrame> stream1_syn( |
| 2590 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); | 2590 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
| 2591 MockWrite writes[] = { | 2591 MockWrite writes[] = { |
| 2592 CreateMockWrite(*stream1_syn, 0), | 2592 CreateMockWrite(*stream1_syn, 0), |
| 2593 }; | 2593 }; |
| 2594 | 2594 |
| 2595 scoped_ptr<SpdyFrame> | 2595 scoped_ptr<SpdyFrame> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2618 &response, | 2618 &response, |
| 2619 &response2, | 2619 &response2, |
| 2620 expected_push_result); | 2620 expected_push_result); |
| 2621 | 2621 |
| 2622 // Verify the SYN_REPLY. | 2622 // Verify the SYN_REPLY. |
| 2623 EXPECT_TRUE(response.headers.get() != NULL); | 2623 EXPECT_TRUE(response.headers.get() != NULL); |
| 2624 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 2624 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 2625 | 2625 |
| 2626 // Verify the pushed stream. | 2626 // Verify the pushed stream. |
| 2627 EXPECT_TRUE(response2.headers.get() != NULL); | 2627 EXPECT_TRUE(response2.headers.get() != NULL); |
| 2628 EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine()); | 2628 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); |
| 2629 } | 2629 } |
| 2630 | 2630 |
| 2631 TEST_P(SpdyNetworkTransactionTest, ServerPushServerAborted) { | 2631 TEST_P(SpdyNetworkTransactionTest, ServerPushServerAborted) { |
| 2632 scoped_ptr<SpdyFrame> stream1_syn( | 2632 scoped_ptr<SpdyFrame> stream1_syn( |
| 2633 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); | 2633 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
| 2634 scoped_ptr<SpdyFrame> stream1_body( | 2634 scoped_ptr<SpdyFrame> stream1_body( |
| 2635 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 2635 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 2636 MockWrite writes[] = { | 2636 MockWrite writes[] = { |
| 2637 CreateMockWrite(*stream1_syn, 0), | 2637 CreateMockWrite(*stream1_syn, 0), |
| 2638 }; | 2638 }; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2718 &response, | 2718 &response, |
| 2719 &response2, | 2719 &response2, |
| 2720 expected_push_result); | 2720 expected_push_result); |
| 2721 | 2721 |
| 2722 // Verify the SYN_REPLY. | 2722 // Verify the SYN_REPLY. |
| 2723 EXPECT_TRUE(response.headers.get() != NULL); | 2723 EXPECT_TRUE(response.headers.get() != NULL); |
| 2724 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 2724 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 2725 | 2725 |
| 2726 // Verify the pushed stream. | 2726 // Verify the pushed stream. |
| 2727 EXPECT_TRUE(response2.headers.get() != NULL); | 2727 EXPECT_TRUE(response2.headers.get() != NULL); |
| 2728 EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine()); | 2728 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); |
| 2729 } | 2729 } |
| 2730 | 2730 |
| 2731 TEST_P(SpdyNetworkTransactionTest, ServerPushMultipleDataFrame) { | 2731 TEST_P(SpdyNetworkTransactionTest, ServerPushMultipleDataFrame) { |
| 2732 scoped_ptr<SpdyFrame> stream1_syn( | 2732 scoped_ptr<SpdyFrame> stream1_syn( |
| 2733 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); | 2733 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
| 2734 scoped_ptr<SpdyFrame> stream1_body( | 2734 scoped_ptr<SpdyFrame> stream1_body( |
| 2735 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 2735 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 2736 MockWrite writes[] = { | 2736 MockWrite writes[] = { |
| 2737 CreateMockWrite(*stream1_syn, 0), | 2737 CreateMockWrite(*stream1_syn, 0), |
| 2738 }; | 2738 }; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2772 std::string expected_push_result("pushed my darling hello my baby"); | 2772 std::string expected_push_result("pushed my darling hello my baby"); |
| 2773 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 2773 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 2774 RunServerPushTest(&data, &response, &response2, kPushedData); | 2774 RunServerPushTest(&data, &response, &response2, kPushedData); |
| 2775 | 2775 |
| 2776 // Verify the SYN_REPLY. | 2776 // Verify the SYN_REPLY. |
| 2777 EXPECT_TRUE(response.headers.get() != NULL); | 2777 EXPECT_TRUE(response.headers.get() != NULL); |
| 2778 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 2778 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 2779 | 2779 |
| 2780 // Verify the pushed stream. | 2780 // Verify the pushed stream. |
| 2781 EXPECT_TRUE(response2.headers.get() != NULL); | 2781 EXPECT_TRUE(response2.headers.get() != NULL); |
| 2782 EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine()); | 2782 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); |
| 2783 } | 2783 } |
| 2784 | 2784 |
| 2785 TEST_P(SpdyNetworkTransactionTest, ServerPushMultipleDataFrameInterrupted) { | 2785 TEST_P(SpdyNetworkTransactionTest, ServerPushMultipleDataFrameInterrupted) { |
| 2786 scoped_ptr<SpdyFrame> stream1_syn( | 2786 scoped_ptr<SpdyFrame> stream1_syn( |
| 2787 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); | 2787 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
| 2788 scoped_ptr<SpdyFrame> stream1_body( | 2788 scoped_ptr<SpdyFrame> stream1_body( |
| 2789 spdy_util_.ConstructSpdyBodyFrame(1, true)); | 2789 spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 2790 MockWrite writes[] = { | 2790 MockWrite writes[] = { |
| 2791 CreateMockWrite(*stream1_syn, 0), | 2791 CreateMockWrite(*stream1_syn, 0), |
| 2792 }; | 2792 }; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2825 HttpResponseInfo response2; | 2825 HttpResponseInfo response2; |
| 2826 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); | 2826 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 2827 RunServerPushTest(&data, &response, &response2, kPushedData); | 2827 RunServerPushTest(&data, &response, &response2, kPushedData); |
| 2828 | 2828 |
| 2829 // Verify the SYN_REPLY. | 2829 // Verify the SYN_REPLY. |
| 2830 EXPECT_TRUE(response.headers.get() != NULL); | 2830 EXPECT_TRUE(response.headers.get() != NULL); |
| 2831 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); | 2831 EXPECT_EQ("HTTP/1.1 200", response.headers->GetStatusLine()); |
| 2832 | 2832 |
| 2833 // Verify the pushed stream. | 2833 // Verify the pushed stream. |
| 2834 EXPECT_TRUE(response2.headers.get() != NULL); | 2834 EXPECT_TRUE(response2.headers.get() != NULL); |
| 2835 EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine()); | 2835 EXPECT_EQ("HTTP/1.1 200", response2.headers->GetStatusLine()); |
| 2836 } | 2836 } |
| 2837 | 2837 |
| 2838 TEST_P(SpdyNetworkTransactionTest, ServerPushInvalidAssociatedStreamID0) { | 2838 TEST_P(SpdyNetworkTransactionTest, ServerPushInvalidAssociatedStreamID0) { |
| 2839 if (spdy_util_.spdy_version() == HTTP2) { | 2839 if (spdy_util_.spdy_version() == HTTP2) { |
| 2840 // PUSH_PROMISE with stream id 0 is connection-level error. | 2840 // PUSH_PROMISE with stream id 0 is connection-level error. |
| 2841 // TODO(baranovich): Test session going away. | 2841 // TODO(baranovich): Test session going away. |
| 2842 return; | 2842 return; |
| 2843 } | 2843 } |
| 2844 | 2844 |
| 2845 scoped_ptr<SpdyFrame> stream1_syn( | 2845 scoped_ptr<SpdyFrame> stream1_syn( |
| (...skipping 3722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6568 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6568 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
| 6569 scoped_ptr<SSLSocketDataProvider> ssl_provider( | 6569 scoped_ptr<SSLSocketDataProvider> ssl_provider( |
| 6570 new SSLSocketDataProvider(ASYNC, OK)); | 6570 new SSLSocketDataProvider(ASYNC, OK)); |
| 6571 // Set to TLS_RSA_WITH_NULL_MD5 | 6571 // Set to TLS_RSA_WITH_NULL_MD5 |
| 6572 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6572 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
| 6573 | 6573 |
| 6574 RunTLSUsageCheckTest(std::move(ssl_provider)); | 6574 RunTLSUsageCheckTest(std::move(ssl_provider)); |
| 6575 } | 6575 } |
| 6576 | 6576 |
| 6577 } // namespace net | 6577 } // namespace net |
| OLD | NEW |