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

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

Issue 1779733003: Fix bug in net::RequestPriority -> HTTP/2 dependency conversion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make bi-directional stream unittests enable priority->dependency setting. Created 4 years, 9 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/spdy/spdy_test_util_common.h" 5 #include "net/spdy/spdy_test_util_common.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <cstddef> 8 #include <cstddef>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 transport_security_state(new TransportSecurityState), 334 transport_security_state(new TransportSecurityState),
335 proxy_service(ProxyService::CreateDirect()), 335 proxy_service(ProxyService::CreateDirect()),
336 ssl_config_service(new SSLConfigServiceDefaults), 336 ssl_config_service(new SSLConfigServiceDefaults),
337 socket_factory(new MockClientSocketFactory), 337 socket_factory(new MockClientSocketFactory),
338 http_auth_handler_factory( 338 http_auth_handler_factory(
339 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())), 339 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())),
340 enable_ip_pooling(true), 340 enable_ip_pooling(true),
341 enable_ping(false), 341 enable_ping(false),
342 enable_user_alternate_protocol_ports(false), 342 enable_user_alternate_protocol_ports(false),
343 enable_npn(true), 343 enable_npn(true),
344 enable_priority_dependencies(true),
344 protocol(protocol), 345 protocol(protocol),
345 session_max_recv_window_size( 346 session_max_recv_window_size(
346 SpdySession::GetDefaultInitialWindowSize(protocol)), 347 SpdySession::GetDefaultInitialWindowSize(protocol)),
347 stream_max_recv_window_size( 348 stream_max_recv_window_size(
348 SpdySession::GetDefaultInitialWindowSize(protocol)), 349 SpdySession::GetDefaultInitialWindowSize(protocol)),
349 time_func(&base::TimeTicks::Now), 350 time_func(&base::TimeTicks::Now),
350 parse_alternative_services(false), 351 parse_alternative_services(false),
351 enable_alternative_service_with_different_host(false), 352 enable_alternative_service_with_different_host(false),
352 net_log(NULL) { 353 net_log(NULL) {
353 DCHECK(next_proto_is_spdy(protocol)) << "Invalid protocol: " << protocol; 354 DCHECK(next_proto_is_spdy(protocol)) << "Invalid protocol: " << protocol;
(...skipping 16 matching lines...) Expand all
370 transport_security_state(new TransportSecurityState), 371 transport_security_state(new TransportSecurityState),
371 proxy_service(std::move(proxy_service)), 372 proxy_service(std::move(proxy_service)),
372 ssl_config_service(new SSLConfigServiceDefaults), 373 ssl_config_service(new SSLConfigServiceDefaults),
373 socket_factory(new MockClientSocketFactory), 374 socket_factory(new MockClientSocketFactory),
374 http_auth_handler_factory( 375 http_auth_handler_factory(
375 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())), 376 HttpAuthHandlerFactory::CreateDefault(host_resolver.get())),
376 enable_ip_pooling(true), 377 enable_ip_pooling(true),
377 enable_ping(false), 378 enable_ping(false),
378 enable_user_alternate_protocol_ports(false), 379 enable_user_alternate_protocol_ports(false),
379 enable_npn(true), 380 enable_npn(true),
381 enable_priority_dependencies(true),
380 protocol(protocol), 382 protocol(protocol),
381 session_max_recv_window_size( 383 session_max_recv_window_size(
382 SpdySession::GetDefaultInitialWindowSize(protocol)), 384 SpdySession::GetDefaultInitialWindowSize(protocol)),
383 stream_max_recv_window_size( 385 stream_max_recv_window_size(
384 SpdySession::GetDefaultInitialWindowSize(protocol)), 386 SpdySession::GetDefaultInitialWindowSize(protocol)),
385 time_func(&base::TimeTicks::Now), 387 time_func(&base::TimeTicks::Now),
386 parse_alternative_services(false), 388 parse_alternative_services(false),
387 enable_alternative_service_with_different_host(false), 389 enable_alternative_service_with_different_host(false),
388 net_log(NULL) { 390 net_log(NULL) {
389 DCHECK(next_proto_is_spdy(protocol)) << "Invalid protocol: " << protocol; 391 DCHECK(next_proto_is_spdy(protocol)) << "Invalid protocol: " << protocol;
(...skipping 27 matching lines...) Expand all
417 params.proxy_service = session_deps->proxy_service.get(); 419 params.proxy_service = session_deps->proxy_service.get();
418 params.ssl_config_service = session_deps->ssl_config_service.get(); 420 params.ssl_config_service = session_deps->ssl_config_service.get();
419 params.http_auth_handler_factory = 421 params.http_auth_handler_factory =
420 session_deps->http_auth_handler_factory.get(); 422 session_deps->http_auth_handler_factory.get();
421 params.http_server_properties = 423 params.http_server_properties =
422 session_deps->http_server_properties.GetWeakPtr(); 424 session_deps->http_server_properties.GetWeakPtr();
423 params.enable_spdy_ping_based_connection_checking = session_deps->enable_ping; 425 params.enable_spdy_ping_based_connection_checking = session_deps->enable_ping;
424 params.enable_user_alternate_protocol_ports = 426 params.enable_user_alternate_protocol_ports =
425 session_deps->enable_user_alternate_protocol_ports; 427 session_deps->enable_user_alternate_protocol_ports;
426 params.enable_npn = session_deps->enable_npn; 428 params.enable_npn = session_deps->enable_npn;
429 params.enable_priority_dependencies =
430 session_deps->enable_priority_dependencies;
427 params.spdy_default_protocol = session_deps->protocol; 431 params.spdy_default_protocol = session_deps->protocol;
428 params.spdy_session_max_recv_window_size = 432 params.spdy_session_max_recv_window_size =
429 session_deps->session_max_recv_window_size; 433 session_deps->session_max_recv_window_size;
430 params.spdy_stream_max_recv_window_size = 434 params.spdy_stream_max_recv_window_size =
431 session_deps->stream_max_recv_window_size; 435 session_deps->stream_max_recv_window_size;
432 params.time_func = session_deps->time_func; 436 params.time_func = session_deps->time_func;
433 params.proxy_delegate = session_deps->proxy_delegate.get(); 437 params.proxy_delegate = session_deps->proxy_delegate.get();
434 params.parse_alternative_services = session_deps->parse_alternative_services; 438 params.parse_alternative_services = session_deps->parse_alternative_services;
435 params.enable_alternative_service_with_different_host = 439 params.enable_alternative_service_with_different_host =
436 session_deps->enable_alternative_service_with_different_host; 440 session_deps->enable_alternative_service_with_different_host;
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 return response_spdy_framer_.SerializeFrame(spdy_headers); 1039 return response_spdy_framer_.SerializeFrame(spdy_headers);
1036 } 1040 }
1037 1041
1038 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, 1042 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id,
1039 const SpdyHeaderBlock& block, 1043 const SpdyHeaderBlock& block,
1040 RequestPriority priority, 1044 RequestPriority priority,
1041 bool fin) { 1045 bool fin) {
1042 // Get the stream id of the next highest priority request 1046 // Get the stream id of the next highest priority request
1043 // (most recent request of the same priority, or last request of 1047 // (most recent request of the same priority, or last request of
1044 // an earlier priority). 1048 // an earlier priority).
1049 // Note that this is a duplicate of the logic in Http2PriorityDependencies
1050 // (slightly transformed as this is based on RequestPriority and that logic
1051 // on SpdyPriority, but only slightly transformed) and hence tests using
1052 // this function do not effectively test that logic.
1053 // That logic is tested by the Http2PriorityDependencies unit tests.
1045 int parent_stream_id = 0; 1054 int parent_stream_id = 0;
1046 for (int q = priority; q >= IDLE; --q) { 1055 for (int q = priority; q <= HIGHEST; ++q) {
1047 if (!priority_to_stream_id_list_[q].empty()) { 1056 if (!priority_to_stream_id_list_[q].empty()) {
1048 parent_stream_id = priority_to_stream_id_list_[q].back(); 1057 parent_stream_id = priority_to_stream_id_list_[q].back();
1049 break; 1058 break;
1050 } 1059 }
1051 } 1060 }
1052 1061
1053 priority_to_stream_id_list_[priority].push_back(stream_id); 1062 priority_to_stream_id_list_[priority].push_back(stream_id);
1054 1063
1055 if (protocol_ < kProtoHTTP2) { 1064 if (protocol_ < kProtoHTTP2) {
1056 SpdySynStreamIR syn_stream(stream_id); 1065 SpdySynStreamIR syn_stream(stream_id);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 } 1277 }
1269 } 1278 }
1270 1279
1271 void SpdyTestUtil::SetPriority(RequestPriority priority, 1280 void SpdyTestUtil::SetPriority(RequestPriority priority,
1272 SpdySynStreamIR* ir) const { 1281 SpdySynStreamIR* ir) const {
1273 ir->set_priority(ConvertRequestPriorityToSpdyPriority( 1282 ir->set_priority(ConvertRequestPriorityToSpdyPriority(
1274 priority, spdy_version())); 1283 priority, spdy_version()));
1275 } 1284 }
1276 1285
1277 } // namespace net 1286 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_test_util_common.h ('k') | testing/variations/fieldtrial_testing_config_android.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698