| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/test/histogram_tester.h" | 14 #include "base/test/histogram_tester.h" |
| 15 #include "net/base/host_port_pair.h" | 15 #include "net/base/host_port_pair.h" |
| 16 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
| 17 #include "net/base/ip_endpoint.h" | 17 #include "net/base/ip_endpoint.h" |
| 18 #include "net/base/proxy_delegate.h" | 18 #include "net/base/proxy_delegate.h" |
| 19 #include "net/base/request_priority.h" | 19 #include "net/base/request_priority.h" |
| 20 #include "net/base/test_data_stream.h" | 20 #include "net/base/test_data_stream.h" |
| 21 #include "net/base/test_proxy_delegate.h" | 21 #include "net/base/test_proxy_delegate.h" |
| 22 #include "net/cert/ct_policy_status.h" | 22 #include "net/cert/ct_policy_status.h" |
| 23 #include "net/log/net_log_event_type.h" | 23 #include "net/log/net_log_event_type.h" |
| 24 #include "net/log/net_log_source.h" |
| 24 #include "net/log/test_net_log.h" | 25 #include "net/log/test_net_log.h" |
| 25 #include "net/log/test_net_log_entry.h" | 26 #include "net/log/test_net_log_entry.h" |
| 26 #include "net/log/test_net_log_util.h" | 27 #include "net/log/test_net_log_util.h" |
| 27 #include "net/proxy/proxy_server.h" | 28 #include "net/proxy/proxy_server.h" |
| 28 #include "net/socket/client_socket_pool_manager.h" | 29 #include "net/socket/client_socket_pool_manager.h" |
| 29 #include "net/socket/socket_test_util.h" | 30 #include "net/socket/socket_test_util.h" |
| 30 #include "net/spdy/spdy_http_utils.h" | 31 #include "net/spdy/spdy_http_utils.h" |
| 31 #include "net/spdy/spdy_session_pool.h" | 32 #include "net/spdy/spdy_session_pool.h" |
| 32 #include "net/spdy/spdy_session_test_util.h" | 33 #include "net/spdy/spdy_session_test_util.h" |
| 33 #include "net/spdy/spdy_stream.h" | 34 #include "net/spdy/spdy_stream.h" |
| (...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1604 log_.GetEntries(&entries); | 1605 log_.GetEntries(&entries); |
| 1605 EXPECT_LT(0u, entries.size()); | 1606 EXPECT_LT(0u, entries.size()); |
| 1606 | 1607 |
| 1607 // Check that we logged HTTP2_SESSION_INITIALIZED correctly. | 1608 // Check that we logged HTTP2_SESSION_INITIALIZED correctly. |
| 1608 int pos = ExpectLogContainsSomewhere( | 1609 int pos = ExpectLogContainsSomewhere( |
| 1609 entries, 0, NetLogEventType::HTTP2_SESSION_INITIALIZED, | 1610 entries, 0, NetLogEventType::HTTP2_SESSION_INITIALIZED, |
| 1610 NetLogEventPhase::NONE); | 1611 NetLogEventPhase::NONE); |
| 1611 EXPECT_LT(0, pos); | 1612 EXPECT_LT(0, pos); |
| 1612 | 1613 |
| 1613 TestNetLogEntry entry = entries[pos]; | 1614 TestNetLogEntry entry = entries[pos]; |
| 1614 NetLog::Source socket_source; | 1615 NetLogSource socket_source; |
| 1615 EXPECT_TRUE(NetLog::Source::FromEventParameters(entry.params.get(), | 1616 EXPECT_TRUE( |
| 1616 &socket_source)); | 1617 NetLogSource::FromEventParameters(entry.params.get(), &socket_source)); |
| 1617 EXPECT_TRUE(socket_source.IsValid()); | 1618 EXPECT_TRUE(socket_source.IsValid()); |
| 1618 EXPECT_NE(log_.bound().source().id, socket_source.id); | 1619 EXPECT_NE(log_.bound().source().id, socket_source.id); |
| 1619 } | 1620 } |
| 1620 | 1621 |
| 1621 TEST_F(SpdySessionTest, NetLogOnSessionGoaway) { | 1622 TEST_F(SpdySessionTest, NetLogOnSessionGoaway) { |
| 1622 session_deps_.host_resolver->set_synchronous_mode(true); | 1623 session_deps_.host_resolver->set_synchronous_mode(true); |
| 1623 | 1624 |
| 1624 SpdySerializedFrame goaway( | 1625 SpdySerializedFrame goaway( |
| 1625 spdy_util_.ConstructSpdyGoAway(42, GOAWAY_ENHANCE_YOUR_CALM, "foo")); | 1626 spdy_util_.ConstructSpdyGoAway(42, GOAWAY_ENHANCE_YOUR_CALM, "foo")); |
| 1626 MockRead reads[] = { | 1627 MockRead reads[] = { |
| (...skipping 3921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5548 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), | 5549 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), |
| 5549 "spdy_pooling.pem"); | 5550 "spdy_pooling.pem"); |
| 5550 ssl_info.is_issued_by_known_root = true; | 5551 ssl_info.is_issued_by_known_root = true; |
| 5551 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); | 5552 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); |
| 5552 | 5553 |
| 5553 EXPECT_TRUE(SpdySession::CanPool( | 5554 EXPECT_TRUE(SpdySession::CanPool( |
| 5554 &tss, ssl_info, "www.example.org", "mail.example.org")); | 5555 &tss, ssl_info, "www.example.org", "mail.example.org")); |
| 5555 } | 5556 } |
| 5556 | 5557 |
| 5557 } // namespace net | 5558 } // namespace net |
| OLD | NEW |