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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 #include "net/spdy/spdy_framer.h" | 73 #include "net/spdy/spdy_framer.h" |
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/test/cert_test_util.h" | 81 #include "net/test/cert_test_util.h" |
82 #include "net/websockets/websocket_handshake_stream_base.h" | 82 #include "net/websockets/websocket_handshake_stream_base.h" |
| 83 #include "testing/gmock/include/gmock/gmock.h" |
83 #include "testing/gtest/include/gtest/gtest.h" | 84 #include "testing/gtest/include/gtest/gtest.h" |
84 #include "testing/platform_test.h" | 85 #include "testing/platform_test.h" |
85 #include "url/gurl.h" | 86 #include "url/gurl.h" |
86 | 87 |
87 using base::ASCIIToUTF16; | 88 using base::ASCIIToUTF16; |
88 | 89 |
89 //----------------------------------------------------------------------------- | 90 //----------------------------------------------------------------------------- |
90 | 91 |
91 namespace net { | 92 namespace net { |
92 | 93 |
(...skipping 15360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15453 | 15454 |
15454 std::string response_data; | 15455 std::string response_data; |
15455 EXPECT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 15456 EXPECT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
15456 | 15457 |
15457 EXPECT_EQ(CountWriteBytes(data_writes, arraysize(data_writes)), | 15458 EXPECT_EQ(CountWriteBytes(data_writes, arraysize(data_writes)), |
15458 trans->GetTotalSentBytes()); | 15459 trans->GetTotalSentBytes()); |
15459 EXPECT_EQ(CountReadBytes(data_reads, arraysize(data_reads)), | 15460 EXPECT_EQ(CountReadBytes(data_reads, arraysize(data_reads)), |
15460 trans->GetTotalReceivedBytes()); | 15461 trans->GetTotalReceivedBytes()); |
15461 } | 15462 } |
15462 | 15463 |
| 15464 TEST_P(HttpNetworkTransactionTest, EnableNPN) { |
| 15465 session_deps_.next_protos = NextProtosDefaults(); |
| 15466 session_deps_.enable_npn = true; |
| 15467 |
| 15468 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 15469 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); |
| 15470 |
| 15471 EXPECT_THAT(trans.server_ssl_config_.alpn_protos, |
| 15472 testing::ElementsAre(kProtoHTTP2, kProtoSPDY31, kProtoHTTP11)); |
| 15473 EXPECT_THAT(trans.server_ssl_config_.npn_protos, |
| 15474 testing::ElementsAre(kProtoHTTP2, kProtoSPDY31, kProtoHTTP11)); |
| 15475 } |
| 15476 |
| 15477 TEST_P(HttpNetworkTransactionTest, DisableNPN) { |
| 15478 session_deps_.next_protos = NextProtosDefaults(); |
| 15479 session_deps_.enable_npn = false; |
| 15480 |
| 15481 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 15482 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); |
| 15483 |
| 15484 EXPECT_THAT(trans.server_ssl_config_.alpn_protos, |
| 15485 testing::ElementsAre(kProtoHTTP2, kProtoSPDY31, kProtoHTTP11)); |
| 15486 EXPECT_TRUE(trans.server_ssl_config_.npn_protos.empty()); |
| 15487 } |
| 15488 |
15463 } // namespace net | 15489 } // namespace net |
OLD | NEW |