OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 #include "net/spdy/spdy_session.h" | 74 #include "net/spdy/spdy_session.h" |
75 #include "net/spdy/spdy_session_pool.h" | 75 #include "net/spdy/spdy_session_pool.h" |
76 #include "net/spdy/spdy_test_util_common.h" | 76 #include "net/spdy/spdy_test_util_common.h" |
77 #include "net/ssl/ssl_cert_request_info.h" | 77 #include "net/ssl/ssl_cert_request_info.h" |
78 #include "net/ssl/ssl_config_service.h" | 78 #include "net/ssl/ssl_config_service.h" |
79 #include "net/ssl/ssl_config_service_defaults.h" | 79 #include "net/ssl/ssl_config_service_defaults.h" |
80 #include "net/ssl/ssl_info.h" | 80 #include "net/ssl/ssl_info.h" |
81 #include "net/ssl/ssl_private_key.h" | 81 #include "net/ssl/ssl_private_key.h" |
82 #include "net/test/cert_test_util.h" | 82 #include "net/test/cert_test_util.h" |
83 #include "net/websockets/websocket_handshake_stream_base.h" | 83 #include "net/websockets/websocket_handshake_stream_base.h" |
84 #include "testing/gmock/include/gmock/gmock.h" | |
84 #include "testing/gtest/include/gtest/gtest.h" | 85 #include "testing/gtest/include/gtest/gtest.h" |
85 #include "testing/platform_test.h" | 86 #include "testing/platform_test.h" |
86 #include "url/gurl.h" | 87 #include "url/gurl.h" |
87 | 88 |
88 using base::ASCIIToUTF16; | 89 using base::ASCIIToUTF16; |
89 | 90 |
90 //----------------------------------------------------------------------------- | 91 //----------------------------------------------------------------------------- |
91 | 92 |
92 namespace net { | 93 namespace net { |
93 | 94 |
(...skipping 15365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15459 | 15460 |
15460 std::string response_data; | 15461 std::string response_data; |
15461 EXPECT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 15462 EXPECT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
15462 | 15463 |
15463 EXPECT_EQ(CountWriteBytes(data_writes, arraysize(data_writes)), | 15464 EXPECT_EQ(CountWriteBytes(data_writes, arraysize(data_writes)), |
15464 trans->GetTotalSentBytes()); | 15465 trans->GetTotalSentBytes()); |
15465 EXPECT_EQ(CountReadBytes(data_reads, arraysize(data_reads)), | 15466 EXPECT_EQ(CountReadBytes(data_reads, arraysize(data_reads)), |
15466 trans->GetTotalReceivedBytes()); | 15467 trans->GetTotalReceivedBytes()); |
15467 } | 15468 } |
15468 | 15469 |
15470 TEST_P(HttpNetworkTransactionTest, EnableNPN) { | |
15471 session_deps_.next_protos = NextProtosDefaults(); | |
15472 session_deps_.enable_npn = true; | |
15473 | |
15474 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | |
15475 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); | |
15476 | |
15477 EXPECT_THAT(trans.server_ssl_config_.alpn_protos, | |
15478 testing::ElementsAre(kProtoHTTP2, kProtoSPDY31, kProtoHTTP11)); | |
15479 EXPECT_THAT(trans.server_ssl_config_.npn_protos, | |
15480 testing::ElementsAre(kProtoHTTP2, kProtoSPDY31, kProtoHTTP11)); | |
cbentzel
2015/11/20 20:45:42
Have you confirmed that this fails when your actua
Bence
2015/11/22 21:15:08
Yes, I confirm that this test fails for me when I
| |
15481 } | |
15482 | |
15483 TEST_P(HttpNetworkTransactionTest, DisableNPN) { | |
15484 session_deps_.next_protos = NextProtosDefaults(); | |
15485 session_deps_.enable_npn = false; | |
15486 | |
15487 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | |
15488 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); | |
15489 | |
15490 EXPECT_THAT(trans.server_ssl_config_.alpn_protos, | |
15491 testing::ElementsAre(kProtoHTTP2, kProtoSPDY31, kProtoHTTP11)); | |
15492 EXPECT_TRUE(trans.server_ssl_config_.npn_protos.empty()); | |
15493 } | |
15494 | |
15469 } // namespace net | 15495 } // namespace net |
OLD | NEW |