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 "net/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1527 EXPECT_EQ(NULL, spdy_stream1.get()); | 1527 EXPECT_EQ(NULL, spdy_stream1.get()); |
1528 | 1528 |
1529 request.CancelRequest(); | 1529 request.CancelRequest(); |
1530 callback.reset(); | 1530 callback.reset(); |
1531 | 1531 |
1532 // Should not crash when running the pending callback. | 1532 // Should not crash when running the pending callback. |
1533 base::MessageLoop::current()->RunUntilIdle(); | 1533 base::MessageLoop::current()->RunUntilIdle(); |
1534 } | 1534 } |
1535 | 1535 |
1536 TEST_P(SpdySessionTest, SendInitialDataOnNewSession) { | 1536 TEST_P(SpdySessionTest, SendInitialDataOnNewSession) { |
1537 // Persistent settings are not part of HTTP/2. | |
1538 if (GetParam() == kProtoSPDY4) { | |
1539 return; | |
Johnny
2014/08/29 16:03:57
We still want to run most of this test for SPDY4,
Bence
2014/08/29 20:00:28
Done.
| |
1540 } | |
1541 | |
1537 session_deps_.host_resolver->set_synchronous_mode(true); | 1542 session_deps_.host_resolver->set_synchronous_mode(true); |
1538 | 1543 |
1539 MockRead reads[] = { | 1544 MockRead reads[] = { |
1540 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever. | 1545 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever. |
1541 }; | 1546 }; |
1542 | 1547 |
1543 SettingsMap settings; | 1548 SettingsMap settings; |
1544 const SpdySettingsIds kSpdySettingsIds1 = SETTINGS_MAX_CONCURRENT_STREAMS; | 1549 const SpdySettingsIds kSpdySettingsIds1 = SETTINGS_MAX_CONCURRENT_STREAMS; |
1545 const SpdySettingsIds kSpdySettingsIds2 = SETTINGS_INITIAL_WINDOW_SIZE; | 1550 const SpdySettingsIds kSpdySettingsIds2 = SETTINGS_INITIAL_WINDOW_SIZE; |
1546 const uint32 kInitialRecvWindowSize = 10 * 1024 * 1024; | 1551 const uint32 kInitialRecvWindowSize = 10 * 1024 * 1024; |
1547 settings[kSpdySettingsIds1] = | 1552 settings[kSpdySettingsIds1] = |
1548 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kMaxConcurrentPushedStreams); | 1553 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kMaxConcurrentPushedStreams); |
1549 if (spdy_util_.spdy_version() >= SPDY3) { | 1554 if (spdy_util_.spdy_version() >= SPDY3) { |
1550 settings[kSpdySettingsIds2] = | 1555 settings[kSpdySettingsIds2] = |
1551 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kInitialRecvWindowSize); | 1556 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kInitialRecvWindowSize); |
1552 } | 1557 } |
1553 MockConnect connect_data(SYNCHRONOUS, OK); | 1558 MockConnect connect_data(SYNCHRONOUS, OK); |
1554 scoped_ptr<SpdyFrame> settings_frame( | 1559 scoped_ptr<SpdyFrame> settings_frame( |
1555 spdy_util_.ConstructSpdySettings(settings)); | 1560 spdy_util_.ConstructSpdySettings(settings)); |
1556 scoped_ptr<SpdyFrame> initial_window_update( | 1561 scoped_ptr<SpdyFrame> initial_window_update( |
1557 spdy_util_.ConstructSpdyWindowUpdate( | 1562 spdy_util_.ConstructSpdyWindowUpdate( |
1558 kSessionFlowControlStreamId, | 1563 kSessionFlowControlStreamId, |
1559 kDefaultInitialRecvWindowSize - kSpdySessionInitialWindowSize)); | 1564 kDefaultInitialRecvWindowSize - kSpdySessionInitialWindowSize)); |
1560 std::vector<MockWrite> writes; | 1565 std::vector<MockWrite> writes; |
1561 if (GetParam() == kProtoSPDY4) { | |
1562 writes.push_back( | |
1563 MockWrite(ASYNC, | |
1564 kHttp2ConnectionHeaderPrefix, | |
1565 kHttp2ConnectionHeaderPrefixSize)); | |
1566 } | |
1567 writes.push_back(CreateMockWrite(*settings_frame)); | 1566 writes.push_back(CreateMockWrite(*settings_frame)); |
1568 if (GetParam() >= kProtoSPDY31) { | 1567 if (GetParam() >= kProtoSPDY31) { |
1569 writes.push_back(CreateMockWrite(*initial_window_update)); | 1568 writes.push_back(CreateMockWrite(*initial_window_update)); |
1570 }; | 1569 }; |
1571 | 1570 |
1572 SettingsMap server_settings; | 1571 SettingsMap server_settings; |
1573 const uint32 initial_max_concurrent_streams = 1; | 1572 const uint32 initial_max_concurrent_streams = 1; |
1574 server_settings[SETTINGS_MAX_CONCURRENT_STREAMS] = | 1573 server_settings[SETTINGS_MAX_CONCURRENT_STREAMS] = |
1575 SettingsFlagsAndValue(SETTINGS_FLAG_PERSISTED, | 1574 SettingsFlagsAndValue(SETTINGS_FLAG_PERSISTED, |
1576 initial_max_concurrent_streams); | 1575 initial_max_concurrent_streams); |
(...skipping 3550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5127 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), | 5126 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), |
5128 "spdy_pooling.pem"); | 5127 "spdy_pooling.pem"); |
5129 ssl_info.is_issued_by_known_root = true; | 5128 ssl_info.is_issued_by_known_root = true; |
5130 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); | 5129 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); |
5131 | 5130 |
5132 EXPECT_TRUE(SpdySession::CanPool( | 5131 EXPECT_TRUE(SpdySession::CanPool( |
5133 &tss, ssl_info, "www.example.org", "mail.example.org")); | 5132 &tss, ssl_info, "www.example.org", "mail.example.org")); |
5134 } | 5133 } |
5135 | 5134 |
5136 } // namespace net | 5135 } // namespace net |
OLD | NEW |