Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: net/spdy/spdy_network_transaction_unittest.cc

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 scoped_refptr<HttpNetworkSession> session_; 410 scoped_refptr<HttpNetworkSession> session_;
411 TransactionHelperResult output_; 411 TransactionHelperResult output_;
412 scoped_ptr<StaticSocketDataProvider> first_transaction_; 412 scoped_ptr<StaticSocketDataProvider> first_transaction_;
413 SSLVector ssl_vector_; 413 SSLVector ssl_vector_;
414 TestCompletionCallback callback_; 414 TestCompletionCallback callback_;
415 scoped_ptr<HttpNetworkTransaction> trans_; 415 scoped_ptr<HttpNetworkTransaction> trans_;
416 scoped_ptr<HttpNetworkTransaction> trans_http_; 416 scoped_ptr<HttpNetworkTransaction> trans_http_;
417 DataVector data_vector_; 417 DataVector data_vector_;
418 AlternateVector alternate_vector_; 418 AlternateVector alternate_vector_;
419 AlternateDeterministicVector alternate_deterministic_vector_; 419 AlternateDeterministicVector alternate_deterministic_vector_;
420 const BoundNetLog& log_; 420 const BoundNetLog log_;
421 SpdyNetworkTransactionTestParams test_params_; 421 SpdyNetworkTransactionTestParams test_params_;
422 int port_; 422 int port_;
423 bool deterministic_; 423 bool deterministic_;
424 bool spdy_enabled_; 424 bool spdy_enabled_;
425 }; 425 };
426 426
427 void ConnectStatusHelperWithExpectedStatus(const MockRead& status, 427 void ConnectStatusHelperWithExpectedStatus(const MockRead& status,
428 int expected_status); 428 int expected_status);
429 429
430 void ConnectStatusHelper(const MockRead& status); 430 void ConnectStatusHelper(const MockRead& status);
(...skipping 4118 matching lines...) Expand 10 before | Expand all | Expand 10 after
4549 const HttpResponseInfo* response = trans->GetResponseInfo(); 4549 const HttpResponseInfo* response = trans->GetResponseInfo();
4550 EXPECT_TRUE(response->headers.get() != NULL); 4550 EXPECT_TRUE(response->headers.get() != NULL);
4551 EXPECT_TRUE(response->was_fetched_via_spdy); 4551 EXPECT_TRUE(response->was_fetched_via_spdy);
4552 out.rv = ReadTransaction(trans, &out.response_data); 4552 out.rv = ReadTransaction(trans, &out.response_data);
4553 EXPECT_EQ(ERR_CONNECTION_CLOSED, out.rv); 4553 EXPECT_EQ(ERR_CONNECTION_CLOSED, out.rv);
4554 4554
4555 // Verify that we consumed all test data. 4555 // Verify that we consumed all test data.
4556 helper.VerifyDataConsumed(); 4556 helper.VerifyDataConsumed();
4557 } 4557 }
4558 4558
4559 // HTTP_1_1_REQUIRED results in ERR_HTTP_1_1_REQUIRED.
4560 TEST_P(SpdyNetworkTransactionTest, HTTP11RequiredError) {
4561 // HTTP_1_1_REQUIRED is only supported by SPDY4.
4562 if (spdy_util_.spdy_version() < SPDY4)
4563 return;
4564
4565 NormalSpdyTransactionHelper helper(CreateGetRequest(), DEFAULT_PRIORITY,
4566 BoundNetLog(), GetParam(), nullptr);
4567
4568 scoped_ptr<SpdyFrame> go_away(spdy_util_.ConstructSpdyGoAway(
4569 0, GOAWAY_HTTP_1_1_REQUIRED, "Try again using HTTP/1.1 please."));
4570 MockRead reads[] = {
4571 CreateMockRead(*go_away),
4572 };
4573 DelayedSocketData data(0, reads, arraysize(reads), nullptr, 0);
4574
4575 helper.RunToCompletion(&data);
4576 TransactionHelperResult out = helper.output();
4577 EXPECT_EQ(ERR_HTTP_1_1_REQUIRED, out.rv);
4578 }
4579
4559 // Retry with HTTP/1.1 when receiving HTTP_1_1_REQUIRED. Note that no actual 4580 // Retry with HTTP/1.1 when receiving HTTP_1_1_REQUIRED. Note that no actual
4560 // protocol negotiation happens, instead this test forces protocols for both 4581 // protocol negotiation happens, instead this test forces protocols for both
4561 // sockets. 4582 // sockets.
4562 TEST_P(SpdyNetworkTransactionTest, HTTP11RequiredRetry) { 4583 TEST_P(SpdyNetworkTransactionTest, HTTP11RequiredRetry) {
4563 // HTTP_1_1_REQUIRED is only supported by SPDY4. 4584 // HTTP_1_1_REQUIRED is only supported by SPDY4.
4564 if (spdy_util_.spdy_version() < SPDY4) 4585 if (spdy_util_.spdy_version() < SPDY4)
4565 return; 4586 return;
4566 // HTTP_1_1_REQUIRED implementation relies on the assumption that HTTP/2 is 4587 // HTTP_1_1_REQUIRED implementation relies on the assumption that HTTP/2 is
4567 // only spoken over SSL. 4588 // only spoken over SSL.
4568 if (GetParam().ssl_type != SPDYSSL) 4589 if (GetParam().ssl_type != SPDYSSL)
(...skipping 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after
6799 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { 6820 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) {
6800 scoped_ptr<SSLSocketDataProvider> ssl_provider( 6821 scoped_ptr<SSLSocketDataProvider> ssl_provider(
6801 new SSLSocketDataProvider(ASYNC, OK)); 6822 new SSLSocketDataProvider(ASYNC, OK));
6802 // Set to TLS_RSA_WITH_NULL_MD5 6823 // Set to TLS_RSA_WITH_NULL_MD5
6803 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); 6824 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status);
6804 6825
6805 RunTLSUsageCheckTest(ssl_provider.Pass()); 6826 RunTLSUsageCheckTest(ssl_provider.Pass());
6806 } 6827 }
6807 6828
6808 } // namespace net 6829 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_http_utils.cc ('k') | net/spdy/spdy_protocol.h » ('j') | shell/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698