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 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1644 CreateInsecureSpdySession(http_session_, key_, log.bound()); | 1644 CreateInsecureSpdySession(http_session_, key_, log.bound()); |
1645 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, key_)); | 1645 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, key_)); |
1646 | 1646 |
1647 // Flush the read completion task. | 1647 // Flush the read completion task. |
1648 base::MessageLoop::current()->RunUntilIdle(); | 1648 base::MessageLoop::current()->RunUntilIdle(); |
1649 | 1649 |
1650 net::CapturingNetLog::CapturedEntryList entries; | 1650 net::CapturingNetLog::CapturedEntryList entries; |
1651 log.GetEntries(&entries); | 1651 log.GetEntries(&entries); |
1652 EXPECT_LT(0u, entries.size()); | 1652 EXPECT_LT(0u, entries.size()); |
1653 | 1653 |
1654 // Check that we logged TYPE_SPDY_SESSION_INITIALIZED correctly. | 1654 // Check that we logged TYPE_HTTP2_SESSION_INITIALIZED correctly. |
1655 int pos = net::ExpectLogContainsSomewhere( | 1655 int pos = net::ExpectLogContainsSomewhere( |
1656 entries, 0, | 1656 entries, 0, net::NetLog::TYPE_HTTP2_SESSION_INITIALIZED, |
1657 net::NetLog::TYPE_SPDY_SESSION_INITIALIZED, | |
1658 net::NetLog::PHASE_NONE); | 1657 net::NetLog::PHASE_NONE); |
1659 EXPECT_LT(0, pos); | 1658 EXPECT_LT(0, pos); |
1660 | 1659 |
1661 CapturingNetLog::CapturedEntry entry = entries[pos]; | 1660 CapturingNetLog::CapturedEntry entry = entries[pos]; |
1662 NetLog::Source socket_source; | 1661 NetLog::Source socket_source; |
1663 EXPECT_TRUE(NetLog::Source::FromEventParameters(entry.params.get(), | 1662 EXPECT_TRUE(NetLog::Source::FromEventParameters(entry.params.get(), |
1664 &socket_source)); | 1663 &socket_source)); |
1665 EXPECT_TRUE(socket_source.IsValid()); | 1664 EXPECT_TRUE(socket_source.IsValid()); |
1666 EXPECT_NE(log.bound().source().id, socket_source.id); | 1665 EXPECT_NE(log.bound().source().id, socket_source.id); |
1667 } | 1666 } |
(...skipping 25 matching lines...) Expand all Loading... |
1693 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, key_)); | 1692 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, key_)); |
1694 EXPECT_TRUE(session == NULL); | 1693 EXPECT_TRUE(session == NULL); |
1695 | 1694 |
1696 // Check that the NetLog was filled reasonably. | 1695 // Check that the NetLog was filled reasonably. |
1697 net::CapturingNetLog::CapturedEntryList entries; | 1696 net::CapturingNetLog::CapturedEntryList entries; |
1698 log.GetEntries(&entries); | 1697 log.GetEntries(&entries); |
1699 EXPECT_LT(0u, entries.size()); | 1698 EXPECT_LT(0u, entries.size()); |
1700 | 1699 |
1701 // Check that we logged SPDY_SESSION_CLOSE correctly. | 1700 // Check that we logged SPDY_SESSION_CLOSE correctly. |
1702 int pos = net::ExpectLogContainsSomewhere( | 1701 int pos = net::ExpectLogContainsSomewhere( |
1703 entries, 0, | 1702 entries, 0, net::NetLog::TYPE_HTTP2_SESSION_CLOSE, |
1704 net::NetLog::TYPE_SPDY_SESSION_CLOSE, | |
1705 net::NetLog::PHASE_NONE); | 1703 net::NetLog::PHASE_NONE); |
1706 | 1704 |
1707 if (pos < static_cast<int>(entries.size())) { | 1705 if (pos < static_cast<int>(entries.size())) { |
1708 CapturingNetLog::CapturedEntry entry = entries[pos]; | 1706 CapturingNetLog::CapturedEntry entry = entries[pos]; |
1709 int error_code = 0; | 1707 int error_code = 0; |
1710 ASSERT_TRUE(entry.GetNetErrorCode(&error_code)); | 1708 ASSERT_TRUE(entry.GetNetErrorCode(&error_code)); |
1711 EXPECT_EQ(OK, error_code); | 1709 EXPECT_EQ(OK, error_code); |
1712 } else { | 1710 } else { |
1713 ADD_FAILURE(); | 1711 ADD_FAILURE(); |
1714 } | 1712 } |
(...skipping 23 matching lines...) Expand all Loading... |
1738 | 1736 |
1739 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, key_)); | 1737 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, key_)); |
1740 EXPECT_TRUE(session == NULL); | 1738 EXPECT_TRUE(session == NULL); |
1741 | 1739 |
1742 // Check that the NetLog was filled reasonably. | 1740 // Check that the NetLog was filled reasonably. |
1743 net::CapturingNetLog::CapturedEntryList entries; | 1741 net::CapturingNetLog::CapturedEntryList entries; |
1744 log.GetEntries(&entries); | 1742 log.GetEntries(&entries); |
1745 EXPECT_LT(0u, entries.size()); | 1743 EXPECT_LT(0u, entries.size()); |
1746 | 1744 |
1747 // Check that we logged SPDY_SESSION_CLOSE correctly. | 1745 // Check that we logged SPDY_SESSION_CLOSE correctly. |
1748 int pos = | 1746 int pos = net::ExpectLogContainsSomewhere( |
1749 net::ExpectLogContainsSomewhere(entries, | 1747 entries, 0, net::NetLog::TYPE_HTTP2_SESSION_CLOSE, |
1750 0, | 1748 net::NetLog::PHASE_NONE); |
1751 net::NetLog::TYPE_SPDY_SESSION_CLOSE, | |
1752 net::NetLog::PHASE_NONE); | |
1753 | 1749 |
1754 if (pos < static_cast<int>(entries.size())) { | 1750 if (pos < static_cast<int>(entries.size())) { |
1755 CapturingNetLog::CapturedEntry entry = entries[pos]; | 1751 CapturingNetLog::CapturedEntry entry = entries[pos]; |
1756 int error_code = 0; | 1752 int error_code = 0; |
1757 ASSERT_TRUE(entry.GetNetErrorCode(&error_code)); | 1753 ASSERT_TRUE(entry.GetNetErrorCode(&error_code)); |
1758 EXPECT_EQ(ERR_CONNECTION_CLOSED, error_code); | 1754 EXPECT_EQ(ERR_CONNECTION_CLOSED, error_code); |
1759 } else { | 1755 } else { |
1760 ADD_FAILURE(); | 1756 ADD_FAILURE(); |
1761 } | 1757 } |
1762 } | 1758 } |
(...skipping 3364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5127 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), | 5123 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), |
5128 "spdy_pooling.pem"); | 5124 "spdy_pooling.pem"); |
5129 ssl_info.is_issued_by_known_root = true; | 5125 ssl_info.is_issued_by_known_root = true; |
5130 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); | 5126 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); |
5131 | 5127 |
5132 EXPECT_TRUE(SpdySession::CanPool( | 5128 EXPECT_TRUE(SpdySession::CanPool( |
5133 &tss, ssl_info, "www.example.org", "mail.example.org")); | 5129 &tss, ssl_info, "www.example.org", "mail.example.org")); |
5134 } | 5130 } |
5135 | 5131 |
5136 } // namespace net | 5132 } // namespace net |
OLD | NEW |