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

Side by Side Diff: net/http/http_network_transaction_unittest.cc

Issue 2096713002: Reduce SpdyHeaderBlock copies with move semantics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clear() does not work after all. Created 4 years, 5 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 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 5230 matching lines...) Expand 10 before | Expand all | Expand 10 after
5241 request1.method = "GET"; 5241 request1.method = "GET";
5242 request1.url = GURL("http://www.example.org/"); 5242 request1.url = GURL("http://www.example.org/");
5243 request1.load_flags = 0; 5243 request1.load_flags = 0;
5244 5244
5245 HttpRequestInfo request2; 5245 HttpRequestInfo request2;
5246 request2.method = "GET"; 5246 request2.method = "GET";
5247 request2.url = GURL("http://mail.example.org/"); 5247 request2.url = GURL("http://mail.example.org/");
5248 request2.load_flags = 0; 5248 request2.load_flags = 0;
5249 5249
5250 // http://www.example.org/ 5250 // http://www.example.org/
5251 std::unique_ptr<SpdyHeaderBlock> headers( 5251 SpdyHeaderBlock headers(
5252 spdy_util_.ConstructGetHeaderBlockForProxy("http://www.example.org/")); 5252 spdy_util_.ConstructGetHeaderBlockForProxy("http://www.example.org/"));
5253 std::unique_ptr<SpdySerializedFrame> get1( 5253 std::unique_ptr<SpdySerializedFrame> get1(
5254 spdy_util_.ConstructSpdySyn(1, *headers, LOWEST, true)); 5254 spdy_util_.ConstructSpdySyn(1, std::move(headers), LOWEST, true));
5255 std::unique_ptr<SpdySerializedFrame> get_resp1( 5255 std::unique_ptr<SpdySerializedFrame> get_resp1(
5256 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); 5256 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1));
5257 std::unique_ptr<SpdySerializedFrame> body1( 5257 std::unique_ptr<SpdySerializedFrame> body1(
5258 spdy_util_.ConstructSpdyBodyFrame(1, "1", 1, true)); 5258 spdy_util_.ConstructSpdyBodyFrame(1, "1", 1, true));
5259 spdy_util_.UpdateWithStreamDestruction(1); 5259 spdy_util_.UpdateWithStreamDestruction(1);
5260 5260
5261 // http://mail.example.org/ 5261 // http://mail.example.org/
5262 std::unique_ptr<SpdyHeaderBlock> headers2( 5262 SpdyHeaderBlock headers2(
5263 spdy_util_.ConstructGetHeaderBlockForProxy("http://mail.example.org/")); 5263 spdy_util_.ConstructGetHeaderBlockForProxy("http://mail.example.org/"));
5264 std::unique_ptr<SpdySerializedFrame> get2( 5264 std::unique_ptr<SpdySerializedFrame> get2(
5265 spdy_util_.ConstructSpdySyn(3, *headers2, LOWEST, true)); 5265 spdy_util_.ConstructSpdySyn(3, std::move(headers2), LOWEST, true));
5266 std::unique_ptr<SpdySerializedFrame> get_resp2( 5266 std::unique_ptr<SpdySerializedFrame> get_resp2(
5267 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 3)); 5267 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 3));
5268 std::unique_ptr<SpdySerializedFrame> body2( 5268 std::unique_ptr<SpdySerializedFrame> body2(
5269 spdy_util_.ConstructSpdyBodyFrame(3, "22", 2, true)); 5269 spdy_util_.ConstructSpdyBodyFrame(3, "22", 2, true));
5270 5270
5271 MockWrite spdy_writes[] = { 5271 MockWrite spdy_writes[] = {
5272 CreateMockWrite(*get1, 0), 5272 CreateMockWrite(*get1, 0),
5273 CreateMockWrite(*get2, 3), 5273 CreateMockWrite(*get2, 3),
5274 }; 5274 };
5275 5275
(...skipping 8740 matching lines...) Expand 10 before | Expand all | Expand 10 after
14016 // http://crbug.com/134690 14016 // http://crbug.com/134690
14017 TEST_P(HttpNetworkTransactionTest, DoNotUseSpdySessionIfCertDoesNotMatch) { 14017 TEST_P(HttpNetworkTransactionTest, DoNotUseSpdySessionIfCertDoesNotMatch) {
14018 const std::string url1 = "http://www.example.org/"; 14018 const std::string url1 = "http://www.example.org/";
14019 const std::string url2 = "https://news.example.org/"; 14019 const std::string url2 = "https://news.example.org/";
14020 const std::string ip_addr = "1.2.3.4"; 14020 const std::string ip_addr = "1.2.3.4";
14021 14021
14022 // Second SpdyTestUtil instance for the second socket. 14022 // Second SpdyTestUtil instance for the second socket.
14023 SpdyTestUtil spdy_util_secure(GetProtocol(), GetDependenciesFromPriority()); 14023 SpdyTestUtil spdy_util_secure(GetProtocol(), GetDependenciesFromPriority());
14024 14024
14025 // SPDY GET for HTTP URL (through SPDY proxy) 14025 // SPDY GET for HTTP URL (through SPDY proxy)
14026 std::unique_ptr<SpdyHeaderBlock> headers( 14026 SpdyHeaderBlock headers(
14027 spdy_util_.ConstructGetHeaderBlockForProxy("http://www.example.org/")); 14027 spdy_util_.ConstructGetHeaderBlockForProxy("http://www.example.org/"));
14028 std::unique_ptr<SpdySerializedFrame> req1( 14028 std::unique_ptr<SpdySerializedFrame> req1(
14029 spdy_util_.ConstructSpdySyn(1, *headers, LOWEST, true)); 14029 spdy_util_.ConstructSpdySyn(1, std::move(headers), LOWEST, true));
14030 14030
14031 MockWrite writes1[] = { 14031 MockWrite writes1[] = {
14032 CreateMockWrite(*req1, 0), 14032 CreateMockWrite(*req1, 0),
14033 }; 14033 };
14034 14034
14035 std::unique_ptr<SpdySerializedFrame> resp1( 14035 std::unique_ptr<SpdySerializedFrame> resp1(
14036 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); 14036 spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1));
14037 std::unique_ptr<SpdySerializedFrame> body1( 14037 std::unique_ptr<SpdySerializedFrame> body1(
14038 spdy_util_.ConstructSpdyBodyFrame(1, true)); 14038 spdy_util_.ConstructSpdyBodyFrame(1, true));
14039 MockRead reads1[] = { 14039 MockRead reads1[] = {
(...skipping 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after
16138 base::RunLoop().RunUntilIdle(); 16138 base::RunLoop().RunUntilIdle();
16139 16139
16140 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy); 16140 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy);
16141 HttpRequestHeaders headers; 16141 HttpRequestHeaders headers;
16142 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers)); 16142 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers));
16143 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding)); 16143 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding));
16144 } 16144 }
16145 #endif // !defined(OS_IOS) 16145 #endif // !defined(OS_IOS)
16146 16146
16147 } // namespace net 16147 } // namespace net
OLDNEW
« no previous file with comments | « net/http/bidirectional_stream_unittest.cc ('k') | net/http/http_proxy_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698