summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrjshade <rjshade@chromium.org>2015-12-18 11:26:02 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-18 19:27:13 +0000
commitd5ced07756084491d67575fabf0e2a6c88266586 (patch)
tree312dfba571227a2a81c21fc6de861c465fbbdd6c
parent02605f54be26b7082e432e972667a748f9480f08 (diff)
downloadchromium_src-d5ced07756084491d67575fabf0e2a6c88266586.zip
chromium_src-d5ced07756084491d67575fabf0e2a6c88266586.tar.gz
chromium_src-d5ced07756084491d67575fabf0e2a6c88266586.tar.bz2
Ran clang-format on all .h/.cc files in net/quic. No behavior change.
find ./net/quic/ \( -iname \*.h -o -iname \*.cc \) -exec clang-format -i --style="{BasedOnStyle: Chromium, Standard: Cpp11}" {} \; BUG= Review URL: https://codereview.chromium.org/1535113003 Cr-Commit-Position: refs/heads/master@{#366144}
-rw-r--r--net/quic/congestion_control/cubic.cc10
-rw-r--r--net/quic/congestion_control/cubic_bytes.cc4
-rw-r--r--net/quic/congestion_control/cubic_test.cc9
-rw-r--r--net/quic/congestion_control/hybrid_slow_start.cc12
-rw-r--r--net/quic/congestion_control/hybrid_slow_start.h4
-rw-r--r--net/quic/congestion_control/hybrid_slow_start_test.cc5
-rw-r--r--net/quic/congestion_control/pacing_sender.cc13
-rw-r--r--net/quic/congestion_control/pacing_sender_test.cc26
-rw-r--r--net/quic/congestion_control/prr_sender.cc5
-rw-r--r--net/quic/congestion_control/rtt_stats.cc12
-rw-r--r--net/quic/congestion_control/rtt_stats.h32
-rw-r--r--net/quic/congestion_control/rtt_stats_test.cc61
-rw-r--r--net/quic/congestion_control/send_algorithm_interface.cc2
-rw-r--r--net/quic/congestion_control/send_algorithm_simulator.cc75
-rw-r--r--net/quic/congestion_control/send_algorithm_simulator.h21
-rw-r--r--net/quic/congestion_control/tcp_cubic_bytes_sender.cc3
-rw-r--r--net/quic/congestion_control/tcp_cubic_bytes_sender_test.cc48
-rw-r--r--net/quic/congestion_control/tcp_cubic_sender.cc15
-rw-r--r--net/quic/congestion_control/tcp_cubic_sender_test.cc121
-rw-r--r--net/quic/congestion_control/tcp_loss_algorithm.cc2
-rw-r--r--net/quic/congestion_control/tcp_loss_algorithm_test.cc7
-rw-r--r--net/quic/congestion_control/time_loss_algorithm.cc2
-rw-r--r--net/quic/congestion_control/time_loss_algorithm_test.cc7
-rw-r--r--net/quic/crypto/aead_base_decrypter_openssl.cc7
-rw-r--r--net/quic/crypto/aead_base_encrypter_nss.cc4
-rw-r--r--net/quic/crypto/aead_base_encrypter_openssl.cc11
-rw-r--r--net/quic/crypto/aes_128_gcm_12_decrypter_nss.cc3
-rw-r--r--net/quic/crypto/aes_128_gcm_12_decrypter_openssl.cc4
-rw-r--r--net/quic/crypto/aes_128_gcm_12_decrypter_test.cc260
-rw-r--r--net/quic/crypto/aes_128_gcm_12_encrypter_nss.cc3
-rw-r--r--net/quic/crypto/aes_128_gcm_12_encrypter_openssl.cc4
-rw-r--r--net/quic/crypto/aes_128_gcm_12_encrypter_test.cc184
-rw-r--r--net/quic/crypto/cert_compressor.cc266
-rw-r--r--net/quic/crypto/cert_compressor_test.cc29
-rw-r--r--net/quic/crypto/chacha20_poly1305_decrypter_test.cc60
-rw-r--r--net/quic/crypto/chacha20_poly1305_encrypter_test.cc14
-rw-r--r--net/quic/crypto/channel_id_chromium.cc18
-rw-r--r--net/quic/crypto/channel_id_chromium.h5
-rw-r--r--net/quic/crypto/channel_id_nss.cc18
-rw-r--r--net/quic/crypto/channel_id_openssl.cc9
-rw-r--r--net/quic/crypto/channel_id_test.cc325
-rw-r--r--net/quic/crypto/common_cert_set_test.cc170
-rw-r--r--net/quic/crypto/crypto_framer.cc10
-rw-r--r--net/quic/crypto/crypto_framer_test.cc416
-rw-r--r--net/quic/crypto/crypto_handshake.cc3
-rw-r--r--net/quic/crypto/crypto_handshake_message.cc14
-rw-r--r--net/quic/crypto/crypto_handshake_message.h9
-rw-r--r--net/quic/crypto/crypto_protocol.h8
-rw-r--r--net/quic/crypto/crypto_secret_boxer.cc10
-rw-r--r--net/quic/crypto/crypto_secret_boxer_test.cc5
-rw-r--r--net/quic/crypto/crypto_server_config_protobuf.cc4
-rw-r--r--net/quic/crypto/crypto_server_config_protobuf.h52
-rw-r--r--net/quic/crypto/crypto_utils.cc12
-rw-r--r--net/quic/crypto/crypto_utils_test.cc90
-rw-r--r--net/quic/crypto/curve25519_key_exchange.cc4
-rw-r--r--net/quic/crypto/local_strike_register_client.cc14
-rw-r--r--net/quic/crypto/local_strike_register_client_test.cc12
-rw-r--r--net/quic/crypto/null_decrypter.cc17
-rw-r--r--net/quic/crypto/null_decrypter_test.cc31
-rw-r--r--net/quic/crypto/null_encrypter.cc20
-rw-r--r--net/quic/crypto/null_encrypter_test.cc14
-rw-r--r--net/quic/crypto/p256_key_exchange_nss.cc41
-rw-r--r--net/quic/crypto/p256_key_exchange_openssl.cc8
-rw-r--r--net/quic/crypto/p256_key_exchange_test.cc1
-rw-r--r--net/quic/crypto/proof_test.cc245
-rw-r--r--net/quic/crypto/proof_verifier_chromium.cc13
-rw-r--r--net/quic/crypto/proof_verifier_chromium.h1
-rw-r--r--net/quic/crypto/quic_crypto_client_config.cc47
-rw-r--r--net/quic/crypto/quic_crypto_client_config_test.cc24
-rw-r--r--net/quic/crypto/quic_crypto_server_config.cc139
-rw-r--r--net/quic/crypto/quic_crypto_server_config.h16
-rw-r--r--net/quic/crypto/quic_crypto_server_config_test.cc210
-rw-r--r--net/quic/crypto/quic_random.cc6
-rw-r--r--net/quic/crypto/quic_server_info.cc8
-rw-r--r--net/quic/crypto/strike_register.cc26
-rw-r--r--net/quic/crypto/strike_register_client.h7
-rw-r--r--net/quic/crypto/strike_register_test.cc30
-rw-r--r--net/quic/iovector.h18
-rw-r--r--net/quic/iovector_test.cc19
-rw-r--r--net/quic/network_connection.cc3
-rw-r--r--net/quic/port_suggester.cc5
-rw-r--r--net/quic/port_suggester_unittest.cc24
-rw-r--r--net/quic/quic_address_mismatch_test.cc60
-rw-r--r--net/quic/quic_alarm.cc6
-rw-r--r--net/quic/quic_alarm_test.cc13
-rw-r--r--net/quic/quic_bandwidth_test.cc16
-rw-r--r--net/quic/quic_client_session_base.cc6
-rw-r--r--net/quic/quic_client_session_base.h3
-rw-r--r--net/quic/quic_clock.cc3
-rw-r--r--net/quic/quic_config.cc87
-rw-r--r--net/quic/quic_config.h4
-rw-r--r--net/quic/quic_config_test.cc18
-rw-r--r--net/quic/quic_connection.cc97
-rw-r--r--net/quic/quic_connection.h11
-rw-r--r--net/quic/quic_connection_helper.cc6
-rw-r--r--net/quic/quic_connection_helper_test.cc12
-rw-r--r--net/quic/quic_connection_logger.cc101
-rw-r--r--net/quic/quic_connection_logger.h6
-rw-r--r--net/quic/quic_connection_stats.cc3
-rw-r--r--net/quic/quic_connection_stats.h5
-rw-r--r--net/quic/quic_connection_test.cc333
-rw-r--r--net/quic/quic_crypto_client_stream.cc52
-rw-r--r--net/quic/quic_crypto_client_stream_test.cc41
-rw-r--r--net/quic/quic_crypto_server_stream.cc15
-rw-r--r--net/quic/quic_crypto_stream.cc14
-rw-r--r--net/quic/quic_crypto_stream_test.cc10
-rw-r--r--net/quic/quic_data_reader.cc5
-rw-r--r--net/quic/quic_data_writer.cc7
-rw-r--r--net/quic/quic_data_writer.h4
-rw-r--r--net/quic/quic_data_writer_test.cc148
-rw-r--r--net/quic/quic_default_packet_writer.cc6
-rw-r--r--net/quic/quic_default_packet_writer.h8
-rw-r--r--net/quic/quic_end_to_end_unittest.cc16
-rw-r--r--net/quic/quic_fec_group_test.cc26
-rw-r--r--net/quic/quic_flow_controller.cc5
-rw-r--r--net/quic/quic_flow_controller.h1
-rw-r--r--net/quic/quic_flow_controller_test.cc7
-rw-r--r--net/quic/quic_framer_test.cc4
-rw-r--r--net/quic/quic_headers_stream.cc7
-rw-r--r--net/quic/quic_headers_stream_test.cc111
-rw-r--r--net/quic/quic_http_stream.cc35
-rw-r--r--net/quic/quic_http_stream.h2
-rw-r--r--net/quic/quic_http_stream_test.cc155
-rw-r--r--net/quic/quic_http_utils.cc4
-rw-r--r--net/quic/quic_network_transaction_unittest.cc214
-rw-r--r--net/quic/quic_packet_creator.cc29
-rw-r--r--net/quic/quic_packet_creator.h6
-rw-r--r--net/quic/quic_packet_creator_test.cc48
-rw-r--r--net/quic/quic_packet_generator_test.cc16
-rw-r--r--net/quic/quic_packet_reader.cc3
-rw-r--r--net/quic/quic_packet_reader.h2
-rw-r--r--net/quic/quic_packet_writer.h8
-rw-r--r--net/quic/quic_protocol.cc58
-rw-r--r--net/quic/quic_protocol.h69
-rw-r--r--net/quic/quic_protocol_test.cc16
-rw-r--r--net/quic/quic_received_packet_manager.cc23
-rw-r--r--net/quic/quic_received_packet_manager.h4
-rw-r--r--net/quic/quic_received_packet_manager_test.cc11
-rw-r--r--net/quic/quic_reliable_client_stream.cc2
-rw-r--r--net/quic/quic_reliable_client_stream_test.cc19
-rw-r--r--net/quic/quic_sent_entropy_manager_test.cc16
-rw-r--r--net/quic/quic_sent_packet_manager.cc49
-rw-r--r--net/quic/quic_sent_packet_manager.h11
-rw-r--r--net/quic/quic_sent_packet_manager_test.cc117
-rw-r--r--net/quic/quic_server_id.cc6
-rw-r--r--net/quic/quic_server_id.h7
-rw-r--r--net/quic/quic_server_id_test.cc2
-rw-r--r--net/quic/quic_session.cc22
-rw-r--r--net/quic/quic_session.h7
-rw-r--r--net/quic/quic_session_test.cc49
-rw-r--r--net/quic/quic_socket_address_coder.cc9
-rw-r--r--net/quic/quic_socket_address_coder.h8
-rw-r--r--net/quic/quic_socket_address_coder_test.cc48
-rw-r--r--net/quic/quic_spdy_session.cc6
-rw-r--r--net/quic/quic_stream_factory.cc26
-rw-r--r--net/quic/quic_stream_factory.h4
-rw-r--r--net/quic/quic_stream_factory_test.cc113
-rw-r--r--net/quic/quic_stream_sequencer_test.cc4
-rw-r--r--net/quic/quic_sustained_bandwidth_recorder.h4
-rw-r--r--net/quic/quic_time_test.cc28
-rw-r--r--net/quic/quic_types.cc19
-rw-r--r--net/quic/quic_types.h6
-rw-r--r--net/quic/quic_unacked_packet_map.cc4
-rw-r--r--net/quic/quic_unacked_packet_map.h4
-rw-r--r--net/quic/quic_unacked_packet_map_test.cc4
-rw-r--r--net/quic/quic_utils.cc19
-rw-r--r--net/quic/quic_utils_chromium.h24
-rw-r--r--net/quic/quic_utils_test.cc58
-rw-r--r--net/quic/quic_write_blocked_list.h1
-rw-r--r--net/quic/reliable_quic_stream.cc6
-rw-r--r--net/quic/reliable_quic_stream.h3
-rw-r--r--net/quic/reliable_quic_stream_test.cc52
-rw-r--r--net/quic/test_tools/crypto_test_utils.cc61
-rw-r--r--net/quic/test_tools/crypto_test_utils_openssl.cc4
-rw-r--r--net/quic/test_tools/delayed_verify_strike_register_client.cc17
-rw-r--r--net/quic/test_tools/delayed_verify_strike_register_client.h9
-rw-r--r--net/quic/test_tools/mock_clock.cc8
-rw-r--r--net/quic/test_tools/mock_crypto_client_stream.cc8
-rw-r--r--net/quic/test_tools/mock_crypto_client_stream.h13
-rw-r--r--net/quic/test_tools/mock_crypto_client_stream_factory.cc6
-rw-r--r--net/quic/test_tools/mock_crypto_client_stream_factory.h6
-rw-r--r--net/quic/test_tools/mock_quic_dispatcher.cc6
-rw-r--r--net/quic/test_tools/mock_quic_dispatcher.h7
-rw-r--r--net/quic/test_tools/mock_random.cc13
-rw-r--r--net/quic/test_tools/quic_ack_notifier_manager_peer.cc1
-rw-r--r--net/quic/test_tools/quic_ack_notifier_manager_peer.h1
-rw-r--r--net/quic/test_tools/quic_connection_peer.h3
-rw-r--r--net/quic/test_tools/quic_flow_controller_peer.cc4
-rw-r--r--net/quic/test_tools/quic_framer_peer.cc9
-rw-r--r--net/quic/test_tools/quic_sent_packet_manager_peer.cc7
-rw-r--r--net/quic/test_tools/quic_sent_packet_manager_peer.h4
-rw-r--r--net/quic/test_tools/quic_test_packet_maker.cc6
-rw-r--r--net/quic/test_tools/quic_test_packet_maker.h5
-rw-r--r--net/quic/test_tools/quic_test_utils.cc89
-rw-r--r--net/quic/test_tools/quic_test_utils.h65
-rw-r--r--net/quic/test_tools/simple_quic_framer.cc38
-rw-r--r--net/quic/test_tools/test_task_runner.cc16
-rw-r--r--net/tools/quic/end_to_end_test.cc51
-rw-r--r--net/tools/quic/quic_client.cc24
-rw-r--r--net/tools/quic/quic_client.h3
-rw-r--r--net/tools/quic/quic_client_bin.cc6
-rw-r--r--net/tools/quic/quic_client_session.cc3
-rw-r--r--net/tools/quic/quic_client_session_test.cc8
-rw-r--r--net/tools/quic/quic_default_packet_writer.cc7
-rw-r--r--net/tools/quic/quic_default_packet_writer.h4
-rw-r--r--net/tools/quic/quic_dispatcher.cc22
-rw-r--r--net/tools/quic/quic_dispatcher.h16
-rw-r--r--net/tools/quic/quic_dispatcher_test.cc52
-rw-r--r--net/tools/quic/quic_epoll_clock.cc3
-rw-r--r--net/tools/quic/quic_epoll_clock_test.cc6
-rw-r--r--net/tools/quic/quic_epoll_connection_helper.cc9
-rw-r--r--net/tools/quic/quic_in_memory_cache.cc8
-rw-r--r--net/tools/quic/quic_in_memory_cache.h13
-rw-r--r--net/tools/quic/quic_in_memory_cache_test.cc8
-rw-r--r--net/tools/quic/quic_packet_reader.cc3
-rw-r--r--net/tools/quic/quic_per_connection_packet_writer.cc11
-rw-r--r--net/tools/quic/quic_per_connection_packet_writer.h2
-rw-r--r--net/tools/quic/quic_server.cc26
-rw-r--r--net/tools/quic/quic_server.h4
-rw-r--r--net/tools/quic/quic_server_bin.cc2
-rw-r--r--net/tools/quic/quic_server_session_test.cc34
-rw-r--r--net/tools/quic/quic_simple_client.cc20
-rw-r--r--net/tools/quic/quic_simple_client_bin.cc6
-rw-r--r--net/tools/quic/quic_simple_per_connection_packet_writer.cc11
-rw-r--r--net/tools/quic/quic_simple_per_connection_packet_writer.h2
-rw-r--r--net/tools/quic/quic_simple_server.cc14
-rw-r--r--net/tools/quic/quic_simple_server_bin.cc2
-rw-r--r--net/tools/quic/quic_simple_server_packet_writer.cc15
-rw-r--r--net/tools/quic/quic_simple_server_packet_writer.h2
-rw-r--r--net/tools/quic/quic_simple_server_test.cc20
-rw-r--r--net/tools/quic/quic_socket_utils.cc33
-rw-r--r--net/tools/quic/quic_spdy_client_stream.cc6
-rw-r--r--net/tools/quic/quic_time_wait_list_manager.cc18
-rw-r--r--net/tools/quic/quic_time_wait_list_manager_test.cc35
-rw-r--r--net/tools/quic/synchronous_host_resolver.cc11
-rw-r--r--net/tools/quic/test_tools/http_message.cc35
-rw-r--r--net/tools/quic/test_tools/http_message.h7
-rw-r--r--net/tools/quic/test_tools/mock_epoll_server.cc20
-rw-r--r--net/tools/quic/test_tools/packet_dropping_test_writer.cc31
-rw-r--r--net/tools/quic/test_tools/packet_dropping_test_writer.h8
-rw-r--r--net/tools/quic/test_tools/quic_server_peer.cc4
-rw-r--r--net/tools/quic/test_tools/quic_test_client.cc33
-rw-r--r--net/tools/quic/test_tools/simple_client.cc8
-rw-r--r--net/tools/quic/test_tools/simple_client.h4
244 files changed, 3272 insertions, 4067 deletions
diff --git a/net/quic/congestion_control/cubic.cc b/net/quic/congestion_control/cubic.cc
index cc239be..d07af17 100644
--- a/net/quic/congestion_control/cubic.cc
+++ b/net/quic/congestion_control/cubic.cc
@@ -27,8 +27,8 @@ const int kCubeScale = 40; // 1024*1024^3 (first 1024 is from 0.100^3)
// where 0.100 is 100 ms which is the scaling
// round trip time.
const int kCubeCongestionWindowScale = 410;
-const uint64 kCubeFactor = (UINT64_C(1) << kCubeScale) /
- kCubeCongestionWindowScale;
+const uint64 kCubeFactor =
+ (UINT64_C(1) << kCubeScale) / kCubeCongestionWindowScale;
const uint32 kDefaultNumConnections = 2;
const float kBeta = 0.7f; // Default Cubic backoff factor.
@@ -128,7 +128,7 @@ QuicPacketCount Cubic::CongestionWindowAfterAck(
if (!epoch_.IsInitialized()) {
// First ACK after a loss event.
- epoch_ = current_time; // Start of epoch.
+ epoch_ = current_time; // Start of epoch.
acked_packets_count_ = 1; // Reset count.
// Reset estimated_tcp_congestion_window_ to be in sync with cubic.
estimated_tcp_congestion_window_ = current_congestion_window;
@@ -162,8 +162,8 @@ QuicPacketCount Cubic::CongestionWindowAfterAck(
kNumMicrosPerSecond;
int64 offset = time_to_origin_point_ - elapsed_time;
- QuicPacketCount delta_congestion_window = (kCubeCongestionWindowScale
- * offset * offset * offset) >> kCubeScale;
+ QuicPacketCount delta_congestion_window =
+ (kCubeCongestionWindowScale * offset * offset * offset) >> kCubeScale;
QuicPacketCount target_congestion_window =
origin_point_congestion_window_ - delta_congestion_window;
diff --git a/net/quic/congestion_control/cubic_bytes.cc b/net/quic/congestion_control/cubic_bytes.cc
index ae35ae4..520c3b2 100644
--- a/net/quic/congestion_control/cubic_bytes.cc
+++ b/net/quic/congestion_control/cubic_bytes.cc
@@ -26,8 +26,8 @@ const int kCubeScale = 40; // 1024*1024^3 (first 1024 is from 0.100^3)
// round trip time.
const int kCubeCongestionWindowScale = 410;
// The cube factor for packets in bytes.
-const uint64 kCubeFactor = (UINT64_C(1) << kCubeScale) /
- kCubeCongestionWindowScale / kDefaultTCPMSS;
+const uint64 kCubeFactor =
+ (UINT64_C(1) << kCubeScale) / kCubeCongestionWindowScale / kDefaultTCPMSS;
const uint32 kDefaultNumConnections = 2;
const float kBeta = 0.7f; // Default Cubic backoff factor.
diff --git a/net/quic/congestion_control/cubic_test.cc b/net/quic/congestion_control/cubic_test.cc
index 9be0d79..92f7550 100644
--- a/net/quic/congestion_control/cubic_test.cc
+++ b/net/quic/congestion_control/cubic_test.cc
@@ -17,7 +17,7 @@ const float kBeta = 0.7f; // Default Cubic backoff factor.
const uint32 kNumConnections = 2;
const float kNConnectionBeta = (kNumConnections - 1 + kBeta) / kNumConnections;
const float kNConnectionAlpha = 3 * kNumConnections * kNumConnections *
- (1 - kNConnectionBeta) / (1 + kNConnectionBeta);
+ (1 - kNConnectionBeta) / (1 + kNConnectionBeta);
class CubicTest : public ::testing::Test {
protected:
@@ -66,8 +66,8 @@ TEST_F(CubicTest, AboveOrigin) {
// Total time elapsed so far; add min_rtt (0.1s) here as well.
float elapsed_time_s = 10.0f + 0.1f;
// |expected_cwnd| is initial value of cwnd + K * t^3, where K = 0.4.
- expected_cwnd = 11 + (elapsed_time_s * elapsed_time_s * elapsed_time_s * 410)
- / 1024;
+ expected_cwnd =
+ 11 + (elapsed_time_s * elapsed_time_s * elapsed_time_s * 410) / 1024;
EXPECT_EQ(expected_cwnd, current_cwnd);
}
@@ -102,7 +102,6 @@ TEST_F(CubicTest, CwndIncreaseStatsDuringConvexRegion) {
}
}
-
TEST_F(CubicTest, LossEvents) {
const QuicTime::Delta rtt_min = hundred_ms_;
QuicPacketCount current_cwnd = 422;
@@ -135,7 +134,7 @@ TEST_F(CubicTest, BelowOrigin) {
// First update after loss to initialize the epoch.
current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
// Cubic phase.
- for (int i = 0; i < 40 ; ++i) {
+ for (int i = 0; i < 40; ++i) {
clock_.AdvanceTime(hundred_ms_);
current_cwnd = cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min);
}
diff --git a/net/quic/congestion_control/hybrid_slow_start.cc b/net/quic/congestion_control/hybrid_slow_start.cc
index 7c0ba21..c21eec4 100644
--- a/net/quic/congestion_control/hybrid_slow_start.cc
+++ b/net/quic/congestion_control/hybrid_slow_start.cc
@@ -86,23 +86,23 @@ bool HybridSlowStart::ShouldExitSlowStart(QuicTime::Delta latest_rtt,
// We only need to check this once per round.
if (rtt_sample_count_ == kHybridStartMinSamples) {
// Divide min_rtt by 8 to get a rtt increase threshold for exiting.
- int64 min_rtt_increase_threshold_us = min_rtt.ToMicroseconds() >>
- kHybridStartDelayFactorExp;
+ int64 min_rtt_increase_threshold_us =
+ min_rtt.ToMicroseconds() >> kHybridStartDelayFactorExp;
// Ensure the rtt threshold is never less than 2ms or more than 16ms.
- min_rtt_increase_threshold_us = min(min_rtt_increase_threshold_us,
- kHybridStartDelayMaxThresholdUs);
+ min_rtt_increase_threshold_us =
+ min(min_rtt_increase_threshold_us, kHybridStartDelayMaxThresholdUs);
QuicTime::Delta min_rtt_increase_threshold =
QuicTime::Delta::FromMicroseconds(max(min_rtt_increase_threshold_us,
kHybridStartDelayMinThresholdUs));
if (current_min_rtt_ > min_rtt.Add(min_rtt_increase_threshold)) {
- hystart_found_= DELAY;
+ hystart_found_ = DELAY;
}
}
// Exit from slow start if the cwnd is greater than 16 and
// increasing delay is found.
return congestion_window >= kHybridStartLowWindow &&
- hystart_found_ != NOT_FOUND;
+ hystart_found_ != NOT_FOUND;
}
} // namespace net
diff --git a/net/quic/congestion_control/hybrid_slow_start.h b/net/quic/congestion_control/hybrid_slow_start.h
index 457ef3e..0124a9e 100644
--- a/net/quic/congestion_control/hybrid_slow_start.h
+++ b/net/quic/congestion_control/hybrid_slow_start.h
@@ -54,9 +54,7 @@ class NET_EXPORT_PRIVATE HybridSlowStart {
void StartReceiveRound(QuicPacketNumber last_sent);
// Whether slow start has started.
- bool started() const {
- return started_;
- }
+ bool started() const { return started_; }
private:
// Whether a condition for exiting slow start has been found.
diff --git a/net/quic/congestion_control/hybrid_slow_start_test.cc b/net/quic/congestion_control/hybrid_slow_start_test.cc
index d3974c2..d3d0fda 100644
--- a/net/quic/congestion_control/hybrid_slow_start_test.cc
+++ b/net/quic/congestion_control/hybrid_slow_start_test.cc
@@ -14,9 +14,8 @@ namespace test {
class HybridSlowStartTest : public ::testing::Test {
protected:
HybridSlowStartTest()
- : one_ms_(QuicTime::Delta::FromMilliseconds(1)),
- rtt_(QuicTime::Delta::FromMilliseconds(60)) {
- }
+ : one_ms_(QuicTime::Delta::FromMilliseconds(1)),
+ rtt_(QuicTime::Delta::FromMilliseconds(60)) {}
void SetUp() override { slow_start_.reset(new HybridSlowStart()); }
const QuicTime::Delta one_ms_;
const QuicTime::Delta rtt_;
diff --git a/net/quic/congestion_control/pacing_sender.cc b/net/quic/congestion_control/pacing_sender.cc
index c5a9fa6..e3f6276 100644
--- a/net/quic/congestion_control/pacing_sender.cc
+++ b/net/quic/congestion_control/pacing_sender.cc
@@ -17,8 +17,7 @@ PacingSender::PacingSender(SendAlgorithmInterface* sender,
burst_tokens_(initial_packet_burst),
last_delayed_packet_sent_time_(QuicTime::Zero()),
ideal_next_packet_send_time_(QuicTime::Zero()),
- was_last_send_delayed_(false) {
-}
+ was_last_send_delayed_(false) {}
PacingSender::~PacingSender() {}
@@ -46,8 +45,8 @@ void PacingSender::OnCongestionEvent(bool rtt_updated,
QuicByteCount bytes_in_flight,
const CongestionVector& acked_packets,
const CongestionVector& lost_packets) {
- sender_->OnCongestionEvent(
- rtt_updated, bytes_in_flight, acked_packets, lost_packets);
+ sender_->OnCongestionEvent(rtt_updated, bytes_in_flight, acked_packets,
+ lost_packets);
}
bool PacingSender::OnPacketSent(
@@ -113,9 +112,9 @@ void PacingSender::OnRetransmissionTimeout(bool packets_retransmitted) {
}
QuicTime::Delta PacingSender::TimeUntilSend(
- QuicTime now,
- QuicByteCount bytes_in_flight,
- HasRetransmittableData has_retransmittable_data) const {
+ QuicTime now,
+ QuicByteCount bytes_in_flight,
+ HasRetransmittableData has_retransmittable_data) const {
QuicTime::Delta time_until_send =
sender_->TimeUntilSend(now, bytes_in_flight, has_retransmittable_data);
if (burst_tokens_ > 0 || bytes_in_flight == 0) {
diff --git a/net/quic/congestion_control/pacing_sender_test.cc b/net/quic/congestion_control/pacing_sender_test.cc
index cf069ef..4320b91 100644
--- a/net/quic/congestion_control/pacing_sender_test.cc
+++ b/net/quic/congestion_control/pacing_sender_test.cc
@@ -86,15 +86,14 @@ class PacingSenderTest : public ::testing::Test {
// In order for the packet to be sendable, the underlying sender must
// permit it to be sent immediately.
for (int i = 0; i < 2; ++i) {
- EXPECT_CALL(*mock_sender_, TimeUntilSend(clock_.Now(),
- kBytesInFlight,
+ EXPECT_CALL(*mock_sender_, TimeUntilSend(clock_.Now(), kBytesInFlight,
HAS_RETRANSMITTABLE_DATA))
.WillOnce(Return(zero_time_));
// Verify that the packet is delayed.
EXPECT_EQ(delay.ToMicroseconds(),
- pacing_sender_->TimeUntilSend(
- clock_.Now(), kBytesInFlight,
- HAS_RETRANSMITTABLE_DATA).ToMicroseconds());
+ pacing_sender_->TimeUntilSend(clock_.Now(), kBytesInFlight,
+ HAS_RETRANSMITTABLE_DATA)
+ .ToMicroseconds());
}
}
@@ -115,26 +114,22 @@ class PacingSenderTest : public ::testing::Test {
TEST_F(PacingSenderTest, NoSend) {
for (int i = 0; i < 2; ++i) {
- EXPECT_CALL(*mock_sender_, TimeUntilSend(clock_.Now(),
- kBytesInFlight,
+ EXPECT_CALL(*mock_sender_, TimeUntilSend(clock_.Now(), kBytesInFlight,
HAS_RETRANSMITTABLE_DATA))
.WillOnce(Return(infinite_time_));
EXPECT_EQ(infinite_time_,
- pacing_sender_->TimeUntilSend(clock_.Now(),
- kBytesInFlight,
+ pacing_sender_->TimeUntilSend(clock_.Now(), kBytesInFlight,
HAS_RETRANSMITTABLE_DATA));
}
}
TEST_F(PacingSenderTest, SendNow) {
for (int i = 0; i < 2; ++i) {
- EXPECT_CALL(*mock_sender_, TimeUntilSend(clock_.Now(),
- kBytesInFlight,
+ EXPECT_CALL(*mock_sender_, TimeUntilSend(clock_.Now(), kBytesInFlight,
HAS_RETRANSMITTABLE_DATA))
.WillOnce(Return(zero_time_));
EXPECT_EQ(zero_time_,
- pacing_sender_->TimeUntilSend(clock_.Now(),
- kBytesInFlight,
+ pacing_sender_->TimeUntilSend(clock_.Now(), kBytesInFlight,
HAS_RETRANSMITTABLE_DATA));
}
}
@@ -211,7 +206,7 @@ TEST_F(PacingSenderTest, InitialBurst) {
UpdateRtt();
// Send 10 packets, and verify that they are not paced.
- for (int i = 0 ; i < kInitialBurstPackets; ++i) {
+ for (int i = 0; i < kInitialBurstPackets; ++i) {
CheckPacketIsSentImmediately();
}
@@ -246,7 +241,7 @@ TEST_F(PacingSenderTest, InitialBurstNoRttMeasurement) {
EXPECT_CALL(*mock_sender_, GetCongestionWindow())
.WillOnce(Return(10 * kDefaultTCPMSS));
// Send 10 packets, and verify that they are not paced.
- for (int i = 0 ; i < kInitialBurstPackets; ++i) {
+ for (int i = 0; i < kInitialBurstPackets; ++i) {
CheckPacketIsSentImmediately();
}
@@ -256,7 +251,6 @@ TEST_F(PacingSenderTest, InitialBurstNoRttMeasurement) {
CheckPacketIsSentImmediately();
CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
-
clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(5));
CheckPacketIsSentImmediately();
diff --git a/net/quic/congestion_control/prr_sender.cc b/net/quic/congestion_control/prr_sender.cc
index e84bae8..b3f5f8b 100644
--- a/net/quic/congestion_control/prr_sender.cc
+++ b/net/quic/congestion_control/prr_sender.cc
@@ -17,11 +17,10 @@ PrrSender::PrrSender()
: bytes_sent_since_loss_(0),
bytes_delivered_since_loss_(0),
ack_count_since_loss_(0),
- bytes_in_flight_before_loss_(0) {
-}
+ bytes_in_flight_before_loss_(0) {}
void PrrSender::OnPacketSent(QuicByteCount sent_bytes) {
- bytes_sent_since_loss_ += sent_bytes;
+ bytes_sent_since_loss_ += sent_bytes;
}
void PrrSender::OnPacketLost(QuicByteCount bytes_in_flight) {
diff --git a/net/quic/congestion_control/rtt_stats.cc b/net/quic/congestion_control/rtt_stats.cc
index 3bc08bf..7a373ac 100644
--- a/net/quic/congestion_control/rtt_stats.cc
+++ b/net/quic/congestion_control/rtt_stats.cc
@@ -76,14 +76,14 @@ void RttStats::UpdateRtt(QuicTime::Delta send_delta,
// First time call.
if (smoothed_rtt_.IsZero()) {
smoothed_rtt_ = rtt_sample;
- mean_deviation_ = QuicTime::Delta::FromMicroseconds(
- rtt_sample.ToMicroseconds() / 2);
+ mean_deviation_ =
+ QuicTime::Delta::FromMicroseconds(rtt_sample.ToMicroseconds() / 2);
} else {
mean_deviation_ = QuicTime::Delta::FromMicroseconds(static_cast<int64>(
kOneMinusBeta * mean_deviation_.ToMicroseconds() +
kBeta * std::abs(smoothed_rtt_.Subtract(rtt_sample).ToMicroseconds())));
- smoothed_rtt_ = smoothed_rtt_.Multiply(kOneMinusAlpha).Add(
- rtt_sample.Multiply(kAlpha));
+ smoothed_rtt_ =
+ smoothed_rtt_.Multiply(kOneMinusAlpha).Add(rtt_sample.Multiply(kAlpha));
DVLOG(1) << " smoothed_rtt(us):" << smoothed_rtt_.ToMicroseconds()
<< " mean_deviation(us):" << mean_deviation_.ToMicroseconds();
}
@@ -118,11 +118,11 @@ void RttStats::UpdateRecentMinRtt(QuicTime::Delta rtt_sample, QuicTime now) {
half_window_rtt_ = quarter_window_rtt_;
quarter_window_rtt_ = RttSample(rtt_sample, now);
} else if (half_window_rtt_.time <
- now.Subtract(recent_min_rtt_window_.Multiply(kHalfWindow))) {
+ now.Subtract(recent_min_rtt_window_.Multiply(kHalfWindow))) {
half_window_rtt_ = quarter_window_rtt_;
quarter_window_rtt_ = RttSample(rtt_sample, now);
} else if (quarter_window_rtt_.time <
- now.Subtract(recent_min_rtt_window_.Multiply(kQuarterWindow))) {
+ now.Subtract(recent_min_rtt_window_.Multiply(kQuarterWindow))) {
quarter_window_rtt_ = RttSample(rtt_sample, now);
}
}
diff --git a/net/quic/congestion_control/rtt_stats.h b/net/quic/congestion_control/rtt_stats.h
index 0b888f3..5571aef 100644
--- a/net/quic/congestion_control/rtt_stats.h
+++ b/net/quic/congestion_control/rtt_stats.h
@@ -43,13 +43,9 @@ class NET_EXPORT_PRIVATE RttStats {
// Returns the EWMA smoothed RTT for the connection.
// May return Zero if no valid updates have occurred.
- QuicTime::Delta smoothed_rtt() const {
- return smoothed_rtt_;
- }
+ QuicTime::Delta smoothed_rtt() const { return smoothed_rtt_; }
- int64 initial_rtt_us() const {
- return initial_rtt_us_;
- }
+ int64 initial_rtt_us() const { return initial_rtt_us_; }
// Sets an initial RTT to be used for SmoothedRtt before any RTT updates.
void set_initial_rtt_us(int64 initial_rtt_us) {
@@ -62,25 +58,17 @@ class NET_EXPORT_PRIVATE RttStats {
// The most recent rtt measurement.
// May return Zero if no valid updates have occurred.
- QuicTime::Delta latest_rtt() const {
- return latest_rtt_;
- }
+ QuicTime::Delta latest_rtt() const { return latest_rtt_; }
// Returns the min_rtt for the entire connection.
// May return Zero if no valid updates have occurred.
- QuicTime::Delta min_rtt() const {
- return min_rtt_;
- }
+ QuicTime::Delta min_rtt() const { return min_rtt_; }
// Returns the min_rtt since SampleNewRecentMinRtt has been called, or the
// min_rtt for the entire connection if SampleNewMinRtt was never called.
- QuicTime::Delta recent_min_rtt() const {
- return recent_min_rtt_.rtt;
- }
+ QuicTime::Delta recent_min_rtt() const { return recent_min_rtt_.rtt; }
- QuicTime::Delta mean_deviation() const {
- return mean_deviation_;
- }
+ QuicTime::Delta mean_deviation() const { return mean_deviation_; }
// Sets how old a recent min rtt sample can be.
void set_recent_min_rtt_window(QuicTime::Delta recent_min_rtt_window) {
@@ -92,8 +80,8 @@ class NET_EXPORT_PRIVATE RttStats {
// Used to track a sampled RTT window.
struct RttSample {
- RttSample() : rtt(QuicTime::Delta::Zero()), time(QuicTime::Zero()) { }
- RttSample(QuicTime::Delta rtt, QuicTime time) : rtt(rtt), time(time) { }
+ RttSample() : rtt(QuicTime::Delta::Zero()), time(QuicTime::Zero()) {}
+ RttSample(QuicTime::Delta rtt, QuicTime time) : rtt(rtt), time(time) {}
QuicTime::Delta rtt;
QuicTime time; // Time the rtt sample was recorded.
@@ -116,8 +104,8 @@ class NET_EXPORT_PRIVATE RttStats {
// State variables for Kathleen Nichols MinRTT algorithm.
QuicTime::Delta recent_min_rtt_window_;
- RttSample recent_min_rtt_; // a in the windowed algorithm.
- RttSample half_window_rtt_; // b in the sampled algorithm.
+ RttSample recent_min_rtt_; // a in the windowed algorithm.
+ RttSample half_window_rtt_; // b in the sampled algorithm.
RttSample quarter_window_rtt_; // c in the sampled algorithm.
DISALLOW_COPY_AND_ASSIGN(RttStats);
diff --git a/net/quic/congestion_control/rtt_stats_test.cc b/net/quic/congestion_control/rtt_stats_test.cc
index 931fcb0..2146490 100644
--- a/net/quic/congestion_control/rtt_stats_test.cc
+++ b/net/quic/congestion_control/rtt_stats_test.cc
@@ -54,63 +54,55 @@ TEST_F(RttStatsTest, SmoothedRtt) {
TEST_F(RttStatsTest, MinRtt) {
rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(200),
- QuicTime::Delta::Zero(),
- QuicTime::Zero());
+ QuicTime::Delta::Zero(), QuicTime::Zero());
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(200), rtt_stats_.min_rtt());
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(200),
rtt_stats_.recent_min_rtt());
- rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(10),
- QuicTime::Delta::Zero(),
- QuicTime::Zero().Add(
- QuicTime::Delta::FromMilliseconds(10)));
+ rtt_stats_.UpdateRtt(
+ QuicTime::Delta::FromMilliseconds(10), QuicTime::Delta::Zero(),
+ QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(10)));
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10), rtt_stats_.min_rtt());
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10), rtt_stats_.recent_min_rtt());
- rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(50),
- QuicTime::Delta::Zero(),
- QuicTime::Zero().Add(
- QuicTime::Delta::FromMilliseconds(20)));
+ rtt_stats_.UpdateRtt(
+ QuicTime::Delta::FromMilliseconds(50), QuicTime::Delta::Zero(),
+ QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(20)));
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10), rtt_stats_.min_rtt());
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10), rtt_stats_.recent_min_rtt());
- rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(50),
- QuicTime::Delta::Zero(),
- QuicTime::Zero().Add(
- QuicTime::Delta::FromMilliseconds(30)));
+ rtt_stats_.UpdateRtt(
+ QuicTime::Delta::FromMilliseconds(50), QuicTime::Delta::Zero(),
+ QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(30)));
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10), rtt_stats_.min_rtt());
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10), rtt_stats_.recent_min_rtt());
- rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(50),
- QuicTime::Delta::Zero(),
- QuicTime::Zero().Add(
- QuicTime::Delta::FromMilliseconds(40)));
+ rtt_stats_.UpdateRtt(
+ QuicTime::Delta::FromMilliseconds(50), QuicTime::Delta::Zero(),
+ QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(40)));
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10), rtt_stats_.min_rtt());
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10), rtt_stats_.recent_min_rtt());
// Verify that ack_delay does not go into recording of min_rtt_.
- rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(7),
- QuicTime::Delta::FromMilliseconds(2),
- QuicTime::Zero().Add(
- QuicTime::Delta::FromMilliseconds(50)));
+ rtt_stats_.UpdateRtt(
+ QuicTime::Delta::FromMilliseconds(7),
+ QuicTime::Delta::FromMilliseconds(2),
+ QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(50)));
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(7), rtt_stats_.min_rtt());
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(7), rtt_stats_.recent_min_rtt());
}
TEST_F(RttStatsTest, RecentMinRtt) {
rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(10),
- QuicTime::Delta::Zero(),
- QuicTime::Zero());
+ QuicTime::Delta::Zero(), QuicTime::Zero());
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10), rtt_stats_.min_rtt());
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10), rtt_stats_.recent_min_rtt());
rtt_stats_.SampleNewRecentMinRtt(4);
for (int i = 0; i < 3; ++i) {
rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(50),
- QuicTime::Delta::Zero(),
- QuicTime::Zero());
+ QuicTime::Delta::Zero(), QuicTime::Zero());
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10), rtt_stats_.min_rtt());
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10),
rtt_stats_.recent_min_rtt());
}
rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(50),
- QuicTime::Delta::Zero(),
- QuicTime::Zero());
+ QuicTime::Delta::Zero(), QuicTime::Zero());
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10), rtt_stats_.min_rtt());
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(50), rtt_stats_.recent_min_rtt());
}
@@ -157,8 +149,7 @@ TEST_F(RttStatsTest, WindowedRecentMinRtt) {
EXPECT_EQ(rtt_sample, RttStatsPeer::GetQuarterWindowRtt(&rtt_stats_));
EXPECT_EQ(rtt_sample.Subtract(QuicTime::Delta::FromMilliseconds(5)),
RttStatsPeer::GetHalfWindowRtt(&rtt_stats_));
- EXPECT_EQ(QuicTime::Delta::FromMilliseconds(70),
- rtt_stats_.recent_min_rtt());
+ EXPECT_EQ(QuicTime::Delta::FromMilliseconds(70), rtt_stats_.recent_min_rtt());
// A new half rtt low sets that and the quarter rtt low.
rtt_sample = rtt_sample.Subtract(QuicTime::Delta::FromMilliseconds(15));
@@ -166,8 +157,7 @@ TEST_F(RttStatsTest, WindowedRecentMinRtt) {
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10), rtt_stats_.min_rtt());
EXPECT_EQ(rtt_sample, RttStatsPeer::GetQuarterWindowRtt(&rtt_stats_));
EXPECT_EQ(rtt_sample, RttStatsPeer::GetHalfWindowRtt(&rtt_stats_));
- EXPECT_EQ(QuicTime::Delta::FromMilliseconds(70),
- rtt_stats_.recent_min_rtt());
+ EXPECT_EQ(QuicTime::Delta::FromMilliseconds(70), rtt_stats_.recent_min_rtt());
// A new full window loss sets the recent_min_rtt, but not min_rtt.
rtt_sample = QuicTime::Delta::FromMilliseconds(65);
@@ -232,10 +222,9 @@ TEST_F(RttStatsTest, UpdateRttWithBadSendDeltas) {
for (QuicTime::Delta bad_send_delta : bad_send_deltas) {
SCOPED_TRACE(Message() << "bad_send_delta = "
- << bad_send_delta.ToMicroseconds());
- EXPECT_CALL(log, Log(LOG_WARNING, _, _, _, HasSubstr("Ignoring")));
- rtt_stats_.UpdateRtt(bad_send_delta,
- QuicTime::Delta::Zero(),
+ << bad_send_delta.ToMicroseconds());
+ EXPECT_CALL(log, Log(LOG_WARNING, _, _, _, HasSubstr("Ignoring")));
+ rtt_stats_.UpdateRtt(bad_send_delta, QuicTime::Delta::Zero(),
QuicTime::Zero());
EXPECT_EQ(initial_rtt, rtt_stats_.min_rtt());
EXPECT_EQ(initial_rtt, rtt_stats_.recent_min_rtt());
diff --git a/net/quic/congestion_control/send_algorithm_interface.cc b/net/quic/congestion_control/send_algorithm_interface.cc
index d1b0ec5..d8a9c93 100644
--- a/net/quic/congestion_control/send_algorithm_interface.cc
+++ b/net/quic/congestion_control/send_algorithm_interface.cc
@@ -40,7 +40,7 @@ SendAlgorithmInterface* SendAlgorithmInterface::Create(
initial_congestion_window,
max_congestion_window, stats);
case kBBR:
- // TODO(rtenneti): Enable BbrTcpSender.
+// TODO(rtenneti): Enable BbrTcpSender.
#if 0
return new BbrTcpSender(clock, rtt_stats, initial_congestion_window,
max_congestion_window, stats, true);
diff --git a/net/quic/congestion_control/send_algorithm_simulator.cc b/net/quic/congestion_control/send_algorithm_simulator.cc
index 08004f2..83326f3 100644
--- a/net/quic/congestion_control/send_algorithm_simulator.cc
+++ b/net/quic/congestion_control/send_algorithm_simulator.cc
@@ -58,10 +58,9 @@ SendAlgorithmSimulator::Transfer::Transfer(Sender* sender,
start_time(start_time),
name(name) {}
-SendAlgorithmSimulator::SendAlgorithmSimulator(
- MockClock* clock,
- QuicBandwidth bandwidth,
- QuicTime::Delta rtt)
+SendAlgorithmSimulator::SendAlgorithmSimulator(MockClock* clock,
+ QuicBandwidth bandwidth,
+ QuicTime::Delta rtt)
: clock_(clock),
lose_next_ack_(false),
forward_loss_rate_(0),
@@ -83,8 +82,10 @@ void SendAlgorithmSimulator::AddTransfer(Sender* sender, size_t num_bytes) {
StringPrintf("#%zu", pending_transfers_.size()));
}
-void SendAlgorithmSimulator::AddTransfer(
- Sender* sender, size_t num_bytes, QuicTime start_time, string name) {
+void SendAlgorithmSimulator::AddTransfer(Sender* sender,
+ size_t num_bytes,
+ QuicTime start_time,
+ string name) {
pending_transfers_.push_back(Transfer(sender, num_bytes, start_time, name));
// Record initial stats from when the transfer begins.
pending_transfers_.back().sender->RecordStats();
@@ -97,12 +98,11 @@ void SendAlgorithmSimulator::TransferBytes() {
void SendAlgorithmSimulator::TransferBytes(QuicByteCount max_bytes,
QuicTime::Delta max_time) {
- const QuicTime end_time = max_time.IsInfinite() ?
- QuicTime::Zero().Add(QuicTime::Delta::Infinite()) :
- clock_->Now().Add(max_time);
+ const QuicTime end_time =
+ max_time.IsInfinite() ? QuicTime::Zero().Add(QuicTime::Delta::Infinite())
+ : clock_->Now().Add(max_time);
QuicByteCount bytes_sent = 0;
- while (!pending_transfers_.empty() &&
- clock_->Now() < end_time &&
+ while (!pending_transfers_.empty() && clock_->Now() < end_time &&
bytes_sent < max_bytes) {
// Determine the times of next send and of the next ack arrival.
PacketEvent send_event = NextSendEvent();
@@ -117,8 +117,9 @@ void SendAlgorithmSimulator::TransferBytes(QuicByteCount max_bytes,
SendDataNow(&pending_transfers_.front());
} else if (ack_event.time_delta < send_event.time_delta) {
DVLOG(1) << "Handling ack of largest observed:"
- << ack_event.transfer->sender->next_acked << ", advancing time:"
- << ack_event.time_delta.ToMicroseconds() << "us";
+ << ack_event.transfer->sender->next_acked
+ << ", advancing time:" << ack_event.time_delta.ToMicroseconds()
+ << "us";
// Ack data all the data up to ack time and lose any missing packet
// numbers.
clock_->AdvanceTime(ack_event.time_delta);
@@ -146,9 +147,8 @@ SendAlgorithmSimulator::PacketEvent SendAlgorithmSimulator::NextSendEvent() {
// If the flow hasn't started, use the start time.
QuicTime::Delta transfer_send_time = it->start_time.Subtract(clock_->Now());
if (clock_->Now() >= it->start_time) {
- transfer_send_time =
- it->sender->send_algorithm->TimeUntilSend(
- clock_->Now(), it->bytes_in_flight, HAS_RETRANSMITTABLE_DATA);
+ transfer_send_time = it->sender->send_algorithm->TimeUntilSend(
+ clock_->Now(), it->bytes_in_flight, HAS_RETRANSMITTABLE_DATA);
}
if (transfer_send_time < next_send_time) {
next_send_time = transfer_send_time;
@@ -267,12 +267,12 @@ bool SendAlgorithmSimulator::HasRecentLostPackets(
}
void SendAlgorithmSimulator::HandlePendingAck(Transfer* transfer) {
- Sender* sender = transfer->sender;
+ Sender* sender = transfer->sender;
DCHECK_LT(sender->last_acked, sender->next_acked);
SendAlgorithmInterface::CongestionVector acked_packets;
SendAlgorithmInterface::CongestionVector lost_packets;
- DVLOG(1) << "Acking packets from:" << sender->last_acked
- << " to " << sender->next_acked
+ DVLOG(1) << "Acking packets from:" << sender->last_acked << " to "
+ << sender->next_acked
<< " bytes_in_flight:" << transfer->bytes_in_flight
<< " Now():" << (clock_->Now().ToDebuggingValue() / 1000) << "ms";
// Some entries may be missing from the sent_packets_ array, if they were
@@ -305,16 +305,15 @@ void SendAlgorithmSimulator::HandlePendingAck(Transfer* transfer) {
DCHECK(!largest_observed.lost);
DVLOG(1) << "Updating RTT from send_time:"
- << largest_observed.send_time.ToDebuggingValue() << " to ack_time:"
- << largest_observed.ack_time.ToDebuggingValue();
+ << largest_observed.send_time.ToDebuggingValue()
+ << " to ack_time:" << largest_observed.ack_time.ToDebuggingValue();
QuicTime::Delta measured_rtt =
largest_observed.ack_time.Subtract(largest_observed.send_time);
DCHECK_GE(measured_rtt.ToMicroseconds(), rtt_.ToMicroseconds());
- sender->rtt_stats->UpdateRtt(measured_rtt,
- QuicTime::Delta::Zero(),
+ sender->rtt_stats->UpdateRtt(measured_rtt, QuicTime::Delta::Zero(),
clock_->Now());
- sender->send_algorithm->OnCongestionEvent(
- true, transfer->bytes_in_flight, acked_packets, lost_packets);
+ sender->send_algorithm->OnCongestionEvent(true, transfer->bytes_in_flight,
+ acked_packets, lost_packets);
DCHECK_LE(kPacketSize * (acked_packets.size() + lost_packets.size()),
transfer->bytes_in_flight);
transfer->bytes_in_flight -=
@@ -327,11 +326,11 @@ void SendAlgorithmSimulator::HandlePendingAck(Transfer* transfer) {
// Remove completed transfers and record transfer bandwidth.
QuicTime::Delta transfer_time =
clock_->Now().Subtract(transfer->start_time);
- sender->last_transfer_loss_rate = static_cast<float>(transfer->bytes_lost) /
+ sender->last_transfer_loss_rate =
+ static_cast<float>(transfer->bytes_lost) /
(transfer->bytes_lost + transfer->bytes_acked);
- sender->last_transfer_bandwidth =
- QuicBandwidth::FromBytesAndTimeDelta(transfer->num_bytes,
- transfer_time);
+ sender->last_transfer_bandwidth = QuicBandwidth::FromBytesAndTimeDelta(
+ transfer->num_bytes, transfer_time);
DCHECK_GE(bandwidth_.ToBitsPerSecond(),
sender->last_transfer_bandwidth.ToBitsPerSecond());
for (vector<Transfer>::iterator it = pending_transfers_.begin();
@@ -345,16 +344,16 @@ void SendAlgorithmSimulator::HandlePendingAck(Transfer* transfer) {
}
void SendAlgorithmSimulator::SendDataNow(Transfer* transfer) {
- Sender* sender = transfer->sender;
+ Sender* sender = transfer->sender;
++sender->last_sent;
DVLOG(1) << "Sending packet:" << sender->last_sent
<< " name:" << transfer->name
<< " bytes_in_flight:" << transfer->bytes_in_flight
<< " cwnd:" << sender->send_algorithm->GetCongestionWindow()
<< " Now():" << (clock_->Now().ToDebuggingValue() / 1000) << "ms";
- sender->send_algorithm->OnPacketSent(
- clock_->Now(), transfer->bytes_in_flight,
- sender->last_sent, kPacketSize, HAS_RETRANSMITTABLE_DATA);
+ sender->send_algorithm->OnPacketSent(clock_->Now(), transfer->bytes_in_flight,
+ sender->last_sent, kPacketSize,
+ HAS_RETRANSMITTABLE_DATA);
// Lose the packet immediately if the buffer is full.
if (sent_packets_.size() * kPacketSize < buffer_size_) {
// TODO(ianswett): This buffer simulation is an approximation.
@@ -378,11 +377,13 @@ void SendAlgorithmSimulator::SendDataNow(Transfer* transfer) {
if (kPacketSize > bdp) {
ack_time = ack_time.Add(bandwidth_.TransferTime(kPacketSize - bdp));
}
- QuicTime queue_ack_time = sent_packets_.empty() ? QuicTime::Zero() :
- sent_packets_.back().ack_time.Add(bandwidth_.TransferTime(kPacketSize));
+ QuicTime queue_ack_time = sent_packets_.empty()
+ ? QuicTime::Zero()
+ : sent_packets_.back().ack_time.Add(
+ bandwidth_.TransferTime(kPacketSize));
ack_time = QuicTime::Max(ack_time, queue_ack_time);
- sent_packets_.push_back(SentPacket(
- sender->last_sent, clock_->Now(), ack_time, packet_lost, transfer));
+ sent_packets_.push_back(SentPacket(sender->last_sent, clock_->Now(),
+ ack_time, packet_lost, transfer));
} else {
DVLOG(1) << "losing packet:" << sender->last_sent
<< " name:" << transfer->name << " because the buffer was full.";
diff --git a/net/quic/congestion_control/send_algorithm_simulator.h b/net/quic/congestion_control/send_algorithm_simulator.h
index 4f96bb8..e6d3888 100644
--- a/net/quic/congestion_control/send_algorithm_simulator.h
+++ b/net/quic/congestion_control/send_algorithm_simulator.h
@@ -27,8 +27,7 @@ namespace net {
class SendAlgorithmSimulator {
public:
struct Sender {
- Sender(SendAlgorithmInterface* send_algorithm,
- RttStats* rtt_stats);
+ Sender(SendAlgorithmInterface* send_algorithm, RttStats* rtt_stats);
Sender(SendAlgorithmInterface* send_algorithm,
RttStats* rtt_stats,
QuicTime::Delta additional_rtt);
@@ -46,13 +45,12 @@ class SendAlgorithmSimulator {
std::string DebugString() {
return StringPrintf("observed goodput(bytes/s):%" PRId64
" loss rate:%f"
- " cwnd:%" PRIu64
- " max_cwnd:%" PRIu64 " min_cwnd:%" PRIu64
- " max_cwnd_drop:%" PRIu64,
+ " cwnd:%" PRIu64 " max_cwnd:%" PRIu64
+ " min_cwnd:%" PRIu64 " max_cwnd_drop:%" PRIu64,
last_transfer_bandwidth.ToBytesPerSecond(),
last_transfer_loss_rate,
- send_algorithm->GetCongestionWindow(),
- max_cwnd, min_cwnd, max_cwnd_drop);
+ send_algorithm->GetCongestionWindow(), max_cwnd,
+ min_cwnd, max_cwnd_drop);
}
SendAlgorithmInterface* send_algorithm;
@@ -123,9 +121,7 @@ class SendAlgorithmSimulator {
~SendAlgorithmSimulator();
// For local ad-hoc testing.
- void set_bandwidth(QuicBandwidth bandwidth) {
- bandwidth_ = bandwidth;
- }
+ void set_bandwidth(QuicBandwidth bandwidth) { bandwidth_ = bandwidth; }
void set_forward_loss_rate(float loss_rate) {
DCHECK_LT(loss_rate, 1.0f);
@@ -178,8 +174,7 @@ class SendAlgorithmSimulator {
// A pending packet event, either a send or an ack.
struct PacketEvent {
PacketEvent(QuicTime::Delta time_delta, Transfer* transfer)
- : time_delta(time_delta),
- transfer(transfer) {}
+ : time_delta(time_delta), transfer(transfer) {}
QuicTime::Delta time_delta;
Transfer* transfer;
@@ -230,7 +225,7 @@ class SendAlgorithmSimulator {
float loss_correlation_; // Likelihood the subsequent packet is lost.
QuicBandwidth bandwidth_;
QuicTime::Delta rtt_;
- size_t buffer_size_; // In bytes.
+ size_t buffer_size_; // In bytes.
QuicTime::Delta delayed_ack_timer_;
DISALLOW_COPY_AND_ASSIGN(SendAlgorithmSimulator);
diff --git a/net/quic/congestion_control/tcp_cubic_bytes_sender.cc b/net/quic/congestion_control/tcp_cubic_bytes_sender.cc
index 078e3d4..56717e9 100644
--- a/net/quic/congestion_control/tcp_cubic_bytes_sender.cc
+++ b/net/quic/congestion_control/tcp_cubic_bytes_sender.cc
@@ -54,8 +54,7 @@ TcpCubicBytesSender::TcpCubicBytesSender(
initial_max_tcp_congestion_window_(max_congestion_window *
kDefaultTCPMSS) {}
-TcpCubicBytesSender::~TcpCubicBytesSender() {
-}
+TcpCubicBytesSender::~TcpCubicBytesSender() {}
void TcpCubicBytesSender::SetFromConfig(const QuicConfig& config,
Perspective perspective) {
diff --git a/net/quic/congestion_control/tcp_cubic_bytes_sender_test.cc b/net/quic/congestion_control/tcp_cubic_bytes_sender_test.cc
index ef3230e..5681003 100644
--- a/net/quic/congestion_control/tcp_cubic_bytes_sender_test.cc
+++ b/net/quic/congestion_control/tcp_cubic_bytes_sender_test.cc
@@ -63,14 +63,16 @@ class TcpCubicBytesSenderTest : public ::testing::Test {
// Send as long as TimeUntilSend returns Zero.
int packets_sent = 0;
bool can_send = sender_->TimeUntilSend(clock_.Now(), bytes_in_flight_,
- HAS_RETRANSMITTABLE_DATA).IsZero();
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero();
while (can_send) {
sender_->OnPacketSent(clock_.Now(), bytes_in_flight_, packet_number_++,
kDefaultTCPMSS, HAS_RETRANSMITTABLE_DATA);
++packets_sent;
bytes_in_flight_ += kDefaultTCPMSS;
can_send = sender_->TimeUntilSend(clock_.Now(), bytes_in_flight_,
- HAS_RETRANSMITTABLE_DATA).IsZero();
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero();
}
return packets_sent;
}
@@ -127,11 +129,11 @@ TEST_F(TcpCubicBytesSenderTest, SimpleSender) {
// At startup make sure we are at the default.
EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow());
// At startup make sure we can send.
- EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
// Make sure we can send.
- EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
// And that window is un-affected.
EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow());
@@ -139,18 +141,19 @@ TEST_F(TcpCubicBytesSenderTest, SimpleSender) {
SendAvailableSendWindow();
EXPECT_FALSE(sender_->TimeUntilSend(clock_.Now(),
sender_->GetCongestionWindow(),
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
}
TEST_F(TcpCubicBytesSenderTest, ApplicationLimitedSlowStart) {
// Send exactly 10 packets and ensure the CWND ends at 14 packets.
const int kNumberOfAcks = 5;
// At startup make sure we can send.
- EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
// Make sure we can send.
- EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
SendAvailableSendWindow();
for (int i = 0; i < kNumberOfAcks; ++i) {
@@ -165,12 +168,12 @@ TEST_F(TcpCubicBytesSenderTest, ApplicationLimitedSlowStart) {
TEST_F(TcpCubicBytesSenderTest, ExponentialSlowStart) {
const int kNumberOfAcks = 20;
// At startup make sure we can send.
- EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
EXPECT_EQ(QuicBandwidth::Zero(), sender_->BandwidthEstimate());
// Make sure we can send.
- EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
for (int i = 0; i < kNumberOfAcks; ++i) {
// Send our full send window.
@@ -317,7 +320,8 @@ TEST_F(TcpCubicBytesSenderTest, SlowStartBurstPacketLossPRR) {
// Immediately after the loss, ensure at least one packet can be sent.
// Losses without subsequent acks can occur with timer based loss detection.
EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), bytes_in_flight_,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
AckNPackets(1);
// We should now have fallen out of slow start with a reduced window.
@@ -634,13 +638,17 @@ TEST_F(TcpCubicBytesSenderTest, PaceBelowCWND) {
sender_->OnRetransmissionTimeout(true);
EXPECT_EQ(kDefaultTCPMSS, sender_->GetCongestionWindow());
EXPECT_TRUE(sender_->TimeUntilSend(QuicTime::Zero(), kDefaultTCPMSS,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
EXPECT_TRUE(sender_->TimeUntilSend(QuicTime::Zero(), 2 * kDefaultTCPMSS,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
EXPECT_TRUE(sender_->TimeUntilSend(QuicTime::Zero(), 3 * kDefaultTCPMSS,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
EXPECT_FALSE(sender_->TimeUntilSend(QuicTime::Zero(), 4 * kDefaultTCPMSS,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
}
TEST_F(TcpCubicBytesSenderTest, ResetAfterConnectionMigration) {
diff --git a/net/quic/congestion_control/tcp_cubic_sender.cc b/net/quic/congestion_control/tcp_cubic_sender.cc
index 7563936..e36c4e1 100644
--- a/net/quic/congestion_control/tcp_cubic_sender.cc
+++ b/net/quic/congestion_control/tcp_cubic_sender.cc
@@ -24,7 +24,7 @@ namespace {
// fast retransmission. The cwnd after a timeout is still 1.
const QuicPacketCount kDefaultMinimumCongestionWindow = 2;
const QuicByteCount kMaxBurstBytes = 3 * kDefaultTCPMSS;
-const float kRenoBeta = 0.7f; // Reno backoff factor.
+const float kRenoBeta = 0.7f; // Reno backoff factor.
const uint32 kDefaultNumConnections = 2; // N-connection emulation.
} // namespace
@@ -128,11 +128,10 @@ float TcpCubicSender::RenoBeta() const {
return (num_connections_ - 1 + kRenoBeta) / num_connections_;
}
-void TcpCubicSender::OnCongestionEvent(
- bool rtt_updated,
- QuicByteCount bytes_in_flight,
- const CongestionVector& acked_packets,
- const CongestionVector& lost_packets) {
+void TcpCubicSender::OnCongestionEvent(bool rtt_updated,
+ QuicByteCount bytes_in_flight,
+ const CongestionVector& acked_packets,
+ const CongestionVector& lost_packets) {
if (rtt_updated && InSlowStart() &&
hybrid_slow_start_.ShouldExitSlowStart(rtt_stats_->latest_rtt(),
rtt_stats_->min_rtt(),
@@ -298,8 +297,8 @@ bool TcpCubicSender::IsCwndLimited(QuicByteCount bytes_in_flight) const {
}
const QuicByteCount available_bytes =
congestion_window_bytes - bytes_in_flight;
- const bool slow_start_limited = InSlowStart() &&
- bytes_in_flight > congestion_window_bytes / 2;
+ const bool slow_start_limited =
+ InSlowStart() && bytes_in_flight > congestion_window_bytes / 2;
return slow_start_limited || available_bytes <= kMaxBurstBytes;
}
diff --git a/net/quic/congestion_control/tcp_cubic_sender_test.cc b/net/quic/congestion_control/tcp_cubic_sender_test.cc
index db8aff5a..444851d 100644
--- a/net/quic/congestion_control/tcp_cubic_sender_test.cc
+++ b/net/quic/congestion_control/tcp_cubic_sender_test.cc
@@ -44,21 +44,15 @@ class TcpCubicSenderPeer : public TcpCubicSender {
max_tcp_congestion_window,
&stats_) {}
- QuicPacketCount congestion_window() {
- return congestion_window_;
- }
+ QuicPacketCount congestion_window() { return congestion_window_; }
- QuicPacketCount slowstart_threshold() {
- return slowstart_threshold_;
- }
+ QuicPacketCount slowstart_threshold() { return slowstart_threshold_; }
const HybridSlowStart& hybrid_slow_start() const {
return hybrid_slow_start_;
}
- float GetRenoBeta() const {
- return RenoBeta();
- }
+ float GetRenoBeta() const { return RenoBeta(); }
RttStats rtt_stats_;
QuicConnectionStats stats_;
@@ -76,15 +70,17 @@ class TcpCubicSenderTest : public ::testing::Test {
int SendAvailableSendWindow() {
// Send as long as TimeUntilSend returns Zero.
int packets_sent = 0;
- bool can_send = sender_->TimeUntilSend(
- clock_.Now(), bytes_in_flight_, HAS_RETRANSMITTABLE_DATA).IsZero();
+ bool can_send = sender_->TimeUntilSend(clock_.Now(), bytes_in_flight_,
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero();
while (can_send) {
sender_->OnPacketSent(clock_.Now(), bytes_in_flight_, packet_number_++,
kDefaultTCPMSS, HAS_RETRANSMITTABLE_DATA);
++packets_sent;
bytes_in_flight_ += kDefaultTCPMSS;
- can_send = sender_->TimeUntilSend(
- clock_.Now(), bytes_in_flight_, HAS_RETRANSMITTABLE_DATA).IsZero();
+ can_send = sender_->TimeUntilSend(clock_.Now(), bytes_in_flight_,
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero();
}
return packets_sent;
}
@@ -92,8 +88,7 @@ class TcpCubicSenderTest : public ::testing::Test {
// Normal is that TCP acks every other segment.
void AckNPackets(int n) {
sender_->rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(60),
- QuicTime::Delta::Zero(),
- clock_.Now());
+ QuicTime::Delta::Zero(), clock_.Now());
SendAlgorithmInterface::CongestionVector acked_packets;
SendAlgorithmInterface::CongestionVector lost_packets;
for (int i = 0; i < n; ++i) {
@@ -101,8 +96,8 @@ class TcpCubicSenderTest : public ::testing::Test {
acked_packets.push_back(
std::make_pair(acked_packet_number_, kDefaultTCPMSS));
}
- sender_->OnCongestionEvent(
- true, bytes_in_flight_, acked_packets, lost_packets);
+ sender_->OnCongestionEvent(true, bytes_in_flight_, acked_packets,
+ lost_packets);
bytes_in_flight_ -= n * kDefaultTCPMSS;
clock_.AdvanceTime(one_ms_);
}
@@ -115,8 +110,8 @@ class TcpCubicSenderTest : public ::testing::Test {
lost_packets.push_back(
std::make_pair(acked_packet_number_, kDefaultTCPMSS));
}
- sender_->OnCongestionEvent(
- false, bytes_in_flight_, acked_packets, lost_packets);
+ sender_->OnCongestionEvent(false, bytes_in_flight_, acked_packets,
+ lost_packets);
bytes_in_flight_ -= n * kDefaultTCPMSS;
}
@@ -125,8 +120,8 @@ class TcpCubicSenderTest : public ::testing::Test {
SendAlgorithmInterface::CongestionVector acked_packets;
SendAlgorithmInterface::CongestionVector lost_packets;
lost_packets.push_back(std::make_pair(packet_number, kDefaultTCPMSS));
- sender_->OnCongestionEvent(
- false, bytes_in_flight_, acked_packets, lost_packets);
+ sender_->OnCongestionEvent(false, bytes_in_flight_, acked_packets,
+ lost_packets);
bytes_in_flight_ -= kDefaultTCPMSS;
}
@@ -142,13 +137,11 @@ TEST_F(TcpCubicSenderTest, SimpleSender) {
// At startup make sure we are at the default.
EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow());
// At startup make sure we can send.
- EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(),
- 0,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
// Make sure we can send.
- EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(),
- 0,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
// And that window is un-affected.
EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow());
@@ -156,20 +149,19 @@ TEST_F(TcpCubicSenderTest, SimpleSender) {
SendAvailableSendWindow();
EXPECT_FALSE(sender_->TimeUntilSend(clock_.Now(),
sender_->GetCongestionWindow(),
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
}
TEST_F(TcpCubicSenderTest, ApplicationLimitedSlowStart) {
// Send exactly 10 packets and ensure the CWND ends at 14 packets.
const int kNumberOfAcks = 5;
// At startup make sure we can send.
- EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(),
- 0,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
// Make sure we can send.
- EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(),
- 0,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
SendAvailableSendWindow();
for (int i = 0; i < kNumberOfAcks; ++i) {
@@ -178,21 +170,18 @@ TEST_F(TcpCubicSenderTest, ApplicationLimitedSlowStart) {
QuicByteCount bytes_to_send = sender_->GetCongestionWindow();
// It's expected 2 acks will arrive when the bytes_in_flight are greater than
// half the CWND.
- EXPECT_EQ(kDefaultWindowTCP + kDefaultTCPMSS * 2 * 2,
- bytes_to_send);
+ EXPECT_EQ(kDefaultWindowTCP + kDefaultTCPMSS * 2 * 2, bytes_to_send);
}
TEST_F(TcpCubicSenderTest, ExponentialSlowStart) {
const int kNumberOfAcks = 20;
// At startup make sure we can send.
- EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(),
- 0,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
EXPECT_EQ(QuicBandwidth::Zero(), sender_->BandwidthEstimate());
// Make sure we can send.
- EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(),
- 0,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 0, HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
for (int i = 0; i < kNumberOfAcks; ++i) {
// Send our full send window.
@@ -215,8 +204,8 @@ TEST_F(TcpCubicSenderTest, SlowStartPacketLoss) {
AckNPackets(2);
}
SendAvailableSendWindow();
- QuicByteCount expected_send_window = kDefaultWindowTCP +
- (kDefaultTCPMSS * 2 * kNumberOfAcks);
+ QuicByteCount expected_send_window =
+ kDefaultWindowTCP + (kDefaultTCPMSS * 2 * kNumberOfAcks);
EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
// Lose a packet to exit slow start.
@@ -275,8 +264,8 @@ TEST_F(TcpCubicSenderTest, SlowStartPacketLossPRR) {
AckNPackets(2);
}
SendAvailableSendWindow();
- QuicByteCount expected_send_window = kDefaultWindowTCP +
- (kDefaultTCPMSS * 2 * kNumberOfAcks);
+ QuicByteCount expected_send_window =
+ kDefaultWindowTCP + (kDefaultTCPMSS * 2 * kNumberOfAcks);
EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
LoseNPackets(1);
@@ -326,8 +315,8 @@ TEST_F(TcpCubicSenderTest, SlowStartBurstPacketLossPRR) {
AckNPackets(2);
}
SendAvailableSendWindow();
- QuicByteCount expected_send_window = kDefaultWindowTCP +
- (kDefaultTCPMSS * 2 * kNumberOfAcks);
+ QuicByteCount expected_send_window =
+ kDefaultWindowTCP + (kDefaultTCPMSS * 2 * kNumberOfAcks);
EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
// Lose one more than the congestion window reduction, so that after loss,
@@ -338,8 +327,9 @@ TEST_F(TcpCubicSenderTest, SlowStartBurstPacketLossPRR) {
LoseNPackets(num_packets_to_lose);
// Immediately after the loss, ensure at least one packet can be sent.
// Losses without subsequent acks can occur with timer based loss detection.
- EXPECT_TRUE(sender_->TimeUntilSend(
- clock_.Now(), bytes_in_flight_, HAS_RETRANSMITTABLE_DATA).IsZero());
+ EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), bytes_in_flight_,
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
AckNPackets(1);
// We should now have fallen out of slow start with a reduced window.
@@ -418,12 +408,11 @@ TEST_F(TcpCubicSenderTest, RetransmissionDelay) {
EXPECT_NEAR(kRttMs, sender_->rtt_stats_.smoothed_rtt().ToMilliseconds(), 1);
EXPECT_NEAR(expected_delay.ToMilliseconds(),
- sender_->RetransmissionDelay().ToMilliseconds(),
- 1);
- EXPECT_EQ(static_cast<int64>(
- sender_->GetCongestionWindow() * kNumMicrosPerSecond /
- sender_->rtt_stats_.smoothed_rtt().ToMicroseconds()),
- sender_->BandwidthEstimate().ToBytesPerSecond());
+ sender_->RetransmissionDelay().ToMilliseconds(), 1);
+ EXPECT_EQ(
+ static_cast<int64>(sender_->GetCongestionWindow() * kNumMicrosPerSecond /
+ sender_->rtt_stats_.smoothed_rtt().ToMicroseconds()),
+ sender_->BandwidthEstimate().ToBytesPerSecond());
}
TEST_F(TcpCubicSenderTest, SlowStartMaxSendWindow) {
@@ -646,8 +635,8 @@ TEST_F(TcpCubicSenderTest, 2ConnectionCongestionAvoidanceAtEndOfRecovery) {
AckNPackets(2);
}
SendAvailableSendWindow();
- QuicByteCount expected_send_window = kDefaultWindowTCP +
- (kDefaultTCPMSS * 2 * kNumberOfAcks);
+ QuicByteCount expected_send_window =
+ kDefaultWindowTCP + (kDefaultTCPMSS * 2 * kNumberOfAcks);
EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
LoseNPackets(1);
@@ -702,8 +691,8 @@ TEST_F(TcpCubicSenderTest, 1ConnectionCongestionAvoidanceAtEndOfRecovery) {
AckNPackets(2);
}
SendAvailableSendWindow();
- QuicByteCount expected_send_window = kDefaultWindowTCP +
- (kDefaultTCPMSS * 2 * kNumberOfAcks);
+ QuicByteCount expected_send_window =
+ kDefaultWindowTCP + (kDefaultTCPMSS * 2 * kNumberOfAcks);
EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
LoseNPackets(1);
@@ -790,13 +779,17 @@ TEST_F(TcpCubicSenderTest, PaceBelowCWND) {
sender_->OnRetransmissionTimeout(true);
EXPECT_EQ(1u, sender_->congestion_window());
EXPECT_TRUE(sender_->TimeUntilSend(QuicTime::Zero(), kDefaultTCPMSS,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
EXPECT_TRUE(sender_->TimeUntilSend(QuicTime::Zero(), 2 * kDefaultTCPMSS,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
EXPECT_TRUE(sender_->TimeUntilSend(QuicTime::Zero(), 3 * kDefaultTCPMSS,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
EXPECT_FALSE(sender_->TimeUntilSend(QuicTime::Zero(), 4 * kDefaultTCPMSS,
- HAS_RETRANSMITTABLE_DATA).IsZero());
+ HAS_RETRANSMITTABLE_DATA)
+ .IsZero());
}
TEST_F(TcpCubicSenderTest, ResetAfterConnectionMigration) {
diff --git a/net/quic/congestion_control/tcp_loss_algorithm.cc b/net/quic/congestion_control/tcp_loss_algorithm.cc
index c7c8c85..f493d96 100644
--- a/net/quic/congestion_control/tcp_loss_algorithm.cc
+++ b/net/quic/congestion_control/tcp_loss_algorithm.cc
@@ -23,7 +23,7 @@ static const double kEarlyRetransmitLossDelayMultiplier = 1.25;
} // namespace
TCPLossAlgorithm::TCPLossAlgorithm()
- : loss_detection_timeout_(QuicTime::Zero()) { }
+ : loss_detection_timeout_(QuicTime::Zero()) {}
LossDetectionType TCPLossAlgorithm::GetLossDetectionType() const {
return kNack;
diff --git a/net/quic/congestion_control/tcp_loss_algorithm_test.cc b/net/quic/congestion_control/tcp_loss_algorithm_test.cc
index c8ace67..4f98de7 100644
--- a/net/quic/congestion_control/tcp_loss_algorithm_test.cc
+++ b/net/quic/congestion_control/tcp_loss_algorithm_test.cc
@@ -26,13 +26,10 @@ class TcpLossAlgorithmTest : public ::testing::Test {
protected:
TcpLossAlgorithmTest() {
rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(100),
- QuicTime::Delta::Zero(),
- clock_.Now());
+ QuicTime::Delta::Zero(), clock_.Now());
}
- ~TcpLossAlgorithmTest() override {
- STLDeleteElements(&packets_);
- }
+ ~TcpLossAlgorithmTest() override { STLDeleteElements(&packets_); }
void SendDataPacket(QuicPacketNumber packet_number) {
packets_.push_back(new QuicEncryptedPacket(nullptr, kDefaultLength));
diff --git a/net/quic/congestion_control/time_loss_algorithm.cc b/net/quic/congestion_control/time_loss_algorithm.cc
index e85f054..fbca9da 100644
--- a/net/quic/congestion_control/time_loss_algorithm.cc
+++ b/net/quic/congestion_control/time_loss_algorithm.cc
@@ -21,7 +21,7 @@ static const double kLossDelayMultiplier = 1.25;
} // namespace
TimeLossAlgorithm::TimeLossAlgorithm()
- : loss_detection_timeout_(QuicTime::Zero()) { }
+ : loss_detection_timeout_(QuicTime::Zero()) {}
LossDetectionType TimeLossAlgorithm::GetLossDetectionType() const {
return kTime;
diff --git a/net/quic/congestion_control/time_loss_algorithm_test.cc b/net/quic/congestion_control/time_loss_algorithm_test.cc
index 2240935..e5ddaee 100644
--- a/net/quic/congestion_control/time_loss_algorithm_test.cc
+++ b/net/quic/congestion_control/time_loss_algorithm_test.cc
@@ -26,13 +26,10 @@ class TimeLossAlgorithmTest : public ::testing::Test {
protected:
TimeLossAlgorithmTest() {
rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(100),
- QuicTime::Delta::Zero(),
- clock_.Now());
+ QuicTime::Delta::Zero(), clock_.Now());
}
- ~TimeLossAlgorithmTest() override {
- STLDeleteElements(&packets_);
- }
+ ~TimeLossAlgorithmTest() override { STLDeleteElements(&packets_); }
void SendDataPacket(QuicPacketNumber packet_number) {
packets_.push_back(new QuicEncryptedPacket(nullptr, kDefaultLength));
diff --git a/net/quic/crypto/aead_base_decrypter_openssl.cc b/net/quic/crypto/aead_base_decrypter_openssl.cc
index 8ebc4ba..b6d3d96 100644
--- a/net/quic/crypto/aead_base_decrypter_openssl.cc
+++ b/net/quic/crypto/aead_base_decrypter_openssl.cc
@@ -17,7 +17,8 @@ namespace {
// Clear OpenSSL error stack.
void ClearOpenSslErrors() {
- while (ERR_get_error()) {}
+ while (ERR_get_error()) {
+ }
}
// In debug builds only, log OpenSSL error stack. Then clear OpenSSL error
@@ -58,8 +59,8 @@ bool AeadBaseDecrypter::SetKey(StringPiece key) {
memcpy(key_, key.data(), key.size());
EVP_AEAD_CTX_cleanup(ctx_.get());
- if (!EVP_AEAD_CTX_init(ctx_.get(), aead_alg_, key_, key_size_,
- auth_tag_size_, nullptr)) {
+ if (!EVP_AEAD_CTX_init(ctx_.get(), aead_alg_, key_, key_size_, auth_tag_size_,
+ nullptr)) {
DLogOpenSslErrors();
return false;
}
diff --git a/net/quic/crypto/aead_base_encrypter_nss.cc b/net/quic/crypto/aead_base_encrypter_nss.cc
index 7b67e41..b586a1d 100644
--- a/net/quic/crypto/aead_base_encrypter_nss.cc
+++ b/net/quic/crypto/aead_base_encrypter_nss.cc
@@ -142,7 +142,9 @@ bool AeadBaseEncrypter::EncryptPacket(QuicPacketNumber packet_number,
return true;
}
-size_t AeadBaseEncrypter::GetKeySize() const { return key_size_; }
+size_t AeadBaseEncrypter::GetKeySize() const {
+ return key_size_;
+}
size_t AeadBaseEncrypter::GetNoncePrefixSize() const {
return nonce_prefix_size_;
diff --git a/net/quic/crypto/aead_base_encrypter_openssl.cc b/net/quic/crypto/aead_base_encrypter_openssl.cc
index 963f8ca..2408cec 100644
--- a/net/quic/crypto/aead_base_encrypter_openssl.cc
+++ b/net/quic/crypto/aead_base_encrypter_openssl.cc
@@ -24,7 +24,8 @@ const size_t kMaxNonceSize = 12;
// stack.
void DLogOpenSslErrors() {
#ifdef NDEBUG
- while (ERR_get_error()) {}
+ while (ERR_get_error()) {
+ }
#else
while (unsigned long error = ERR_get_error()) {
char buf[120];
@@ -60,8 +61,8 @@ bool AeadBaseEncrypter::SetKey(StringPiece key) {
EVP_AEAD_CTX_cleanup(ctx_.get());
- if (!EVP_AEAD_CTX_init(ctx_.get(), aead_alg_, key_, key_size_,
- auth_tag_size_, nullptr)) {
+ if (!EVP_AEAD_CTX_init(ctx_.get(), aead_alg_, key_, key_size_, auth_tag_size_,
+ nullptr)) {
DLogOpenSslErrors();
return false;
}
@@ -126,7 +127,9 @@ bool AeadBaseEncrypter::EncryptPacket(QuicPacketNumber packet_number,
return true;
}
-size_t AeadBaseEncrypter::GetKeySize() const { return key_size_; }
+size_t AeadBaseEncrypter::GetKeySize() const {
+ return key_size_;
+}
size_t AeadBaseEncrypter::GetNoncePrefixSize() const {
return nonce_prefix_size_;
diff --git a/net/quic/crypto/aes_128_gcm_12_decrypter_nss.cc b/net/quic/crypto/aes_128_gcm_12_decrypter_nss.cc
index aa7e17a..ba8a85c 100644
--- a/net/quic/crypto/aes_128_gcm_12_decrypter_nss.cc
+++ b/net/quic/crypto/aes_128_gcm_12_decrypter_nss.cc
@@ -33,8 +33,7 @@ void Aes128Gcm12Decrypter::FillAeadParams(StringPiece nonce,
AeadParams* aead_params) const {
aead_params->len = sizeof(aead_params->data.gcm_params);
CK_GCM_PARAMS* gcm_params = &aead_params->data.gcm_params;
- gcm_params->pIv =
- reinterpret_cast<CK_BYTE*>(const_cast<char*>(nonce.data()));
+ gcm_params->pIv = reinterpret_cast<CK_BYTE*>(const_cast<char*>(nonce.data()));
gcm_params->ulIvLen = nonce.size();
gcm_params->pAAD =
reinterpret_cast<CK_BYTE*>(const_cast<char*>(associated_data.data()));
diff --git a/net/quic/crypto/aes_128_gcm_12_decrypter_openssl.cc b/net/quic/crypto/aes_128_gcm_12_decrypter_openssl.cc
index 1647fa7..1e4056b 100644
--- a/net/quic/crypto/aes_128_gcm_12_decrypter_openssl.cc
+++ b/net/quic/crypto/aes_128_gcm_12_decrypter_openssl.cc
@@ -17,7 +17,9 @@ const size_t kNoncePrefixSize = 4;
} // namespace
Aes128Gcm12Decrypter::Aes128Gcm12Decrypter()
- : AeadBaseDecrypter(EVP_aead_aes_128_gcm(), kKeySize, kAuthTagSize,
+ : AeadBaseDecrypter(EVP_aead_aes_128_gcm(),
+ kKeySize,
+ kAuthTagSize,
kNoncePrefixSize) {
static_assert(kKeySize <= kMaxKeySize, "key size too big");
static_assert(kNoncePrefixSize <= kMaxNoncePrefixSize,
diff --git a/net/quic/crypto/aes_128_gcm_12_decrypter_test.cc b/net/quic/crypto/aes_128_gcm_12_decrypter_test.cc
index 521654d..b0f5f5c 100644
--- a/net/quic/crypto/aes_128_gcm_12_decrypter_test.cc
+++ b/net/quic/crypto/aes_128_gcm_12_decrypter_test.cc
@@ -70,180 +70,122 @@ struct TestVector {
};
const TestGroupInfo test_group_info[] = {
- { 128, 96, 0, 0, 128 },
- { 128, 96, 0, 128, 128 },
- { 128, 96, 128, 0, 128 },
- { 128, 96, 408, 160, 128 },
- { 128, 96, 408, 720, 128 },
- { 128, 96, 104, 0, 128 },
+ {128, 96, 0, 0, 128}, {128, 96, 0, 128, 128}, {128, 96, 128, 0, 128},
+ {128, 96, 408, 160, 128}, {128, 96, 408, 720, 128}, {128, 96, 104, 0, 128},
};
const TestVector test_group_0[] = {
- { "cf063a34d4a9a76c2c86787d3f96db71",
- "113b9785971864c83b01c787",
- "",
- "",
- "72ac8493e3a5228b5d130a69d2510e42",
- ""
- },
- { "a49a5e26a2f8cb63d05546c2a62f5343",
- "907763b19b9b4ab6bd4f0281",
- "",
- "",
- "a2be08210d8c470a8df6e8fbd79ec5cf",
- NULL // FAIL
- },
- { NULL }
-};
+ {"cf063a34d4a9a76c2c86787d3f96db71", "113b9785971864c83b01c787", "", "",
+ "72ac8493e3a5228b5d130a69d2510e42", ""},
+ {
+ "a49a5e26a2f8cb63d05546c2a62f5343", "907763b19b9b4ab6bd4f0281", "", "",
+ "a2be08210d8c470a8df6e8fbd79ec5cf",
+ NULL // FAIL
+ },
+ {NULL}};
const TestVector test_group_1[] = {
- { "d1f6af919cde85661208bdce0c27cb22",
- "898c6929b435017bf031c3c5",
- "",
- "7c5faa40e636bbc91107e68010c92b9f",
- "ae45f11777540a2caeb128be8092468a",
- NULL // FAIL
- },
- { "2370e320d4344208e0ff5683f243b213",
- "04dbb82f044d30831c441228",
- "",
- "d43a8e5089eea0d026c03a85178b27da",
- "2a049c049d25aa95969b451d93c31c6e",
- ""
- },
- { NULL }
-};
+ {
+ "d1f6af919cde85661208bdce0c27cb22", "898c6929b435017bf031c3c5", "",
+ "7c5faa40e636bbc91107e68010c92b9f", "ae45f11777540a2caeb128be8092468a",
+ NULL // FAIL
+ },
+ {"2370e320d4344208e0ff5683f243b213", "04dbb82f044d30831c441228", "",
+ "d43a8e5089eea0d026c03a85178b27da", "2a049c049d25aa95969b451d93c31c6e",
+ ""},
+ {NULL}};
const TestVector test_group_2[] = {
- { "e98b72a9881a84ca6b76e0f43e68647a",
- "8b23299fde174053f3d652ba",
- "5a3c1cf1985dbb8bed818036fdd5ab42",
- "",
- "23c7ab0f952b7091cd324835043b5eb5",
- "28286a321293253c3e0aa2704a278032"
- },
- { "33240636cd3236165f1a553b773e728e",
- "17c4d61493ecdc8f31700b12",
- "47bb7e23f7bdfe05a8091ac90e4f8b2e",
- "",
- "b723c70e931d9785f40fd4ab1d612dc9",
- "95695a5b12f2870b9cc5fdc8f218a97d"
- },
- { "5164df856f1e9cac04a79b808dc5be39",
- "e76925d5355e0584ce871b2b",
- "0216c899c88d6e32c958c7e553daa5bc",
- "",
- "a145319896329c96df291f64efbe0e3a",
- NULL // FAIL
- },
- { NULL }
-};
+ {"e98b72a9881a84ca6b76e0f43e68647a", "8b23299fde174053f3d652ba",
+ "5a3c1cf1985dbb8bed818036fdd5ab42", "", "23c7ab0f952b7091cd324835043b5eb5",
+ "28286a321293253c3e0aa2704a278032"},
+ {"33240636cd3236165f1a553b773e728e", "17c4d61493ecdc8f31700b12",
+ "47bb7e23f7bdfe05a8091ac90e4f8b2e", "", "b723c70e931d9785f40fd4ab1d612dc9",
+ "95695a5b12f2870b9cc5fdc8f218a97d"},
+ {
+ "5164df856f1e9cac04a79b808dc5be39", "e76925d5355e0584ce871b2b",
+ "0216c899c88d6e32c958c7e553daa5bc", "",
+ "a145319896329c96df291f64efbe0e3a",
+ NULL // FAIL
+ },
+ {NULL}};
const TestVector test_group_3[] = {
- { "af57f42c60c0fc5a09adb81ab86ca1c3",
- "a2dc01871f37025dc0fc9a79",
- "b9a535864f48ea7b6b1367914978f9bfa087d854bb0e269bed8d279d2eea1210e48947"
- "338b22f9bad09093276a331e9c79c7f4",
- "41dc38988945fcb44faf2ef72d0061289ef8efd8",
- "4f71e72bde0018f555c5adcce062e005",
- "3803a0727eeb0ade441e0ec107161ded2d425ec0d102f21f51bf2cf9947c7ec4aa7279"
- "5b2f69b041596e8817d0a3c16f8fadeb"
- },
- { "ebc753e5422b377d3cb64b58ffa41b61",
- "2e1821efaced9acf1f241c9b",
- "069567190554e9ab2b50a4e1fbf9c147340a5025fdbd201929834eaf6532325899ccb9"
- "f401823e04b05817243d2142a3589878",
- "b9673412fd4f88ba0e920f46dd6438ff791d8eef",
- "534d9234d2351cf30e565de47baece0b",
- "39077edb35e9c5a4b1e4c2a6b9bb1fce77f00f5023af40333d6d699014c2bcf4209c18"
- "353a18017f5b36bfc00b1f6dcb7ed485"
- },
- { "52bdbbf9cf477f187ec010589cb39d58",
- "d3be36d3393134951d324b31",
- "700188da144fa692cf46e4a8499510a53d90903c967f7f13e8a1bd8151a74adc4fe63e"
- "32b992760b3a5f99e9a47838867000a9",
- "93c4fc6a4135f54d640b0c976bf755a06a292c33",
- "8ca4e38aa3dfa6b1d0297021ccf3ea5f",
- NULL // FAIL
- },
- { NULL }
-};
+ {"af57f42c60c0fc5a09adb81ab86ca1c3", "a2dc01871f37025dc0fc9a79",
+ "b9a535864f48ea7b6b1367914978f9bfa087d854bb0e269bed8d279d2eea1210e48947"
+ "338b22f9bad09093276a331e9c79c7f4",
+ "41dc38988945fcb44faf2ef72d0061289ef8efd8",
+ "4f71e72bde0018f555c5adcce062e005",
+ "3803a0727eeb0ade441e0ec107161ded2d425ec0d102f21f51bf2cf9947c7ec4aa7279"
+ "5b2f69b041596e8817d0a3c16f8fadeb"},
+ {"ebc753e5422b377d3cb64b58ffa41b61", "2e1821efaced9acf1f241c9b",
+ "069567190554e9ab2b50a4e1fbf9c147340a5025fdbd201929834eaf6532325899ccb9"
+ "f401823e04b05817243d2142a3589878",
+ "b9673412fd4f88ba0e920f46dd6438ff791d8eef",
+ "534d9234d2351cf30e565de47baece0b",
+ "39077edb35e9c5a4b1e4c2a6b9bb1fce77f00f5023af40333d6d699014c2bcf4209c18"
+ "353a18017f5b36bfc00b1f6dcb7ed485"},
+ {
+ "52bdbbf9cf477f187ec010589cb39d58", "d3be36d3393134951d324b31",
+ "700188da144fa692cf46e4a8499510a53d90903c967f7f13e8a1bd8151a74adc4fe63e"
+ "32b992760b3a5f99e9a47838867000a9",
+ "93c4fc6a4135f54d640b0c976bf755a06a292c33",
+ "8ca4e38aa3dfa6b1d0297021ccf3ea5f",
+ NULL // FAIL
+ },
+ {NULL}};
const TestVector test_group_4[] = {
- { "da2bb7d581493d692380c77105590201",
- "44aa3e7856ca279d2eb020c6",
- "9290d430c9e89c37f0446dbd620c9a6b34b1274aeb6f911f75867efcf95b6feda69f1a"
- "f4ee16c761b3c9aeac3da03aa9889c88",
- "4cd171b23bddb3a53cdf959d5c1710b481eb3785a90eb20a2345ee00d0bb7868c367ab"
- "12e6f4dd1dee72af4eee1d197777d1d6499cc541f34edbf45cda6ef90b3c024f9272d7"
- "2ec1909fb8fba7db88a4d6f7d3d925980f9f9f72",
- "9e3ac938d3eb0cadd6f5c9e35d22ba38",
- "9bbf4c1a2742f6ac80cb4e8a052e4a8f4f07c43602361355b717381edf9fabd4cb7e3a"
- "d65dbd1378b196ac270588dd0621f642"
- },
- { "d74e4958717a9d5c0e235b76a926cae8",
- "0b7471141e0c70b1995fd7b1",
- "e701c57d2330bf066f9ff8cf3ca4343cafe4894651cd199bdaaa681ba486b4a65c5a22"
- "b0f1420be29ea547d42c713bc6af66aa",
- "4a42b7aae8c245c6f1598a395316e4b8484dbd6e64648d5e302021b1d3fa0a38f46e22"
- "bd9c8080b863dc0016482538a8562a4bd0ba84edbe2697c76fd039527ac179ec5506cf"
- "34a6039312774cedebf4961f3978b14a26509f96",
- "e192c23cb036f0b31592989119eed55d",
- "840d9fb95e32559fb3602e48590280a172ca36d9b49ab69510f5bd552bfab7a306f85f"
- "f0a34bc305b88b804c60b90add594a17"
- },
- { "1986310c725ac94ecfe6422e75fc3ee7",
- "93ec4214fa8e6dc4e3afc775",
- "b178ec72f85a311ac4168f42a4b2c23113fbea4b85f4b9dabb74e143eb1b8b0a361e02"
- "43edfd365b90d5b325950df0ada058f9",
- "e80b88e62c49c958b5e0b8b54f532d9ff6aa84c8a40132e93e55b59fc24e8decf28463"
- "139f155d1e8ce4ee76aaeefcd245baa0fc519f83a5fb9ad9aa40c4b21126013f576c42"
- "72c2cb136c8fd091cc4539877a5d1e72d607f960",
- "8b347853f11d75e81e8a95010be81f17",
- NULL // FAIL
- },
- { NULL }
-};
+ {"da2bb7d581493d692380c77105590201", "44aa3e7856ca279d2eb020c6",
+ "9290d430c9e89c37f0446dbd620c9a6b34b1274aeb6f911f75867efcf95b6feda69f1a"
+ "f4ee16c761b3c9aeac3da03aa9889c88",
+ "4cd171b23bddb3a53cdf959d5c1710b481eb3785a90eb20a2345ee00d0bb7868c367ab"
+ "12e6f4dd1dee72af4eee1d197777d1d6499cc541f34edbf45cda6ef90b3c024f9272d7"
+ "2ec1909fb8fba7db88a4d6f7d3d925980f9f9f72",
+ "9e3ac938d3eb0cadd6f5c9e35d22ba38",
+ "9bbf4c1a2742f6ac80cb4e8a052e4a8f4f07c43602361355b717381edf9fabd4cb7e3a"
+ "d65dbd1378b196ac270588dd0621f642"},
+ {"d74e4958717a9d5c0e235b76a926cae8", "0b7471141e0c70b1995fd7b1",
+ "e701c57d2330bf066f9ff8cf3ca4343cafe4894651cd199bdaaa681ba486b4a65c5a22"
+ "b0f1420be29ea547d42c713bc6af66aa",
+ "4a42b7aae8c245c6f1598a395316e4b8484dbd6e64648d5e302021b1d3fa0a38f46e22"
+ "bd9c8080b863dc0016482538a8562a4bd0ba84edbe2697c76fd039527ac179ec5506cf"
+ "34a6039312774cedebf4961f3978b14a26509f96",
+ "e192c23cb036f0b31592989119eed55d",
+ "840d9fb95e32559fb3602e48590280a172ca36d9b49ab69510f5bd552bfab7a306f85f"
+ "f0a34bc305b88b804c60b90add594a17"},
+ {
+ "1986310c725ac94ecfe6422e75fc3ee7", "93ec4214fa8e6dc4e3afc775",
+ "b178ec72f85a311ac4168f42a4b2c23113fbea4b85f4b9dabb74e143eb1b8b0a361e02"
+ "43edfd365b90d5b325950df0ada058f9",
+ "e80b88e62c49c958b5e0b8b54f532d9ff6aa84c8a40132e93e55b59fc24e8decf28463"
+ "139f155d1e8ce4ee76aaeefcd245baa0fc519f83a5fb9ad9aa40c4b21126013f576c42"
+ "72c2cb136c8fd091cc4539877a5d1e72d607f960",
+ "8b347853f11d75e81e8a95010be81f17",
+ NULL // FAIL
+ },
+ {NULL}};
const TestVector test_group_5[] = {
- { "387218b246c1a8257748b56980e50c94",
- "dd7e014198672be39f95b69d",
- "cdba9e73eaf3d38eceb2b04a8d",
- "",
- "ecf90f4a47c9c626d6fb2c765d201556",
- "48f5b426baca03064554cc2b30"
- },
- { "294de463721e359863887c820524b3d4",
- "3338b35c9d57a5d28190e8c9",
- "2f46634e74b8e4c89812ac83b9",
- "",
- "dabd506764e68b82a7e720aa18da0abe",
- "46a2e55c8e264df211bd112685"
- },
- { "28ead7fd2179e0d12aa6d5d88c58c2dc",
- "5055347f18b4d5add0ae5c41",
- "142d8210c3fb84774cdbd0447a",
- "",
- "5fd321d9cdb01952dc85f034736c2a7d",
- "3b95b981086ee73cc4d0cc1422"
- },
- { "7d7b6c988137b8d470c57bf674a09c87",
- "9edf2aa970d016ac962e1fd8",
- "a85b66c3cb5eab91d5bdc8bc0e",
- "",
- "dc054efc01f3afd21d9c2484819f569a",
- NULL // FAIL
- },
- { NULL }
-};
+ {"387218b246c1a8257748b56980e50c94", "dd7e014198672be39f95b69d",
+ "cdba9e73eaf3d38eceb2b04a8d", "", "ecf90f4a47c9c626d6fb2c765d201556",
+ "48f5b426baca03064554cc2b30"},
+ {"294de463721e359863887c820524b3d4", "3338b35c9d57a5d28190e8c9",
+ "2f46634e74b8e4c89812ac83b9", "", "dabd506764e68b82a7e720aa18da0abe",
+ "46a2e55c8e264df211bd112685"},
+ {"28ead7fd2179e0d12aa6d5d88c58c2dc", "5055347f18b4d5add0ae5c41",
+ "142d8210c3fb84774cdbd0447a", "", "5fd321d9cdb01952dc85f034736c2a7d",
+ "3b95b981086ee73cc4d0cc1422"},
+ {
+ "7d7b6c988137b8d470c57bf674a09c87", "9edf2aa970d016ac962e1fd8",
+ "a85b66c3cb5eab91d5bdc8bc0e", "", "dc054efc01f3afd21d9c2484819f569a",
+ NULL // FAIL
+ },
+ {NULL}};
const TestVector* const test_group_array[] = {
- test_group_0,
- test_group_1,
- test_group_2,
- test_group_3,
- test_group_4,
- test_group_5,
+ test_group_0, test_group_1, test_group_2,
+ test_group_3, test_group_4, test_group_5,
};
} // namespace
diff --git a/net/quic/crypto/aes_128_gcm_12_encrypter_nss.cc b/net/quic/crypto/aes_128_gcm_12_encrypter_nss.cc
index 847f29d..78c1d3d 100644
--- a/net/quic/crypto/aes_128_gcm_12_encrypter_nss.cc
+++ b/net/quic/crypto/aes_128_gcm_12_encrypter_nss.cc
@@ -33,8 +33,7 @@ void Aes128Gcm12Encrypter::FillAeadParams(StringPiece nonce,
AeadParams* aead_params) const {
aead_params->len = sizeof(aead_params->data.gcm_params);
CK_GCM_PARAMS* gcm_params = &aead_params->data.gcm_params;
- gcm_params->pIv =
- reinterpret_cast<CK_BYTE*>(const_cast<char*>(nonce.data()));
+ gcm_params->pIv = reinterpret_cast<CK_BYTE*>(const_cast<char*>(nonce.data()));
gcm_params->ulIvLen = nonce.size();
gcm_params->pAAD =
reinterpret_cast<CK_BYTE*>(const_cast<char*>(associated_data.data()));
diff --git a/net/quic/crypto/aes_128_gcm_12_encrypter_openssl.cc b/net/quic/crypto/aes_128_gcm_12_encrypter_openssl.cc
index b87d0fc..2d7ea8f 100644
--- a/net/quic/crypto/aes_128_gcm_12_encrypter_openssl.cc
+++ b/net/quic/crypto/aes_128_gcm_12_encrypter_openssl.cc
@@ -16,7 +16,9 @@ const size_t kNoncePrefixSize = 4;
} // namespace
Aes128Gcm12Encrypter::Aes128Gcm12Encrypter()
- : AeadBaseEncrypter(EVP_aead_aes_128_gcm(), kKeySize, kAuthTagSize,
+ : AeadBaseEncrypter(EVP_aead_aes_128_gcm(),
+ kKeySize,
+ kAuthTagSize,
kNoncePrefixSize) {
static_assert(kKeySize <= kMaxKeySize, "key size too big");
static_assert(kNoncePrefixSize <= kMaxNoncePrefixSize,
diff --git a/net/quic/crypto/aes_128_gcm_12_encrypter_test.cc b/net/quic/crypto/aes_128_gcm_12_encrypter_test.cc
index b7345b5..b2aac6a 100644
--- a/net/quic/crypto/aes_128_gcm_12_encrypter_test.cc
+++ b/net/quic/crypto/aes_128_gcm_12_encrypter_test.cc
@@ -65,141 +65,85 @@ struct TestVector {
};
const TestGroupInfo test_group_info[] = {
- { 128, 96, 0, 0, 128 },
- { 128, 96, 0, 128, 128 },
- { 128, 96, 128, 0, 128 },
- { 128, 96, 408, 160, 128 },
- { 128, 96, 408, 720, 128 },
- { 128, 96, 104, 0, 128 },
+ {128, 96, 0, 0, 128}, {128, 96, 0, 128, 128}, {128, 96, 128, 0, 128},
+ {128, 96, 408, 160, 128}, {128, 96, 408, 720, 128}, {128, 96, 104, 0, 128},
};
const TestVector test_group_0[] = {
- { "11754cd72aec309bf52f7687212e8957",
- "3c819d9a9bed087615030b65",
- "",
- "",
- "",
- "250327c674aaf477aef2675748cf6971"
- },
- { "ca47248ac0b6f8372a97ac43508308ed",
- "ffd2b598feabc9019262d2be",
- "",
- "",
- "",
- "60d20404af527d248d893ae495707d1a"
- },
- { NULL }
-};
+ {"11754cd72aec309bf52f7687212e8957", "3c819d9a9bed087615030b65", "", "", "",
+ "250327c674aaf477aef2675748cf6971"},
+ {"ca47248ac0b6f8372a97ac43508308ed", "ffd2b598feabc9019262d2be", "", "", "",
+ "60d20404af527d248d893ae495707d1a"},
+ {NULL}};
const TestVector test_group_1[] = {
- { "77be63708971c4e240d1cb79e8d77feb",
- "e0e00f19fed7ba0136a797f3",
- "",
- "7a43ec1d9c0a5a78a0b16533a6213cab",
- "",
- "209fcc8d3675ed938e9c7166709dd946"
- },
- { "7680c5d3ca6154758e510f4d25b98820",
- "f8f105f9c3df4965780321f8",
- "",
- "c94c410194c765e3dcc7964379758ed3",
- "",
- "94dca8edfcf90bb74b153c8d48a17930"
- },
- { NULL }
-};
+ {"77be63708971c4e240d1cb79e8d77feb", "e0e00f19fed7ba0136a797f3", "",
+ "7a43ec1d9c0a5a78a0b16533a6213cab", "",
+ "209fcc8d3675ed938e9c7166709dd946"},
+ {"7680c5d3ca6154758e510f4d25b98820", "f8f105f9c3df4965780321f8", "",
+ "c94c410194c765e3dcc7964379758ed3", "",
+ "94dca8edfcf90bb74b153c8d48a17930"},
+ {NULL}};
const TestVector test_group_2[] = {
- { "7fddb57453c241d03efbed3ac44e371c",
- "ee283a3fc75575e33efd4887",
- "d5de42b461646c255c87bd2962d3b9a2",
- "",
- "2ccda4a5415cb91e135c2a0f78c9b2fd",
- "b36d1df9b9d5e596f83e8b7f52971cb3"
- },
- { "ab72c77b97cb5fe9a382d9fe81ffdbed",
- "54cc7dc2c37ec006bcc6d1da",
- "007c5e5b3e59df24a7c355584fc1518d",
- "",
- "0e1bde206a07a9c2c1b65300f8c64997",
- "2b4401346697138c7a4891ee59867d0c"
- },
- { NULL }
-};
+ {"7fddb57453c241d03efbed3ac44e371c", "ee283a3fc75575e33efd4887",
+ "d5de42b461646c255c87bd2962d3b9a2", "", "2ccda4a5415cb91e135c2a0f78c9b2fd",
+ "b36d1df9b9d5e596f83e8b7f52971cb3"},
+ {"ab72c77b97cb5fe9a382d9fe81ffdbed", "54cc7dc2c37ec006bcc6d1da",
+ "007c5e5b3e59df24a7c355584fc1518d", "", "0e1bde206a07a9c2c1b65300f8c64997",
+ "2b4401346697138c7a4891ee59867d0c"},
+ {NULL}};
const TestVector test_group_3[] = {
- { "fe47fcce5fc32665d2ae399e4eec72ba",
- "5adb9609dbaeb58cbd6e7275",
- "7c0e88c88899a779228465074797cd4c2e1498d259b54390b85e3eef1c02df60e743f1"
- "b840382c4bccaf3bafb4ca8429bea063",
- "88319d6e1d3ffa5f987199166c8a9b56c2aeba5a",
- "98f4826f05a265e6dd2be82db241c0fbbbf9ffb1c173aa83964b7cf539304373636525"
- "3ddbc5db8778371495da76d269e5db3e",
- "291ef1982e4defedaa2249f898556b47"
- },
- { "ec0c2ba17aa95cd6afffe949da9cc3a8",
- "296bce5b50b7d66096d627ef",
- "b85b3753535b825cbe5f632c0b843c741351f18aa484281aebec2f45bb9eea2d79d987"
- "b764b9611f6c0f8641843d5d58f3a242",
- "f8d00f05d22bf68599bcdeb131292ad6e2df5d14",
- "a7443d31c26bdf2a1c945e29ee4bd344a99cfaf3aa71f8b3f191f83c2adfc7a0716299"
- "5506fde6309ffc19e716eddf1a828c5a",
- "890147971946b627c40016da1ecf3e77"
- },
- { NULL }
-};
+ {"fe47fcce5fc32665d2ae399e4eec72ba", "5adb9609dbaeb58cbd6e7275",
+ "7c0e88c88899a779228465074797cd4c2e1498d259b54390b85e3eef1c02df60e743f1"
+ "b840382c4bccaf3bafb4ca8429bea063",
+ "88319d6e1d3ffa5f987199166c8a9b56c2aeba5a",
+ "98f4826f05a265e6dd2be82db241c0fbbbf9ffb1c173aa83964b7cf539304373636525"
+ "3ddbc5db8778371495da76d269e5db3e",
+ "291ef1982e4defedaa2249f898556b47"},
+ {"ec0c2ba17aa95cd6afffe949da9cc3a8", "296bce5b50b7d66096d627ef",
+ "b85b3753535b825cbe5f632c0b843c741351f18aa484281aebec2f45bb9eea2d79d987"
+ "b764b9611f6c0f8641843d5d58f3a242",
+ "f8d00f05d22bf68599bcdeb131292ad6e2df5d14",
+ "a7443d31c26bdf2a1c945e29ee4bd344a99cfaf3aa71f8b3f191f83c2adfc7a0716299"
+ "5506fde6309ffc19e716eddf1a828c5a",
+ "890147971946b627c40016da1ecf3e77"},
+ {NULL}};
const TestVector test_group_4[] = {
- { "2c1f21cf0f6fb3661943155c3e3d8492",
- "23cb5ff362e22426984d1907",
- "42f758836986954db44bf37c6ef5e4ac0adaf38f27252a1b82d02ea949c8a1a2dbc0d6"
- "8b5615ba7c1220ff6510e259f06655d8",
- "5d3624879d35e46849953e45a32a624d6a6c536ed9857c613b572b0333e701557a713e"
- "3f010ecdf9a6bd6c9e3e44b065208645aff4aabee611b391528514170084ccf587177f"
- "4488f33cfb5e979e42b6e1cfc0a60238982a7aec",
- "81824f0e0d523db30d3da369fdc0d60894c7a0a20646dd015073ad2732bd989b14a222"
- "b6ad57af43e1895df9dca2a5344a62cc",
- "57a3ee28136e94c74838997ae9823f3a"
- },
- { "d9f7d2411091f947b4d6f1e2d1f0fb2e",
- "e1934f5db57cc983e6b180e7",
- "73ed042327f70fe9c572a61545eda8b2a0c6e1d6c291ef19248e973aee6c312012f490"
- "c2c6f6166f4a59431e182663fcaea05a",
- "0a8a18a7150e940c3d87b38e73baee9a5c049ee21795663e264b694a949822b639092d"
- "0e67015e86363583fcf0ca645af9f43375f05fdb4ce84f411dcbca73c2220dea03a201"
- "15d2e51398344b16bee1ed7c499b353d6c597af8",
- "aaadbd5c92e9151ce3db7210b8714126b73e43436d242677afa50384f2149b831f1d57"
- "3c7891c2a91fbc48db29967ec9542b23",
- "21b51ca862cb637cdd03b99a0f93b134"
- },
- { NULL }
-};
+ {"2c1f21cf0f6fb3661943155c3e3d8492", "23cb5ff362e22426984d1907",
+ "42f758836986954db44bf37c6ef5e4ac0adaf38f27252a1b82d02ea949c8a1a2dbc0d6"
+ "8b5615ba7c1220ff6510e259f06655d8",
+ "5d3624879d35e46849953e45a32a624d6a6c536ed9857c613b572b0333e701557a713e"
+ "3f010ecdf9a6bd6c9e3e44b065208645aff4aabee611b391528514170084ccf587177f"
+ "4488f33cfb5e979e42b6e1cfc0a60238982a7aec",
+ "81824f0e0d523db30d3da369fdc0d60894c7a0a20646dd015073ad2732bd989b14a222"
+ "b6ad57af43e1895df9dca2a5344a62cc",
+ "57a3ee28136e94c74838997ae9823f3a"},
+ {"d9f7d2411091f947b4d6f1e2d1f0fb2e", "e1934f5db57cc983e6b180e7",
+ "73ed042327f70fe9c572a61545eda8b2a0c6e1d6c291ef19248e973aee6c312012f490"
+ "c2c6f6166f4a59431e182663fcaea05a",
+ "0a8a18a7150e940c3d87b38e73baee9a5c049ee21795663e264b694a949822b639092d"
+ "0e67015e86363583fcf0ca645af9f43375f05fdb4ce84f411dcbca73c2220dea03a201"
+ "15d2e51398344b16bee1ed7c499b353d6c597af8",
+ "aaadbd5c92e9151ce3db7210b8714126b73e43436d242677afa50384f2149b831f1d57"
+ "3c7891c2a91fbc48db29967ec9542b23",
+ "21b51ca862cb637cdd03b99a0f93b134"},
+ {NULL}};
const TestVector test_group_5[] = {
- { "fe9bb47deb3a61e423c2231841cfd1fb",
- "4d328eb776f500a2f7fb47aa",
- "f1cc3818e421876bb6b8bbd6c9",
- "",
- "b88c5c1977b35b517b0aeae967",
- "43fd4727fe5cdb4b5b42818dea7ef8c9"
- },
- { "6703df3701a7f54911ca72e24dca046a",
- "12823ab601c350ea4bc2488c",
- "793cd125b0b84a043e3ac67717",
- "",
- "b2051c80014f42f08735a7b0cd",
- "38e6bcd29962e5f2c13626b85a877101"
- },
- { NULL }
-};
+ {"fe9bb47deb3a61e423c2231841cfd1fb", "4d328eb776f500a2f7fb47aa",
+ "f1cc3818e421876bb6b8bbd6c9", "", "b88c5c1977b35b517b0aeae967",
+ "43fd4727fe5cdb4b5b42818dea7ef8c9"},
+ {"6703df3701a7f54911ca72e24dca046a", "12823ab601c350ea4bc2488c",
+ "793cd125b0b84a043e3ac67717", "", "b2051c80014f42f08735a7b0cd",
+ "38e6bcd29962e5f2c13626b85a877101"},
+ {NULL}};
const TestVector* const test_group_array[] = {
- test_group_0,
- test_group_1,
- test_group_2,
- test_group_3,
- test_group_4,
- test_group_5,
+ test_group_0, test_group_1, test_group_2,
+ test_group_3, test_group_4, test_group_5,
};
} // namespace
diff --git a/net/quic/crypto/cert_compressor.cc b/net/quic/crypto/cert_compressor.cc
index cb44d35..362a58b 100644
--- a/net/quic/crypto/cert_compressor.cc
+++ b/net/quic/crypto/cert_compressor.cc
@@ -21,130 +21,130 @@ namespace {
// in order to help zlib. This was generated via a fairly dumb algorithm from
// the Alexa Top 5000 set - we could probably do better.
static const unsigned char kCommonCertSubstrings[] = {
- 0x04, 0x02, 0x30, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x04,
- 0x16, 0x30, 0x14, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03,
- 0x01, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x02, 0x30,
- 0x5f, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x04, 0x01,
- 0x06, 0x06, 0x0b, 0x60, 0x86, 0x48, 0x01, 0x86, 0xfd, 0x6d, 0x01, 0x07,
- 0x17, 0x01, 0x30, 0x33, 0x20, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65,
- 0x64, 0x20, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e,
- 0x20, 0x53, 0x20, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x31, 0x34,
- 0x20, 0x53, 0x53, 0x4c, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31,
- 0x32, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x20, 0x53, 0x65, 0x72,
- 0x76, 0x65, 0x72, 0x20, 0x43, 0x41, 0x30, 0x2d, 0x61, 0x69, 0x61, 0x2e,
- 0x76, 0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d,
- 0x2f, 0x45, 0x2d, 0x63, 0x72, 0x6c, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x73,
- 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x45, 0x2e, 0x63, 0x65,
- 0x72, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01,
- 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x4a, 0x2e, 0x63,
- 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73,
- 0x2f, 0x63, 0x70, 0x73, 0x20, 0x28, 0x63, 0x29, 0x30, 0x30, 0x09, 0x06,
- 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1d, 0x30, 0x0d,
- 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05,
- 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x7b, 0x30, 0x1d, 0x06, 0x03, 0x55,
- 0x1d, 0x0e, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
- 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01,
- 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xd2,
- 0x6f, 0x64, 0x6f, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x43, 0x2e,
- 0x63, 0x72, 0x6c, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16,
- 0x04, 0x14, 0xb4, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x73, 0x69,
- 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x30, 0x0b, 0x06, 0x03,
- 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x01, 0x30, 0x0d, 0x06, 0x09,
- 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30,
- 0x81, 0xca, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
- 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x08,
- 0x13, 0x07, 0x41, 0x72, 0x69, 0x7a, 0x6f, 0x6e, 0x61, 0x31, 0x13, 0x30,
- 0x11, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x0a, 0x53, 0x63, 0x6f, 0x74,
- 0x74, 0x73, 0x64, 0x61, 0x6c, 0x65, 0x31, 0x1a, 0x30, 0x18, 0x06, 0x03,
- 0x55, 0x04, 0x0a, 0x13, 0x11, 0x47, 0x6f, 0x44, 0x61, 0x64, 0x64, 0x79,
- 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x31, 0x33,
- 0x30, 0x31, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x2a, 0x68, 0x74, 0x74,
- 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63,
- 0x61, 0x74, 0x65, 0x73, 0x2e, 0x67, 0x6f, 0x64, 0x61, 0x64, 0x64, 0x79,
- 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74,
- 0x6f, 0x72, 0x79, 0x31, 0x30, 0x30, 0x2e, 0x06, 0x03, 0x55, 0x04, 0x03,
- 0x13, 0x27, 0x47, 0x6f, 0x20, 0x44, 0x61, 0x64, 0x64, 0x79, 0x20, 0x53,
- 0x65, 0x63, 0x75, 0x72, 0x65, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66,
- 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68,
- 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55,
- 0x04, 0x05, 0x13, 0x08, 0x30, 0x37, 0x39, 0x36, 0x39, 0x32, 0x38, 0x37,
- 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x31, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d,
- 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x05, 0xa0, 0x30, 0x0c,
- 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00,
- 0x30, 0x1d, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff,
- 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55,
- 0x1d, 0x25, 0x04, 0x16, 0x30, 0x14, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05,
- 0x05, 0x07, 0x03, 0x01, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07,
- 0x03, 0x02, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff,
- 0x04, 0x04, 0x03, 0x02, 0x05, 0xa0, 0x30, 0x33, 0x06, 0x03, 0x55, 0x1d,
- 0x1f, 0x04, 0x2c, 0x30, 0x2a, 0x30, 0x28, 0xa0, 0x26, 0xa0, 0x24, 0x86,
- 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x6c, 0x2e,
- 0x67, 0x6f, 0x64, 0x61, 0x64, 0x64, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
- 0x67, 0x64, 0x73, 0x31, 0x2d, 0x32, 0x30, 0x2a, 0x30, 0x28, 0x06, 0x08,
- 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x02, 0x01, 0x16, 0x1c, 0x68, 0x74,
- 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x76, 0x65,
- 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63,
- 0x70, 0x73, 0x30, 0x34, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x17,
- 0x0d, 0x31, 0x33, 0x30, 0x35, 0x30, 0x39, 0x06, 0x08, 0x2b, 0x06, 0x01,
- 0x05, 0x05, 0x07, 0x30, 0x02, 0x86, 0x2d, 0x68, 0x74, 0x74, 0x70, 0x3a,
- 0x2f, 0x2f, 0x73, 0x30, 0x39, 0x30, 0x37, 0x06, 0x08, 0x2b, 0x06, 0x01,
- 0x05, 0x05, 0x07, 0x02, 0x30, 0x44, 0x06, 0x03, 0x55, 0x1d, 0x20, 0x04,
- 0x3d, 0x30, 0x3b, 0x30, 0x39, 0x06, 0x0b, 0x60, 0x86, 0x48, 0x01, 0x86,
- 0xf8, 0x45, 0x01, 0x07, 0x17, 0x06, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,
- 0x55, 0x04, 0x06, 0x13, 0x02, 0x47, 0x42, 0x31, 0x1b, 0x53, 0x31, 0x17,
- 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0e, 0x56, 0x65, 0x72,
- 0x69, 0x53, 0x69, 0x67, 0x6e, 0x2c, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x31,
- 0x1f, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x16, 0x56, 0x65,
- 0x72, 0x69, 0x53, 0x69, 0x67, 0x6e, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74,
- 0x20, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x31, 0x3b, 0x30, 0x39,
- 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x32, 0x54, 0x65, 0x72, 0x6d, 0x73,
- 0x20, 0x6f, 0x66, 0x20, 0x75, 0x73, 0x65, 0x20, 0x61, 0x74, 0x20, 0x68,
- 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x76,
- 0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
- 0x72, 0x70, 0x61, 0x20, 0x28, 0x63, 0x29, 0x30, 0x31, 0x10, 0x30, 0x0e,
- 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x53, 0x31, 0x13, 0x30, 0x11,
- 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x0a, 0x47, 0x31, 0x13, 0x30, 0x11,
- 0x06, 0x0b, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x3c, 0x02, 0x01,
- 0x03, 0x13, 0x02, 0x55, 0x31, 0x16, 0x30, 0x14, 0x06, 0x03, 0x55, 0x04,
- 0x03, 0x14, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
- 0x31, 0x1d, 0x30, 0x1b, 0x06, 0x03, 0x55, 0x04, 0x0f, 0x13, 0x14, 0x50,
- 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x20, 0x4f, 0x72, 0x67, 0x61, 0x6e,
- 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x12, 0x31, 0x21, 0x30,
- 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x18, 0x44, 0x6f, 0x6d, 0x61,
- 0x69, 0x6e, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x20, 0x56,
- 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x64, 0x31, 0x14, 0x31, 0x31,
- 0x30, 0x2f, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x28, 0x53, 0x65, 0x65,
- 0x20, 0x77, 0x77, 0x77, 0x2e, 0x72, 0x3a, 0x2f, 0x2f, 0x73, 0x65, 0x63,
- 0x75, 0x72, 0x65, 0x2e, 0x67, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53,
- 0x69, 0x67, 0x6e, 0x31, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x41,
- 0x2e, 0x63, 0x72, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6e,
- 0x20, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x20, 0x33, 0x20, 0x45, 0x63, 0x72,
- 0x6c, 0x2e, 0x67, 0x65, 0x6f, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x63,
- 0x6f, 0x6d, 0x2f, 0x63, 0x72, 0x6c, 0x73, 0x2f, 0x73, 0x64, 0x31, 0x1a,
- 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x3a,
- 0x2f, 0x2f, 0x45, 0x56, 0x49, 0x6e, 0x74, 0x6c, 0x2d, 0x63, 0x63, 0x72,
- 0x74, 0x2e, 0x67, 0x77, 0x77, 0x77, 0x2e, 0x67, 0x69, 0x63, 0x65, 0x72,
- 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x31, 0x6f, 0x63, 0x73, 0x70, 0x2e,
- 0x76, 0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d,
- 0x30, 0x39, 0x72, 0x61, 0x70, 0x69, 0x64, 0x73, 0x73, 0x6c, 0x2e, 0x63,
- 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x64, 0x61, 0x64, 0x64, 0x79, 0x2e, 0x63,
- 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72,
- 0x79, 0x2f, 0x30, 0x81, 0x80, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05,
- 0x07, 0x01, 0x01, 0x04, 0x74, 0x30, 0x72, 0x30, 0x24, 0x06, 0x08, 0x2b,
- 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x86, 0x18, 0x68, 0x74, 0x74,
- 0x70, 0x3a, 0x2f, 0x2f, 0x6f, 0x63, 0x73, 0x70, 0x2e, 0x67, 0x6f, 0x64,
- 0x61, 0x64, 0x64, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x30, 0x4a, 0x06,
- 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x02, 0x86, 0x3e, 0x68,
- 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66,
- 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x2e, 0x67, 0x6f, 0x64, 0x61, 0x64,
- 0x64, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73,
- 0x69, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x67, 0x64, 0x5f, 0x69, 0x6e, 0x74,
- 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x2e, 0x63, 0x72,
- 0x74, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16,
- 0x80, 0x14, 0xfd, 0xac, 0x61, 0x32, 0x93, 0x6c, 0x45, 0xd6, 0xe2, 0xee,
- 0x85, 0x5f, 0x9a, 0xba, 0xe7, 0x76, 0x99, 0x68, 0xcc, 0xe7, 0x30, 0x27,
- 0x86, 0x29, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x86, 0x30,
- 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x73,
+ 0x04, 0x02, 0x30, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x04,
+ 0x16, 0x30, 0x14, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03,
+ 0x01, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x02, 0x30,
+ 0x5f, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x04, 0x01,
+ 0x06, 0x06, 0x0b, 0x60, 0x86, 0x48, 0x01, 0x86, 0xfd, 0x6d, 0x01, 0x07,
+ 0x17, 0x01, 0x30, 0x33, 0x20, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65,
+ 0x64, 0x20, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e,
+ 0x20, 0x53, 0x20, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x31, 0x34,
+ 0x20, 0x53, 0x53, 0x4c, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31,
+ 0x32, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x20, 0x53, 0x65, 0x72,
+ 0x76, 0x65, 0x72, 0x20, 0x43, 0x41, 0x30, 0x2d, 0x61, 0x69, 0x61, 0x2e,
+ 0x76, 0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d,
+ 0x2f, 0x45, 0x2d, 0x63, 0x72, 0x6c, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x73,
+ 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x45, 0x2e, 0x63, 0x65,
+ 0x72, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01,
+ 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x4a, 0x2e, 0x63,
+ 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73,
+ 0x2f, 0x63, 0x70, 0x73, 0x20, 0x28, 0x63, 0x29, 0x30, 0x30, 0x09, 0x06,
+ 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1d, 0x30, 0x0d,
+ 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05,
+ 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x7b, 0x30, 0x1d, 0x06, 0x03, 0x55,
+ 0x1d, 0x0e, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
+ 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01,
+ 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xd2,
+ 0x6f, 0x64, 0x6f, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x43, 0x2e,
+ 0x63, 0x72, 0x6c, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16,
+ 0x04, 0x14, 0xb4, 0x2e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x73, 0x69,
+ 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x30, 0x0b, 0x06, 0x03,
+ 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x01, 0x30, 0x0d, 0x06, 0x09,
+ 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30,
+ 0x81, 0xca, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
+ 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x08,
+ 0x13, 0x07, 0x41, 0x72, 0x69, 0x7a, 0x6f, 0x6e, 0x61, 0x31, 0x13, 0x30,
+ 0x11, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x0a, 0x53, 0x63, 0x6f, 0x74,
+ 0x74, 0x73, 0x64, 0x61, 0x6c, 0x65, 0x31, 0x1a, 0x30, 0x18, 0x06, 0x03,
+ 0x55, 0x04, 0x0a, 0x13, 0x11, 0x47, 0x6f, 0x44, 0x61, 0x64, 0x64, 0x79,
+ 0x2e, 0x63, 0x6f, 0x6d, 0x2c, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x31, 0x33,
+ 0x30, 0x31, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x2a, 0x68, 0x74, 0x74,
+ 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63,
+ 0x61, 0x74, 0x65, 0x73, 0x2e, 0x67, 0x6f, 0x64, 0x61, 0x64, 0x64, 0x79,
+ 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74,
+ 0x6f, 0x72, 0x79, 0x31, 0x30, 0x30, 0x2e, 0x06, 0x03, 0x55, 0x04, 0x03,
+ 0x13, 0x27, 0x47, 0x6f, 0x20, 0x44, 0x61, 0x64, 0x64, 0x79, 0x20, 0x53,
+ 0x65, 0x63, 0x75, 0x72, 0x65, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66,
+ 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68,
+ 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55,
+ 0x04, 0x05, 0x13, 0x08, 0x30, 0x37, 0x39, 0x36, 0x39, 0x32, 0x38, 0x37,
+ 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x31, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d,
+ 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x05, 0xa0, 0x30, 0x0c,
+ 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00,
+ 0x30, 0x1d, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff,
+ 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55,
+ 0x1d, 0x25, 0x04, 0x16, 0x30, 0x14, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05,
+ 0x05, 0x07, 0x03, 0x01, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07,
+ 0x03, 0x02, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff,
+ 0x04, 0x04, 0x03, 0x02, 0x05, 0xa0, 0x30, 0x33, 0x06, 0x03, 0x55, 0x1d,
+ 0x1f, 0x04, 0x2c, 0x30, 0x2a, 0x30, 0x28, 0xa0, 0x26, 0xa0, 0x24, 0x86,
+ 0x22, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x6c, 0x2e,
+ 0x67, 0x6f, 0x64, 0x61, 0x64, 0x64, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
+ 0x67, 0x64, 0x73, 0x31, 0x2d, 0x32, 0x30, 0x2a, 0x30, 0x28, 0x06, 0x08,
+ 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x02, 0x01, 0x16, 0x1c, 0x68, 0x74,
+ 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x76, 0x65,
+ 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63,
+ 0x70, 0x73, 0x30, 0x34, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x17,
+ 0x0d, 0x31, 0x33, 0x30, 0x35, 0x30, 0x39, 0x06, 0x08, 0x2b, 0x06, 0x01,
+ 0x05, 0x05, 0x07, 0x30, 0x02, 0x86, 0x2d, 0x68, 0x74, 0x74, 0x70, 0x3a,
+ 0x2f, 0x2f, 0x73, 0x30, 0x39, 0x30, 0x37, 0x06, 0x08, 0x2b, 0x06, 0x01,
+ 0x05, 0x05, 0x07, 0x02, 0x30, 0x44, 0x06, 0x03, 0x55, 0x1d, 0x20, 0x04,
+ 0x3d, 0x30, 0x3b, 0x30, 0x39, 0x06, 0x0b, 0x60, 0x86, 0x48, 0x01, 0x86,
+ 0xf8, 0x45, 0x01, 0x07, 0x17, 0x06, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,
+ 0x55, 0x04, 0x06, 0x13, 0x02, 0x47, 0x42, 0x31, 0x1b, 0x53, 0x31, 0x17,
+ 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0e, 0x56, 0x65, 0x72,
+ 0x69, 0x53, 0x69, 0x67, 0x6e, 0x2c, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x31,
+ 0x1f, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x16, 0x56, 0x65,
+ 0x72, 0x69, 0x53, 0x69, 0x67, 0x6e, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74,
+ 0x20, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x31, 0x3b, 0x30, 0x39,
+ 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x32, 0x54, 0x65, 0x72, 0x6d, 0x73,
+ 0x20, 0x6f, 0x66, 0x20, 0x75, 0x73, 0x65, 0x20, 0x61, 0x74, 0x20, 0x68,
+ 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x76,
+ 0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
+ 0x72, 0x70, 0x61, 0x20, 0x28, 0x63, 0x29, 0x30, 0x31, 0x10, 0x30, 0x0e,
+ 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x53, 0x31, 0x13, 0x30, 0x11,
+ 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x0a, 0x47, 0x31, 0x13, 0x30, 0x11,
+ 0x06, 0x0b, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x3c, 0x02, 0x01,
+ 0x03, 0x13, 0x02, 0x55, 0x31, 0x16, 0x30, 0x14, 0x06, 0x03, 0x55, 0x04,
+ 0x03, 0x14, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
+ 0x31, 0x1d, 0x30, 0x1b, 0x06, 0x03, 0x55, 0x04, 0x0f, 0x13, 0x14, 0x50,
+ 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x20, 0x4f, 0x72, 0x67, 0x61, 0x6e,
+ 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x12, 0x31, 0x21, 0x30,
+ 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x18, 0x44, 0x6f, 0x6d, 0x61,
+ 0x69, 0x6e, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x20, 0x56,
+ 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x64, 0x31, 0x14, 0x31, 0x31,
+ 0x30, 0x2f, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x28, 0x53, 0x65, 0x65,
+ 0x20, 0x77, 0x77, 0x77, 0x2e, 0x72, 0x3a, 0x2f, 0x2f, 0x73, 0x65, 0x63,
+ 0x75, 0x72, 0x65, 0x2e, 0x67, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53,
+ 0x69, 0x67, 0x6e, 0x31, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x41,
+ 0x2e, 0x63, 0x72, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6e,
+ 0x20, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x20, 0x33, 0x20, 0x45, 0x63, 0x72,
+ 0x6c, 0x2e, 0x67, 0x65, 0x6f, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x63,
+ 0x6f, 0x6d, 0x2f, 0x63, 0x72, 0x6c, 0x73, 0x2f, 0x73, 0x64, 0x31, 0x1a,
+ 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x3a,
+ 0x2f, 0x2f, 0x45, 0x56, 0x49, 0x6e, 0x74, 0x6c, 0x2d, 0x63, 0x63, 0x72,
+ 0x74, 0x2e, 0x67, 0x77, 0x77, 0x77, 0x2e, 0x67, 0x69, 0x63, 0x65, 0x72,
+ 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x31, 0x6f, 0x63, 0x73, 0x70, 0x2e,
+ 0x76, 0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d,
+ 0x30, 0x39, 0x72, 0x61, 0x70, 0x69, 0x64, 0x73, 0x73, 0x6c, 0x2e, 0x63,
+ 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x64, 0x61, 0x64, 0x64, 0x79, 0x2e, 0x63,
+ 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72,
+ 0x79, 0x2f, 0x30, 0x81, 0x80, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05,
+ 0x07, 0x01, 0x01, 0x04, 0x74, 0x30, 0x72, 0x30, 0x24, 0x06, 0x08, 0x2b,
+ 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x86, 0x18, 0x68, 0x74, 0x74,
+ 0x70, 0x3a, 0x2f, 0x2f, 0x6f, 0x63, 0x73, 0x70, 0x2e, 0x67, 0x6f, 0x64,
+ 0x61, 0x64, 0x64, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x30, 0x4a, 0x06,
+ 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x02, 0x86, 0x3e, 0x68,
+ 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66,
+ 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x2e, 0x67, 0x6f, 0x64, 0x61, 0x64,
+ 0x64, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73,
+ 0x69, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x67, 0x64, 0x5f, 0x69, 0x6e, 0x74,
+ 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x74, 0x65, 0x2e, 0x63, 0x72,
+ 0x74, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16,
+ 0x80, 0x14, 0xfd, 0xac, 0x61, 0x32, 0x93, 0x6c, 0x45, 0xd6, 0xe2, 0xee,
+ 0x85, 0x5f, 0x9a, 0xba, 0xe7, 0x76, 0x99, 0x68, 0xcc, 0xe7, 0x30, 0x27,
+ 0x86, 0x29, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x86, 0x30,
+ 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x73,
};
// CertEntry represents a certificate in compressed form. Each entry is one of
@@ -186,8 +186,8 @@ vector<CertEntry> MatchCerts(const vector<string>& certs,
client_cached_cert_hashes.size() % sizeof(uint64) == 0 &&
!client_cached_cert_hashes.empty();
- for (vector<string>::const_iterator i = certs.begin();
- i != certs.end(); ++i) {
+ for (vector<string>::const_iterator i = certs.begin(); i != certs.end();
+ ++i) {
CertEntry entry;
if (cached_valid) {
@@ -216,8 +216,9 @@ vector<CertEntry> MatchCerts(const vector<string>& certs,
}
}
- if (common_sets && common_sets->MatchCert(*i, client_common_set_hashes,
- &entry.set_hash, &entry.index)) {
+ if (common_sets &&
+ common_sets->MatchCert(*i, client_common_set_hashes, &entry.set_hash,
+ &entry.index)) {
entry.type = CertEntry::COMMON;
entries.push_back(entry);
continue;
@@ -321,8 +322,8 @@ vector<uint64> HashCerts(const vector<string>& certs) {
vector<uint64> ret;
ret.reserve(certs.size());
- for (vector<string>::const_iterator i = certs.begin();
- i != certs.end(); ++i) {
+ for (vector<string>::const_iterator i = certs.begin(); i != certs.end();
+ ++i) {
ret.push_back(QuicUtils::FNV1a_64_Hash(i->data(), i->size()));
}
@@ -429,9 +430,7 @@ class ScopedZLib {
z_ = z;
}
- ~ScopedZLib() {
- Clear();
- }
+ ~ScopedZLib() { Clear(); }
private:
void Clear() {
@@ -453,7 +452,6 @@ class ScopedZLib {
} // anonymous namespace
-
// static
string CertCompressor::CompressChain(const vector<string>& certs,
StringPiece client_common_set_hashes,
diff --git a/net/quic/crypto/cert_compressor_test.cc b/net/quic/crypto/cert_compressor_test.cc
index 1b3c28a..7e8a0f2 100644
--- a/net/quic/crypto/cert_compressor_test.cc
+++ b/net/quic/crypto/cert_compressor_test.cc
@@ -53,10 +53,11 @@ TEST(CertCompressor, Common) {
chain,
StringPiece(reinterpret_cast<const char*>(&set_hash), sizeof(set_hash)),
StringPiece(), common_sets.get());
- const string common("03" /* common */
- "2A00000000000000" /* set hash 42 */
- "01000000" /* index 1 */
- "00" /* end of list */);
+ const string common(
+ "03" /* common */
+ "2A00000000000000" /* set hash 42 */
+ "01000000" /* index 1 */
+ "00" /* end of list */);
EXPECT_EQ(common.data(),
base::HexEncode(compressed.data(), compressed.size()));
@@ -76,8 +77,8 @@ TEST(CertCompressor, Cached) {
CertCompressor::CompressChain(chain, StringPiece(), hash_bytes, nullptr);
EXPECT_EQ("02" /* cached */ +
- base::HexEncode(hash_bytes.data(), hash_bytes.size()) +
- "00" /* end of list */,
+ base::HexEncode(hash_bytes.data(), hash_bytes.size()) +
+ "00" /* end of list */,
base::HexEncode(compressed.data(), compressed.size()));
vector<string> cached_certs, chain2;
@@ -94,14 +95,14 @@ TEST(CertCompressor, BadInputs) {
/* bad entry type */
const string bad_entry("04");
EXPECT_FALSE(CertCompressor::DecompressChain(
- base::HexEncode(bad_entry.data(), bad_entry.size()),
- cached_certs, nullptr, &chain));
+ base::HexEncode(bad_entry.data(), bad_entry.size()), cached_certs,
+ nullptr, &chain));
/* no terminator */
const string no_terminator("01");
EXPECT_FALSE(CertCompressor::DecompressChain(
- base::HexEncode(no_terminator.data(), no_terminator.size()),
- cached_certs, nullptr, &chain));
+ base::HexEncode(no_terminator.data(), no_terminator.size()), cached_certs,
+ nullptr, &chain));
/* hash truncated */
const string hash_truncated("0200");
@@ -118,7 +119,9 @@ TEST(CertCompressor, BadInputs) {
/* without a CommonCertSets */
const string without_a_common_cert_set(
- "03" "0000000000000000" "00000000");
+ "03"
+ "0000000000000000"
+ "00000000");
EXPECT_FALSE(CertCompressor::DecompressChain(
base::HexEncode(without_a_common_cert_set.data(),
without_a_common_cert_set.size()),
@@ -129,7 +132,9 @@ TEST(CertCompressor, BadInputs) {
/* incorrect hash and index */
const string incorrect_hash_and_index(
- "03" "a200000000000000" "00000000");
+ "03"
+ "a200000000000000"
+ "00000000");
EXPECT_FALSE(CertCompressor::DecompressChain(
base::HexEncode(incorrect_hash_and_index.data(),
incorrect_hash_and_index.size()),
diff --git a/net/quic/crypto/chacha20_poly1305_decrypter_test.cc b/net/quic/crypto/chacha20_poly1305_decrypter_test.cc
index ed7239c..d38e9b5 100644
--- a/net/quic/crypto/chacha20_poly1305_decrypter_test.cc
+++ b/net/quic/crypto/chacha20_poly1305_decrypter_test.cc
@@ -30,39 +30,39 @@ struct TestVector {
};
const TestVector test_vectors[] = {
- { "4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd110"
+ {"4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd110"
+ "0a1007",
+ "cd7cf67be39c794a", "87e229d4500845a079c0",
+ "e3e446f7ede9a19b62a4677dabf4e3d24b876bb28475", // "3896e1d6" truncated.
+ "86d09974840bded2a5ca"},
+ // Modify the ciphertext (ChaCha20 encryption output).
+ {
+ "4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd110"
"0a1007",
- "cd7cf67be39c794a",
- "87e229d4500845a079c0",
- "e3e446f7ede9a19b62a4677dabf4e3d24b876bb28475", // "3896e1d6" truncated.
- "86d09974840bded2a5ca"
- },
- // Modify the ciphertext (ChaCha20 encryption output).
- { "4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd110"
+ "cd7cf67be39c794a", "87e229d4500845a079c0",
+ "f3e446f7ede9a19b62a4677dabf4e3d24b876bb28475", // "3896e1d6"
+ // truncated.
+ NULL // FAIL
+ },
+ // Modify the ciphertext (Poly1305 authenticator).
+ {
+ "4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd110"
"0a1007",
- "cd7cf67be39c794a",
- "87e229d4500845a079c0",
- "f3e446f7ede9a19b62a4677dabf4e3d24b876bb28475", // "3896e1d6" truncated.
- NULL // FAIL
- },
- // Modify the ciphertext (Poly1305 authenticator).
- { "4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd110"
+ "cd7cf67be39c794a", "87e229d4500845a079c0",
+ "e3e446f7ede9a19b62a4677dabf4e3d24b876bb28476", // "3896e1d6"
+ // truncated.
+ NULL // FAIL
+ },
+ // Modify the associated data.
+ {
+ "4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd110"
"0a1007",
- "cd7cf67be39c794a",
- "87e229d4500845a079c0",
- "e3e446f7ede9a19b62a4677dabf4e3d24b876bb28476", // "3896e1d6" truncated.
- NULL // FAIL
- },
- // Modify the associated data.
- { "4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd110"
- "0a1007",
- "dd7cf67be39c794a",
- "87e229d4500845a079c0",
- "e3e446f7ede9a19b62a4677dabf4e3d24b876bb28475", // "3896e1d6" truncated.
- NULL // FAIL
- },
- { NULL }
-};
+ "dd7cf67be39c794a", "87e229d4500845a079c0",
+ "e3e446f7ede9a19b62a4677dabf4e3d24b876bb28475", // "3896e1d6"
+ // truncated.
+ NULL // FAIL
+ },
+ {NULL}};
} // namespace
diff --git a/net/quic/crypto/chacha20_poly1305_encrypter_test.cc b/net/quic/crypto/chacha20_poly1305_encrypter_test.cc
index 59eda37..191562d 100644
--- a/net/quic/crypto/chacha20_poly1305_encrypter_test.cc
+++ b/net/quic/crypto/chacha20_poly1305_encrypter_test.cc
@@ -25,15 +25,13 @@ struct TestVector {
};
const TestVector test_vectors[] = {
- { "4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd110"
+ {
+ "4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd110"
"0a1007",
- "86d09974840bded2a5ca",
- "cd7cf67be39c794a",
- "87e229d4500845a079c0",
- "e3e446f7ede9a19b62a4677dabf4e3d24b876bb28475" // "3896e1d6" truncated.
- },
- { NULL }
-};
+ "86d09974840bded2a5ca", "cd7cf67be39c794a", "87e229d4500845a079c0",
+ "e3e446f7ede9a19b62a4677dabf4e3d24b876bb28475" // "3896e1d6" truncated.
+ },
+ {NULL}};
} // namespace
diff --git a/net/quic/crypto/channel_id_chromium.cc b/net/quic/crypto/channel_id_chromium.cc
index a4d6d91..da11663 100644
--- a/net/quic/crypto/channel_id_chromium.cc
+++ b/net/quic/crypto/channel_id_chromium.cc
@@ -18,8 +18,7 @@ namespace net {
ChannelIDKeyChromium::ChannelIDKeyChromium(
scoped_ptr<crypto::ECPrivateKey> ec_private_key)
- : ec_private_key_(ec_private_key.Pass()) {
-}
+ : ec_private_key_(std::move(ec_private_key)) {}
ChannelIDKeyChromium::~ChannelIDKeyChromium() {}
@@ -103,13 +102,11 @@ class ChannelIDSourceChromium::Job {
DISALLOW_COPY_AND_ASSIGN(Job);
};
-ChannelIDSourceChromium::Job::Job(
- ChannelIDSourceChromium* channel_id_source,
- ChannelIDService* channel_id_service)
+ChannelIDSourceChromium::Job::Job(ChannelIDSourceChromium* channel_id_source,
+ ChannelIDService* channel_id_service)
: channel_id_source_(channel_id_source),
channel_id_service_(channel_id_service),
- next_state_(STATE_NONE) {
-}
+ next_state_(STATE_NONE) {}
QuicAsyncStatus ChannelIDSourceChromium::Job::GetChannelIDKey(
const std::string& hostname,
@@ -204,8 +201,7 @@ int ChannelIDSourceChromium::Job::DoGetChannelIDKeyComplete(int result) {
ChannelIDSourceChromium::ChannelIDSourceChromium(
ChannelIDService* channel_id_service)
- : channel_id_service_(channel_id_service) {
-}
+ : channel_id_service_(channel_id_service) {}
ChannelIDSourceChromium::~ChannelIDSourceChromium() {
STLDeleteElements(&active_jobs_);
@@ -216,8 +212,8 @@ QuicAsyncStatus ChannelIDSourceChromium::GetChannelIDKey(
scoped_ptr<ChannelIDKey>* channel_id_key,
ChannelIDSourceCallback* callback) {
scoped_ptr<Job> job(new Job(this, channel_id_service_));
- QuicAsyncStatus status = job->GetChannelIDKey(hostname, channel_id_key,
- callback);
+ QuicAsyncStatus status =
+ job->GetChannelIDKey(hostname, channel_id_key, callback);
if (status == QUIC_PENDING) {
active_jobs_.insert(job.release());
}
diff --git a/net/quic/crypto/channel_id_chromium.h b/net/quic/crypto/channel_id_chromium.h
index 43a1ed3..73c3cf1 100644
--- a/net/quic/crypto/channel_id_chromium.h
+++ b/net/quic/crypto/channel_id_chromium.h
@@ -17,7 +17,7 @@ namespace net {
class ChannelIDService;
-class NET_EXPORT_PRIVATE ChannelIDKeyChromium: public ChannelIDKey {
+class NET_EXPORT_PRIVATE ChannelIDKeyChromium : public ChannelIDKey {
public:
explicit ChannelIDKeyChromium(
scoped_ptr<crypto::ECPrivateKey> ec_private_key);
@@ -35,8 +35,7 @@ class NET_EXPORT_PRIVATE ChannelIDKeyChromium: public ChannelIDKey {
// ChannelIDSourceChromium implements the QUIC ChannelIDSource interface.
class ChannelIDSourceChromium : public ChannelIDSource {
public:
- explicit ChannelIDSourceChromium(
- ChannelIDService* channel_id_service);
+ explicit ChannelIDSourceChromium(ChannelIDService* channel_id_service);
~ChannelIDSourceChromium() override;
// ChannelIDSource interface
diff --git a/net/quic/crypto/channel_id_nss.cc b/net/quic/crypto/channel_id_nss.cc
index 748e4ef..522b2f6 100644
--- a/net/quic/crypto/channel_id_nss.cc
+++ b/net/quic/crypto/channel_id_nss.cc
@@ -24,8 +24,7 @@ bool ChannelIDVerifier::VerifyRaw(StringPiece key,
StringPiece signed_data,
StringPiece signature,
bool is_channel_id_signature) {
- if (key.size() != 32 * 2 ||
- signature.size() != 32 * 2) {
+ if (key.size() != 32 * 2 || signature.size() != 32 * 2) {
return false;
}
@@ -34,9 +33,8 @@ bool ChannelIDVerifier::VerifyRaw(StringPiece key,
// DER encoding of the object identifier (OID) of the named curve P-256
// (1.2.840.10045.3.1.7). See RFC 6637 Section 11.
- static const unsigned char p256_oid[] = {
- 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07
- };
+ static const unsigned char p256_oid[] = {0x06, 0x08, 0x2a, 0x86, 0x48,
+ 0xce, 0x3d, 0x03, 0x01, 0x07};
public_key.keyType = ecKey;
public_key.u.ec.DEREncodedParams.type = siBuffer;
public_key.u.ec.DEREncodedParams.data = const_cast<unsigned char*>(p256_oid);
@@ -49,14 +47,12 @@ bool ChannelIDVerifier::VerifyRaw(StringPiece key,
public_key.u.ec.publicValue.data = key_buf;
public_key.u.ec.publicValue.len = sizeof(key_buf);
- SECItem signature_item = {
- siBuffer,
- reinterpret_cast<unsigned char*>(const_cast<char*>(signature.data())),
- static_cast<unsigned int>(signature.size())
- };
+ SECItem signature_item = {siBuffer, reinterpret_cast<unsigned char*>(
+ const_cast<char*>(signature.data())),
+ static_cast<unsigned int>(signature.size())};
unsigned char hash_buf[SHA256_LENGTH];
- SECItem hash_item = { siBuffer, hash_buf, sizeof(hash_buf) };
+ SECItem hash_item = {siBuffer, hash_buf, sizeof(hash_buf)};
HASHContext* sha256 = HASH_Create(HASH_AlgSHA256);
if (!sha256) {
diff --git a/net/quic/crypto/channel_id_openssl.cc b/net/quic/crypto/channel_id_openssl.cc
index 97dc32e..1ba0a88 100644
--- a/net/quic/crypto/channel_id_openssl.cc
+++ b/net/quic/crypto/channel_id_openssl.cc
@@ -29,8 +29,7 @@ bool ChannelIDVerifier::VerifyRaw(StringPiece key,
StringPiece signed_data,
StringPiece signature,
bool is_channel_id_signature) {
- if (key.size() != 32 * 2 ||
- signature.size() != 32 * 2) {
+ if (key.size() != 32 * 2 || signature.size() != 32 * 2) {
return false;
}
@@ -49,9 +48,9 @@ bool ChannelIDVerifier::VerifyRaw(StringPiece key,
const uint8* signature_bytes =
reinterpret_cast<const uint8*>(signature.data());
- if (BN_bin2bn(key_bytes + 0, 32, x.get()) == nullptr ||
- BN_bin2bn(key_bytes + 32, 32, y.get()) == nullptr ||
- BN_bin2bn(signature_bytes + 0, 32, sig.r) == nullptr ||
+ if (BN_bin2bn(key_bytes + 0, 32, x.get()) == nullptr ||
+ BN_bin2bn(key_bytes + 32, 32, y.get()) == nullptr ||
+ BN_bin2bn(signature_bytes + 0, 32, sig.r) == nullptr ||
BN_bin2bn(signature_bytes + 32, 32, sig.s) == nullptr) {
return false;
}
diff --git a/net/quic/crypto/channel_id_test.cc b/net/quic/crypto/channel_id_test.cc
index 7392723..c9de788 100644
--- a/net/quic/crypto/channel_id_test.cc
+++ b/net/quic/crypto/channel_id_test.cc
@@ -33,158 +33,172 @@ struct TestVector {
};
const TestVector test_vector[] = {
- { "e4796db5f785f207aa30d311693b3702821dff1168fd2e04c0836825aefd850d"
- "9aa60326d88cde1a23c7745351392ca2288d632c264f197d05cd424a30336c19"
- "fd09bb229654f0222fcb881a4b35c290a093ac159ce13409111ff0358411133c"
- "24f5b8e2090d6db6558afc36f06ca1f6ef779785adba68db27a409859fc4c4a0",
- "87f8f2b218f49845f6f10eec3877136269f5c1a54736dbdf69f89940cad41555",
- "e15f369036f49842fac7a86c8a2b0557609776814448b8f5e84aa9f4395205e9",
- "d19ff48b324915576416097d2544f7cbdf8768b1454ad20e0baac50e211f23b0",
- "a3e81e59311cdfff2d4784949f7a2cb50ba6c3a91fa54710568e61aca3e847c6",
- false // F (3 - S changed)
- },
- { "069a6e6b93dfee6df6ef6997cd80dd2182c36653cef10c655d524585655462d6"
- "83877f95ecc6d6c81623d8fac4e900ed0019964094e7de91f1481989ae187300"
- "4565789cbf5dc56c62aedc63f62f3b894c9c6f7788c8ecaadc9bd0e81ad91b2b"
- "3569ea12260e93924fdddd3972af5273198f5efda0746219475017557616170e",
- "5cf02a00d205bdfee2016f7421807fc38ae69e6b7ccd064ee689fc1a94a9f7d2",
- "ec530ce3cc5c9d1af463f264d685afe2b4db4b5828d7e61b748930f3ce622a85",
- "dc23d130c6117fb5751201455e99f36f59aba1a6a21cf2d0e7481a97451d6693",
- "d6ce7708c18dbf35d4f8aa7240922dc6823f2e7058cbc1484fcad1599db5018c",
- false // F (2 - R changed)
- },
- { "df04a346cf4d0e331a6db78cca2d456d31b0a000aa51441defdb97bbeb20b94d"
- "8d746429a393ba88840d661615e07def615a342abedfa4ce912e562af7149598"
- "96858af817317a840dcff85a057bb91a3c2bf90105500362754a6dd321cdd861"
- "28cfc5f04667b57aa78c112411e42da304f1012d48cd6a7052d7de44ebcc01de",
- "2ddfd145767883ffbb0ac003ab4a44346d08fa2570b3120dcce94562422244cb",
- "5f70c7d11ac2b7a435ccfbbae02c3df1ea6b532cc0e9db74f93fffca7c6f9a64",
- "9913111cff6f20c5bf453a99cd2c2019a4e749a49724a08774d14e4c113edda8",
- "9467cd4cd21ecb56b0cab0a9a453b43386845459127a952421f5c6382866c5cc",
- false // F (4 - Q changed)
- },
- { "e1130af6a38ccb412a9c8d13e15dbfc9e69a16385af3c3f1e5da954fd5e7c45f"
- "d75e2b8c36699228e92840c0562fbf3772f07e17f1add56588dd45f7450e1217"
- "ad239922dd9c32695dc71ff2424ca0dec1321aa47064a044b7fe3c2b97d03ce4"
- "70a592304c5ef21eed9f93da56bb232d1eeb0035f9bf0dfafdcc4606272b20a3",
- "e424dc61d4bb3cb7ef4344a7f8957a0c5134e16f7a67c074f82e6e12f49abf3c",
- "970eed7aa2bc48651545949de1dddaf0127e5965ac85d1243d6f60e7dfaee927",
- "bf96b99aa49c705c910be33142017c642ff540c76349b9dab72f981fd9347f4f",
- "17c55095819089c2e03b9cd415abdf12444e323075d98f31920b9e0f57ec871c",
- true // P (0 )
- },
- { "73c5f6a67456ae48209b5f85d1e7de7758bf235300c6ae2bdceb1dcb27a7730f"
- "b68c950b7fcada0ecc4661d3578230f225a875e69aaa17f1e71c6be5c831f226"
- "63bac63d0c7a9635edb0043ff8c6f26470f02a7bc56556f1437f06dfa27b487a"
- "6c4290d8bad38d4879b334e341ba092dde4e4ae694a9c09302e2dbf443581c08",
- "e0fc6a6f50e1c57475673ee54e3a57f9a49f3328e743bf52f335e3eeaa3d2864",
- "7f59d689c91e463607d9194d99faf316e25432870816dde63f5d4b373f12f22a",
- "1d75830cd36f4c9aa181b2c4221e87f176b7f05b7c87824e82e396c88315c407",
- "cb2acb01dac96efc53a32d4a0d85d0c2e48955214783ecf50a4f0414a319c05a",
- true // P (0 )
- },
- { "666036d9b4a2426ed6585a4e0fd931a8761451d29ab04bd7dc6d0c5b9e38e6c2"
- "b263ff6cb837bd04399de3d757c6c7005f6d7a987063cf6d7e8cb38a4bf0d74a"
- "282572bd01d0f41e3fd066e3021575f0fa04f27b700d5b7ddddf50965993c3f9"
- "c7118ed78888da7cb221849b3260592b8e632d7c51e935a0ceae15207bedd548",
- "a849bef575cac3c6920fbce675c3b787136209f855de19ffe2e8d29b31a5ad86",
- "bf5fe4f7858f9b805bd8dcc05ad5e7fb889de2f822f3d8b41694e6c55c16b471",
- "25acc3aa9d9e84c7abf08f73fa4195acc506491d6fc37cb9074528a7db87b9d6",
- "9b21d5b5259ed3f2ef07dfec6cc90d3a37855d1ce122a85ba6a333f307d31537",
- false // F (2 - R changed)
- },
- { "7e80436bce57339ce8da1b5660149a20240b146d108deef3ec5da4ae256f8f89"
- "4edcbbc57b34ce37089c0daa17f0c46cd82b5a1599314fd79d2fd2f446bd5a25"
- "b8e32fcf05b76d644573a6df4ad1dfea707b479d97237a346f1ec632ea5660ef"
- "b57e8717a8628d7f82af50a4e84b11f21bdff6839196a880ae20b2a0918d58cd",
- "3dfb6f40f2471b29b77fdccba72d37c21bba019efa40c1c8f91ec405d7dcc5df",
- "f22f953f1e395a52ead7f3ae3fc47451b438117b1e04d613bc8555b7d6e6d1bb",
- "548886278e5ec26bed811dbb72db1e154b6f17be70deb1b210107decb1ec2a5a",
- "e93bfebd2f14f3d827ca32b464be6e69187f5edbd52def4f96599c37d58eee75",
- false // F (4 - Q changed)
- },
- { "1669bfb657fdc62c3ddd63269787fc1c969f1850fb04c933dda063ef74a56ce1"
- "3e3a649700820f0061efabf849a85d474326c8a541d99830eea8131eaea584f2"
- "2d88c353965dabcdc4bf6b55949fd529507dfb803ab6b480cd73ca0ba00ca19c"
- "438849e2cea262a1c57d8f81cd257fb58e19dec7904da97d8386e87b84948169",
- "69b7667056e1e11d6caf6e45643f8b21e7a4bebda463c7fdbc13bc98efbd0214",
- "d3f9b12eb46c7c6fda0da3fc85bc1fd831557f9abc902a3be3cb3e8be7d1aa2f",
- "288f7a1cd391842cce21f00e6f15471c04dc182fe4b14d92dc18910879799790",
- "247b3c4e89a3bcadfea73c7bfd361def43715fa382b8c3edf4ae15d6e55e9979",
- false // F (1 - Message changed)
- },
- { "3fe60dd9ad6caccf5a6f583b3ae65953563446c4510b70da115ffaa0ba04c076"
- "115c7043ab8733403cd69c7d14c212c655c07b43a7c71b9a4cffe22c2684788e"
- "c6870dc2013f269172c822256f9e7cc674791bf2d8486c0f5684283e1649576e"
- "fc982ede17c7b74b214754d70402fb4bb45ad086cf2cf76b3d63f7fce39ac970",
- "bf02cbcf6d8cc26e91766d8af0b164fc5968535e84c158eb3bc4e2d79c3cc682",
- "069ba6cb06b49d60812066afa16ecf7b51352f2c03bd93ec220822b1f3dfba03",
- "f5acb06c59c2b4927fb852faa07faf4b1852bbb5d06840935e849c4d293d1bad",
- "049dab79c89cc02f1484c437f523e080a75f134917fda752f2d5ca397addfe5d",
- false // F (3 - S changed)
- },
- { "983a71b9994d95e876d84d28946a041f8f0a3f544cfcc055496580f1dfd4e312"
- "a2ad418fe69dbc61db230cc0c0ed97e360abab7d6ff4b81ee970a7e97466acfd"
- "9644f828ffec538abc383d0e92326d1c88c55e1f46a668a039beaa1be631a891"
- "29938c00a81a3ae46d4aecbf9707f764dbaccea3ef7665e4c4307fa0b0a3075c",
- "224a4d65b958f6d6afb2904863efd2a734b31798884801fcab5a590f4d6da9de",
- "178d51fddada62806f097aa615d33b8f2404e6b1479f5fd4859d595734d6d2b9",
- "87b93ee2fecfda54deb8dff8e426f3c72c8864991f8ec2b3205bb3b416de93d2",
- "4044a24df85be0cc76f21a4430b75b8e77b932a87f51e4eccbc45c263ebf8f66",
- false // F (2 - R changed)
- },
- { "4a8c071ac4fd0d52faa407b0fe5dab759f7394a5832127f2a3498f34aac28733"
- "9e043b4ffa79528faf199dc917f7b066ad65505dab0e11e6948515052ce20cfd"
- "b892ffb8aa9bf3f1aa5be30a5bbe85823bddf70b39fd7ebd4a93a2f75472c1d4"
- "f606247a9821f1a8c45a6cb80545de2e0c6c0174e2392088c754e9c8443eb5af",
- "43691c7795a57ead8c5c68536fe934538d46f12889680a9cb6d055a066228369",
- "f8790110b3c3b281aa1eae037d4f1234aff587d903d93ba3af225c27ddc9ccac",
- "8acd62e8c262fa50dd9840480969f4ef70f218ebf8ef9584f199031132c6b1ce",
- "cfca7ed3d4347fb2a29e526b43c348ae1ce6c60d44f3191b6d8ea3a2d9c92154",
- false // F (3 - S changed)
- },
- { "0a3a12c3084c865daf1d302c78215d39bfe0b8bf28272b3c0b74beb4b7409db0"
- "718239de700785581514321c6440a4bbaea4c76fa47401e151e68cb6c29017f0"
- "bce4631290af5ea5e2bf3ed742ae110b04ade83a5dbd7358f29a85938e23d87a"
- "c8233072b79c94670ff0959f9c7f4517862ff829452096c78f5f2e9a7e4e9216",
- "9157dbfcf8cf385f5bb1568ad5c6e2a8652ba6dfc63bc1753edf5268cb7eb596",
- "972570f4313d47fc96f7c02d5594d77d46f91e949808825b3d31f029e8296405",
- "dfaea6f297fa320b707866125c2a7d5d515b51a503bee817de9faa343cc48eeb",
- "8f780ad713f9c3e5a4f7fa4c519833dfefc6a7432389b1e4af463961f09764f2",
- false // F (1 - Message changed)
- },
- { "785d07a3c54f63dca11f5d1a5f496ee2c2f9288e55007e666c78b007d95cc285"
- "81dce51f490b30fa73dc9e2d45d075d7e3a95fb8a9e1465ad191904124160b7c"
- "60fa720ef4ef1c5d2998f40570ae2a870ef3e894c2bc617d8a1dc85c3c557749"
- "28c38789b4e661349d3f84d2441a3b856a76949b9f1f80bc161648a1cad5588e",
- "072b10c081a4c1713a294f248aef850e297991aca47fa96a7470abe3b8acfdda",
- "9581145cca04a0fb94cedce752c8f0370861916d2a94e7c647c5373ce6a4c8f5",
- "09f5483eccec80f9d104815a1be9cc1a8e5b12b6eb482a65c6907b7480cf4f19",
- "a4f90e560c5e4eb8696cb276e5165b6a9d486345dedfb094a76e8442d026378d",
- false // F (4 - Q changed)
- },
- { "76f987ec5448dd72219bd30bf6b66b0775c80b394851a43ff1f537f140a6e722"
- "9ef8cd72ad58b1d2d20298539d6347dd5598812bc65323aceaf05228f738b5ad"
- "3e8d9fe4100fd767c2f098c77cb99c2992843ba3eed91d32444f3b6db6cd212d"
- "d4e5609548f4bb62812a920f6e2bf1581be1ebeebdd06ec4e971862cc42055ca",
- "09308ea5bfad6e5adf408634b3d5ce9240d35442f7fe116452aaec0d25be8c24",
- "f40c93e023ef494b1c3079b2d10ef67f3170740495ce2cc57f8ee4b0618b8ee5",
- "5cc8aa7c35743ec0c23dde88dabd5e4fcd0192d2116f6926fef788cddb754e73",
- "9c9c045ebaa1b828c32f82ace0d18daebf5e156eb7cbfdc1eff4399a8a900ae7",
- false // F (1 - Message changed)
- },
- { "60cd64b2cd2be6c33859b94875120361a24085f3765cb8b2bf11e026fa9d8855"
- "dbe435acf7882e84f3c7857f96e2baab4d9afe4588e4a82e17a78827bfdb5ddb"
- "d1c211fbc2e6d884cddd7cb9d90d5bf4a7311b83f352508033812c776a0e00c0"
- "03c7e0d628e50736c7512df0acfa9f2320bd102229f46495ae6d0857cc452a84",
- "2d98ea01f754d34bbc3003df5050200abf445ec728556d7ed7d5c54c55552b6d",
- "9b52672742d637a32add056dfd6d8792f2a33c2e69dafabea09b960bc61e230a",
- "06108e525f845d0155bf60193222b3219c98e3d49424c2fb2a0987f825c17959",
- "62b5cdd591e5b507e560167ba8f6f7cda74673eb315680cb89ccbc4eec477dce",
- true // P (0 )
- },
- { NULL }
-};
+ {
+ "e4796db5f785f207aa30d311693b3702821dff1168fd2e04c0836825aefd850d"
+ "9aa60326d88cde1a23c7745351392ca2288d632c264f197d05cd424a30336c19"
+ "fd09bb229654f0222fcb881a4b35c290a093ac159ce13409111ff0358411133c"
+ "24f5b8e2090d6db6558afc36f06ca1f6ef779785adba68db27a409859fc4c4a0",
+ "87f8f2b218f49845f6f10eec3877136269f5c1a54736dbdf69f89940cad41555",
+ "e15f369036f49842fac7a86c8a2b0557609776814448b8f5e84aa9f4395205e9",
+ "d19ff48b324915576416097d2544f7cbdf8768b1454ad20e0baac50e211f23b0",
+ "a3e81e59311cdfff2d4784949f7a2cb50ba6c3a91fa54710568e61aca3e847c6",
+ false // F (3 - S changed)
+ },
+ {
+ "069a6e6b93dfee6df6ef6997cd80dd2182c36653cef10c655d524585655462d6"
+ "83877f95ecc6d6c81623d8fac4e900ed0019964094e7de91f1481989ae187300"
+ "4565789cbf5dc56c62aedc63f62f3b894c9c6f7788c8ecaadc9bd0e81ad91b2b"
+ "3569ea12260e93924fdddd3972af5273198f5efda0746219475017557616170e",
+ "5cf02a00d205bdfee2016f7421807fc38ae69e6b7ccd064ee689fc1a94a9f7d2",
+ "ec530ce3cc5c9d1af463f264d685afe2b4db4b5828d7e61b748930f3ce622a85",
+ "dc23d130c6117fb5751201455e99f36f59aba1a6a21cf2d0e7481a97451d6693",
+ "d6ce7708c18dbf35d4f8aa7240922dc6823f2e7058cbc1484fcad1599db5018c",
+ false // F (2 - R changed)
+ },
+ {
+ "df04a346cf4d0e331a6db78cca2d456d31b0a000aa51441defdb97bbeb20b94d"
+ "8d746429a393ba88840d661615e07def615a342abedfa4ce912e562af7149598"
+ "96858af817317a840dcff85a057bb91a3c2bf90105500362754a6dd321cdd861"
+ "28cfc5f04667b57aa78c112411e42da304f1012d48cd6a7052d7de44ebcc01de",
+ "2ddfd145767883ffbb0ac003ab4a44346d08fa2570b3120dcce94562422244cb",
+ "5f70c7d11ac2b7a435ccfbbae02c3df1ea6b532cc0e9db74f93fffca7c6f9a64",
+ "9913111cff6f20c5bf453a99cd2c2019a4e749a49724a08774d14e4c113edda8",
+ "9467cd4cd21ecb56b0cab0a9a453b43386845459127a952421f5c6382866c5cc",
+ false // F (4 - Q changed)
+ },
+ {
+ "e1130af6a38ccb412a9c8d13e15dbfc9e69a16385af3c3f1e5da954fd5e7c45f"
+ "d75e2b8c36699228e92840c0562fbf3772f07e17f1add56588dd45f7450e1217"
+ "ad239922dd9c32695dc71ff2424ca0dec1321aa47064a044b7fe3c2b97d03ce4"
+ "70a592304c5ef21eed9f93da56bb232d1eeb0035f9bf0dfafdcc4606272b20a3",
+ "e424dc61d4bb3cb7ef4344a7f8957a0c5134e16f7a67c074f82e6e12f49abf3c",
+ "970eed7aa2bc48651545949de1dddaf0127e5965ac85d1243d6f60e7dfaee927",
+ "bf96b99aa49c705c910be33142017c642ff540c76349b9dab72f981fd9347f4f",
+ "17c55095819089c2e03b9cd415abdf12444e323075d98f31920b9e0f57ec871c",
+ true // P (0 )
+ },
+ {
+ "73c5f6a67456ae48209b5f85d1e7de7758bf235300c6ae2bdceb1dcb27a7730f"
+ "b68c950b7fcada0ecc4661d3578230f225a875e69aaa17f1e71c6be5c831f226"
+ "63bac63d0c7a9635edb0043ff8c6f26470f02a7bc56556f1437f06dfa27b487a"
+ "6c4290d8bad38d4879b334e341ba092dde4e4ae694a9c09302e2dbf443581c08",
+ "e0fc6a6f50e1c57475673ee54e3a57f9a49f3328e743bf52f335e3eeaa3d2864",
+ "7f59d689c91e463607d9194d99faf316e25432870816dde63f5d4b373f12f22a",
+ "1d75830cd36f4c9aa181b2c4221e87f176b7f05b7c87824e82e396c88315c407",
+ "cb2acb01dac96efc53a32d4a0d85d0c2e48955214783ecf50a4f0414a319c05a",
+ true // P (0 )
+ },
+ {
+ "666036d9b4a2426ed6585a4e0fd931a8761451d29ab04bd7dc6d0c5b9e38e6c2"
+ "b263ff6cb837bd04399de3d757c6c7005f6d7a987063cf6d7e8cb38a4bf0d74a"
+ "282572bd01d0f41e3fd066e3021575f0fa04f27b700d5b7ddddf50965993c3f9"
+ "c7118ed78888da7cb221849b3260592b8e632d7c51e935a0ceae15207bedd548",
+ "a849bef575cac3c6920fbce675c3b787136209f855de19ffe2e8d29b31a5ad86",
+ "bf5fe4f7858f9b805bd8dcc05ad5e7fb889de2f822f3d8b41694e6c55c16b471",
+ "25acc3aa9d9e84c7abf08f73fa4195acc506491d6fc37cb9074528a7db87b9d6",
+ "9b21d5b5259ed3f2ef07dfec6cc90d3a37855d1ce122a85ba6a333f307d31537",
+ false // F (2 - R changed)
+ },
+ {
+ "7e80436bce57339ce8da1b5660149a20240b146d108deef3ec5da4ae256f8f89"
+ "4edcbbc57b34ce37089c0daa17f0c46cd82b5a1599314fd79d2fd2f446bd5a25"
+ "b8e32fcf05b76d644573a6df4ad1dfea707b479d97237a346f1ec632ea5660ef"
+ "b57e8717a8628d7f82af50a4e84b11f21bdff6839196a880ae20b2a0918d58cd",
+ "3dfb6f40f2471b29b77fdccba72d37c21bba019efa40c1c8f91ec405d7dcc5df",
+ "f22f953f1e395a52ead7f3ae3fc47451b438117b1e04d613bc8555b7d6e6d1bb",
+ "548886278e5ec26bed811dbb72db1e154b6f17be70deb1b210107decb1ec2a5a",
+ "e93bfebd2f14f3d827ca32b464be6e69187f5edbd52def4f96599c37d58eee75",
+ false // F (4 - Q changed)
+ },
+ {
+ "1669bfb657fdc62c3ddd63269787fc1c969f1850fb04c933dda063ef74a56ce1"
+ "3e3a649700820f0061efabf849a85d474326c8a541d99830eea8131eaea584f2"
+ "2d88c353965dabcdc4bf6b55949fd529507dfb803ab6b480cd73ca0ba00ca19c"
+ "438849e2cea262a1c57d8f81cd257fb58e19dec7904da97d8386e87b84948169",
+ "69b7667056e1e11d6caf6e45643f8b21e7a4bebda463c7fdbc13bc98efbd0214",
+ "d3f9b12eb46c7c6fda0da3fc85bc1fd831557f9abc902a3be3cb3e8be7d1aa2f",
+ "288f7a1cd391842cce21f00e6f15471c04dc182fe4b14d92dc18910879799790",
+ "247b3c4e89a3bcadfea73c7bfd361def43715fa382b8c3edf4ae15d6e55e9979",
+ false // F (1 - Message changed)
+ },
+ {
+ "3fe60dd9ad6caccf5a6f583b3ae65953563446c4510b70da115ffaa0ba04c076"
+ "115c7043ab8733403cd69c7d14c212c655c07b43a7c71b9a4cffe22c2684788e"
+ "c6870dc2013f269172c822256f9e7cc674791bf2d8486c0f5684283e1649576e"
+ "fc982ede17c7b74b214754d70402fb4bb45ad086cf2cf76b3d63f7fce39ac970",
+ "bf02cbcf6d8cc26e91766d8af0b164fc5968535e84c158eb3bc4e2d79c3cc682",
+ "069ba6cb06b49d60812066afa16ecf7b51352f2c03bd93ec220822b1f3dfba03",
+ "f5acb06c59c2b4927fb852faa07faf4b1852bbb5d06840935e849c4d293d1bad",
+ "049dab79c89cc02f1484c437f523e080a75f134917fda752f2d5ca397addfe5d",
+ false // F (3 - S changed)
+ },
+ {
+ "983a71b9994d95e876d84d28946a041f8f0a3f544cfcc055496580f1dfd4e312"
+ "a2ad418fe69dbc61db230cc0c0ed97e360abab7d6ff4b81ee970a7e97466acfd"
+ "9644f828ffec538abc383d0e92326d1c88c55e1f46a668a039beaa1be631a891"
+ "29938c00a81a3ae46d4aecbf9707f764dbaccea3ef7665e4c4307fa0b0a3075c",
+ "224a4d65b958f6d6afb2904863efd2a734b31798884801fcab5a590f4d6da9de",
+ "178d51fddada62806f097aa615d33b8f2404e6b1479f5fd4859d595734d6d2b9",
+ "87b93ee2fecfda54deb8dff8e426f3c72c8864991f8ec2b3205bb3b416de93d2",
+ "4044a24df85be0cc76f21a4430b75b8e77b932a87f51e4eccbc45c263ebf8f66",
+ false // F (2 - R changed)
+ },
+ {
+ "4a8c071ac4fd0d52faa407b0fe5dab759f7394a5832127f2a3498f34aac28733"
+ "9e043b4ffa79528faf199dc917f7b066ad65505dab0e11e6948515052ce20cfd"
+ "b892ffb8aa9bf3f1aa5be30a5bbe85823bddf70b39fd7ebd4a93a2f75472c1d4"
+ "f606247a9821f1a8c45a6cb80545de2e0c6c0174e2392088c754e9c8443eb5af",
+ "43691c7795a57ead8c5c68536fe934538d46f12889680a9cb6d055a066228369",
+ "f8790110b3c3b281aa1eae037d4f1234aff587d903d93ba3af225c27ddc9ccac",
+ "8acd62e8c262fa50dd9840480969f4ef70f218ebf8ef9584f199031132c6b1ce",
+ "cfca7ed3d4347fb2a29e526b43c348ae1ce6c60d44f3191b6d8ea3a2d9c92154",
+ false // F (3 - S changed)
+ },
+ {
+ "0a3a12c3084c865daf1d302c78215d39bfe0b8bf28272b3c0b74beb4b7409db0"
+ "718239de700785581514321c6440a4bbaea4c76fa47401e151e68cb6c29017f0"
+ "bce4631290af5ea5e2bf3ed742ae110b04ade83a5dbd7358f29a85938e23d87a"
+ "c8233072b79c94670ff0959f9c7f4517862ff829452096c78f5f2e9a7e4e9216",
+ "9157dbfcf8cf385f5bb1568ad5c6e2a8652ba6dfc63bc1753edf5268cb7eb596",
+ "972570f4313d47fc96f7c02d5594d77d46f91e949808825b3d31f029e8296405",
+ "dfaea6f297fa320b707866125c2a7d5d515b51a503bee817de9faa343cc48eeb",
+ "8f780ad713f9c3e5a4f7fa4c519833dfefc6a7432389b1e4af463961f09764f2",
+ false // F (1 - Message changed)
+ },
+ {
+ "785d07a3c54f63dca11f5d1a5f496ee2c2f9288e55007e666c78b007d95cc285"
+ "81dce51f490b30fa73dc9e2d45d075d7e3a95fb8a9e1465ad191904124160b7c"
+ "60fa720ef4ef1c5d2998f40570ae2a870ef3e894c2bc617d8a1dc85c3c557749"
+ "28c38789b4e661349d3f84d2441a3b856a76949b9f1f80bc161648a1cad5588e",
+ "072b10c081a4c1713a294f248aef850e297991aca47fa96a7470abe3b8acfdda",
+ "9581145cca04a0fb94cedce752c8f0370861916d2a94e7c647c5373ce6a4c8f5",
+ "09f5483eccec80f9d104815a1be9cc1a8e5b12b6eb482a65c6907b7480cf4f19",
+ "a4f90e560c5e4eb8696cb276e5165b6a9d486345dedfb094a76e8442d026378d",
+ false // F (4 - Q changed)
+ },
+ {
+ "76f987ec5448dd72219bd30bf6b66b0775c80b394851a43ff1f537f140a6e722"
+ "9ef8cd72ad58b1d2d20298539d6347dd5598812bc65323aceaf05228f738b5ad"
+ "3e8d9fe4100fd767c2f098c77cb99c2992843ba3eed91d32444f3b6db6cd212d"
+ "d4e5609548f4bb62812a920f6e2bf1581be1ebeebdd06ec4e971862cc42055ca",
+ "09308ea5bfad6e5adf408634b3d5ce9240d35442f7fe116452aaec0d25be8c24",
+ "f40c93e023ef494b1c3079b2d10ef67f3170740495ce2cc57f8ee4b0618b8ee5",
+ "5cc8aa7c35743ec0c23dde88dabd5e4fcd0192d2116f6926fef788cddb754e73",
+ "9c9c045ebaa1b828c32f82ace0d18daebf5e156eb7cbfdc1eff4399a8a900ae7",
+ false // F (1 - Message changed)
+ },
+ {
+ "60cd64b2cd2be6c33859b94875120361a24085f3765cb8b2bf11e026fa9d8855"
+ "dbe435acf7882e84f3c7857f96e2baab4d9afe4588e4a82e17a78827bfdb5ddb"
+ "d1c211fbc2e6d884cddd7cb9d90d5bf4a7311b83f352508033812c776a0e00c0"
+ "03c7e0d628e50736c7512df0acfa9f2320bd102229f46495ae6d0857cc452a84",
+ "2d98ea01f754d34bbc3003df5050200abf445ec728556d7ed7d5c54c55552b6d",
+ "9b52672742d637a32add056dfd6d8792f2a33c2e69dafabea09b960bc61e230a",
+ "06108e525f845d0155bf60193222b3219c98e3d49424c2fb2a0987f825c17959",
+ "62b5cdd591e5b507e560167ba8f6f7cda74673eb315680cb89ccbc4eec477dce",
+ true // P (0 )
+ },
+ {NULL}};
} // namespace
@@ -242,8 +256,8 @@ TEST(ChannelIDTest, SignAndVerify) {
scoped_ptr<char[]> bad_key(new char[key.size()]);
memcpy(bad_key.get(), key.data(), key.size());
bad_key[1] ^= 0x80;
- EXPECT_FALSE(ChannelIDVerifier::Verify(
- string(bad_key.get(), key.size()), signed_data, signature));
+ EXPECT_FALSE(ChannelIDVerifier::Verify(string(bad_key.get(), key.size()),
+ signed_data, signature));
scoped_ptr<char[]> bad_signature(new char[signature.size()]);
memcpy(bad_signature.get(), signature.data(), signature.size());
@@ -251,8 +265,7 @@ TEST(ChannelIDTest, SignAndVerify) {
EXPECT_FALSE(ChannelIDVerifier::Verify(
key, signed_data, string(bad_signature.get(), signature.size())));
- EXPECT_FALSE(ChannelIDVerifier::Verify(
- key, "wrong signed data", signature));
+ EXPECT_FALSE(ChannelIDVerifier::Verify(key, "wrong signed data", signature));
}
} // namespace test
diff --git a/net/quic/crypto/common_cert_set_test.cc b/net/quic/crypto/common_cert_set_test.cc
index 0e89025..39d0d7a 100644
--- a/net/quic/crypto/common_cert_set_test.cc
+++ b/net/quic/crypto/common_cert_set_test.cc
@@ -14,91 +14,91 @@ namespace net {
namespace test {
static const unsigned char kGIACertificate1[] = {
- 0x30, 0x82, 0x03, 0xf0, 0x30, 0x82, 0x02, 0xd8, 0xa0, 0x03, 0x02, 0x01,
- 0x02, 0x02, 0x03, 0x02, 0x3a, 0x76, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
- 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x42, 0x31,
- 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53,
- 0x31, 0x16, 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0d, 0x47,
- 0x65, 0x6f, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x49, 0x6e, 0x63, 0x2e,
- 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x12, 0x47,
- 0x65, 0x6f, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x47, 0x6c, 0x6f, 0x62,
- 0x61, 0x6c, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x33, 0x30,
- 0x34, 0x30, 0x35, 0x31, 0x35, 0x31, 0x35, 0x35, 0x35, 0x5a, 0x17, 0x0d,
- 0x31, 0x36, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39,
- 0x5a, 0x30, 0x49, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
- 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04,
- 0x0a, 0x13, 0x0a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e,
- 0x63, 0x31, 0x25, 0x30, 0x23, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1c,
- 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x74, 0x65, 0x72,
- 0x6e, 0x65, 0x74, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74,
- 0x79, 0x20, 0x47, 0x32, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09,
- 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03,
- 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01,
- 0x00, 0x9c, 0x2a, 0x04, 0x77, 0x5c, 0xd8, 0x50, 0x91, 0x3a, 0x06, 0xa3,
- 0x82, 0xe0, 0xd8, 0x50, 0x48, 0xbc, 0x89, 0x3f, 0xf1, 0x19, 0x70, 0x1a,
- 0x88, 0x46, 0x7e, 0xe0, 0x8f, 0xc5, 0xf1, 0x89, 0xce, 0x21, 0xee, 0x5a,
- 0xfe, 0x61, 0x0d, 0xb7, 0x32, 0x44, 0x89, 0xa0, 0x74, 0x0b, 0x53, 0x4f,
- 0x55, 0xa4, 0xce, 0x82, 0x62, 0x95, 0xee, 0xeb, 0x59, 0x5f, 0xc6, 0xe1,
- 0x05, 0x80, 0x12, 0xc4, 0x5e, 0x94, 0x3f, 0xbc, 0x5b, 0x48, 0x38, 0xf4,
- 0x53, 0xf7, 0x24, 0xe6, 0xfb, 0x91, 0xe9, 0x15, 0xc4, 0xcf, 0xf4, 0x53,
- 0x0d, 0xf4, 0x4a, 0xfc, 0x9f, 0x54, 0xde, 0x7d, 0xbe, 0xa0, 0x6b, 0x6f,
- 0x87, 0xc0, 0xd0, 0x50, 0x1f, 0x28, 0x30, 0x03, 0x40, 0xda, 0x08, 0x73,
- 0x51, 0x6c, 0x7f, 0xff, 0x3a, 0x3c, 0xa7, 0x37, 0x06, 0x8e, 0xbd, 0x4b,
- 0x11, 0x04, 0xeb, 0x7d, 0x24, 0xde, 0xe6, 0xf9, 0xfc, 0x31, 0x71, 0xfb,
- 0x94, 0xd5, 0x60, 0xf3, 0x2e, 0x4a, 0xaf, 0x42, 0xd2, 0xcb, 0xea, 0xc4,
- 0x6a, 0x1a, 0xb2, 0xcc, 0x53, 0xdd, 0x15, 0x4b, 0x8b, 0x1f, 0xc8, 0x19,
- 0x61, 0x1f, 0xcd, 0x9d, 0xa8, 0x3e, 0x63, 0x2b, 0x84, 0x35, 0x69, 0x65,
- 0x84, 0xc8, 0x19, 0xc5, 0x46, 0x22, 0xf8, 0x53, 0x95, 0xbe, 0xe3, 0x80,
- 0x4a, 0x10, 0xc6, 0x2a, 0xec, 0xba, 0x97, 0x20, 0x11, 0xc7, 0x39, 0x99,
- 0x10, 0x04, 0xa0, 0xf0, 0x61, 0x7a, 0x95, 0x25, 0x8c, 0x4e, 0x52, 0x75,
- 0xe2, 0xb6, 0xed, 0x08, 0xca, 0x14, 0xfc, 0xce, 0x22, 0x6a, 0xb3, 0x4e,
- 0xcf, 0x46, 0x03, 0x97, 0x97, 0x03, 0x7e, 0xc0, 0xb1, 0xde, 0x7b, 0xaf,
- 0x45, 0x33, 0xcf, 0xba, 0x3e, 0x71, 0xb7, 0xde, 0xf4, 0x25, 0x25, 0xc2,
- 0x0d, 0x35, 0x89, 0x9d, 0x9d, 0xfb, 0x0e, 0x11, 0x79, 0x89, 0x1e, 0x37,
- 0xc5, 0xaf, 0x8e, 0x72, 0x69, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81,
- 0xe7, 0x30, 0x81, 0xe4, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04,
- 0x18, 0x30, 0x16, 0x80, 0x14, 0xc0, 0x7a, 0x98, 0x68, 0x8d, 0x89, 0xfb,
- 0xab, 0x05, 0x64, 0x0c, 0x11, 0x7d, 0xaa, 0x7d, 0x65, 0xb8, 0xca, 0xcc,
- 0x4e, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14,
- 0x4a, 0xdd, 0x06, 0x16, 0x1b, 0xbc, 0xf6, 0x68, 0xb5, 0x76, 0xf5, 0x81,
- 0xb6, 0xbb, 0x62, 0x1a, 0xba, 0x5a, 0x81, 0x2f, 0x30, 0x12, 0x06, 0x03,
- 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01,
- 0xff, 0x02, 0x01, 0x00, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01,
- 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x35, 0x06, 0x03,
- 0x55, 0x1d, 0x1f, 0x04, 0x2e, 0x30, 0x2c, 0x30, 0x2a, 0xa0, 0x28, 0xa0,
- 0x26, 0x86, 0x24, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x67, 0x2e,
- 0x73, 0x79, 0x6d, 0x63, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x72,
- 0x6c, 0x73, 0x2f, 0x67, 0x74, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e,
- 0x63, 0x72, 0x6c, 0x30, 0x2e, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05,
- 0x07, 0x01, 0x01, 0x04, 0x22, 0x30, 0x20, 0x30, 0x1e, 0x06, 0x08, 0x2b,
- 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x86, 0x12, 0x68, 0x74, 0x74,
- 0x70, 0x3a, 0x2f, 0x2f, 0x67, 0x2e, 0x73, 0x79, 0x6d, 0x63, 0x64, 0x2e,
- 0x63, 0x6f, 0x6d, 0x30, 0x17, 0x06, 0x03, 0x55, 0x1d, 0x20, 0x04, 0x10,
- 0x30, 0x0e, 0x30, 0x0c, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xd6,
- 0x79, 0x02, 0x05, 0x01, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
- 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00,
- 0x27, 0x8c, 0xcf, 0xe9, 0xc7, 0x3b, 0xbe, 0xc0, 0x6f, 0xe8, 0x96, 0x84,
- 0xfb, 0x9c, 0x5c, 0x5d, 0x90, 0xe4, 0x77, 0xdb, 0x8b, 0x32, 0x60, 0x9b,
- 0x65, 0xd8, 0x85, 0x26, 0xb5, 0xba, 0x9f, 0x1e, 0xde, 0x64, 0x4e, 0x1f,
- 0xc6, 0xc8, 0x20, 0x5b, 0x09, 0x9f, 0xab, 0xa9, 0xe0, 0x09, 0x34, 0x45,
- 0xa2, 0x65, 0x25, 0x37, 0x3d, 0x7f, 0x5a, 0x6f, 0x20, 0xcc, 0xf9, 0xfa,
- 0xf1, 0x1d, 0x8f, 0x10, 0x0c, 0x02, 0x3a, 0xc4, 0xc9, 0x01, 0x76, 0x96,
- 0xbe, 0x9b, 0xf9, 0x15, 0xd8, 0x39, 0xd1, 0xc5, 0x03, 0x47, 0x76, 0xb8,
- 0x8a, 0x8c, 0x31, 0xd6, 0x60, 0xd5, 0xe4, 0x8f, 0xdb, 0xfa, 0x3c, 0xc6,
- 0xd5, 0x98, 0x28, 0xf8, 0x1c, 0x8f, 0x17, 0x91, 0x34, 0xcb, 0xcb, 0x52,
- 0x7a, 0xd1, 0xfb, 0x3a, 0x20, 0xe4, 0xe1, 0x86, 0xb1, 0xd8, 0x18, 0x0f,
- 0xbe, 0xd6, 0x87, 0x64, 0x8d, 0xc5, 0x0a, 0x25, 0x42, 0x51, 0xef, 0xb2,
- 0x38, 0xb8, 0xe0, 0x1d, 0xd0, 0xe1, 0xfc, 0xe6, 0xf4, 0xaf, 0x46, 0xba,
- 0xef, 0xc0, 0xbf, 0xc5, 0xb4, 0x05, 0xf5, 0x94, 0x75, 0x0c, 0xfe, 0xa2,
- 0xbe, 0x02, 0xba, 0xea, 0x86, 0x5b, 0xf9, 0x35, 0xb3, 0x66, 0xf5, 0xc5,
- 0x8d, 0x85, 0xa1, 0x1a, 0x23, 0x77, 0x1a, 0x19, 0x17, 0x54, 0x13, 0x60,
- 0x9f, 0x0b, 0xe1, 0xb4, 0x9c, 0x28, 0x2a, 0xf9, 0xae, 0x02, 0x34, 0x6d,
- 0x25, 0x93, 0x9c, 0x82, 0xa8, 0x17, 0x7b, 0xf1, 0x85, 0xb0, 0xd3, 0x0f,
- 0x58, 0xe1, 0xfb, 0xb1, 0xfe, 0x9c, 0xa1, 0xa3, 0xe8, 0xfd, 0xc9, 0x3f,
- 0xf4, 0xd7, 0x71, 0xdc, 0xbd, 0x8c, 0xa4, 0x19, 0xe0, 0x21, 0x23, 0x23,
- 0x55, 0x13, 0x8f, 0xa4, 0x16, 0x02, 0x09, 0x7e, 0xb9, 0xaf, 0xee, 0xdb,
- 0x53, 0x64, 0xbd, 0x71, 0x2f, 0xb9, 0x39, 0xce, 0x30, 0xb7, 0xb4, 0xbc,
- 0x54, 0xe0, 0x47, 0x07,
+ 0x30, 0x82, 0x03, 0xf0, 0x30, 0x82, 0x02, 0xd8, 0xa0, 0x03, 0x02, 0x01,
+ 0x02, 0x02, 0x03, 0x02, 0x3a, 0x76, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
+ 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x42, 0x31,
+ 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53,
+ 0x31, 0x16, 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0d, 0x47,
+ 0x65, 0x6f, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x49, 0x6e, 0x63, 0x2e,
+ 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x12, 0x47,
+ 0x65, 0x6f, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x47, 0x6c, 0x6f, 0x62,
+ 0x61, 0x6c, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x33, 0x30,
+ 0x34, 0x30, 0x35, 0x31, 0x35, 0x31, 0x35, 0x35, 0x35, 0x5a, 0x17, 0x0d,
+ 0x31, 0x36, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39,
+ 0x5a, 0x30, 0x49, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
+ 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04,
+ 0x0a, 0x13, 0x0a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e,
+ 0x63, 0x31, 0x25, 0x30, 0x23, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1c,
+ 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x74, 0x65, 0x72,
+ 0x6e, 0x65, 0x74, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74,
+ 0x79, 0x20, 0x47, 0x32, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09,
+ 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03,
+ 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01,
+ 0x00, 0x9c, 0x2a, 0x04, 0x77, 0x5c, 0xd8, 0x50, 0x91, 0x3a, 0x06, 0xa3,
+ 0x82, 0xe0, 0xd8, 0x50, 0x48, 0xbc, 0x89, 0x3f, 0xf1, 0x19, 0x70, 0x1a,
+ 0x88, 0x46, 0x7e, 0xe0, 0x8f, 0xc5, 0xf1, 0x89, 0xce, 0x21, 0xee, 0x5a,
+ 0xfe, 0x61, 0x0d, 0xb7, 0x32, 0x44, 0x89, 0xa0, 0x74, 0x0b, 0x53, 0x4f,
+ 0x55, 0xa4, 0xce, 0x82, 0x62, 0x95, 0xee, 0xeb, 0x59, 0x5f, 0xc6, 0xe1,
+ 0x05, 0x80, 0x12, 0xc4, 0x5e, 0x94, 0x3f, 0xbc, 0x5b, 0x48, 0x38, 0xf4,
+ 0x53, 0xf7, 0x24, 0xe6, 0xfb, 0x91, 0xe9, 0x15, 0xc4, 0xcf, 0xf4, 0x53,
+ 0x0d, 0xf4, 0x4a, 0xfc, 0x9f, 0x54, 0xde, 0x7d, 0xbe, 0xa0, 0x6b, 0x6f,
+ 0x87, 0xc0, 0xd0, 0x50, 0x1f, 0x28, 0x30, 0x03, 0x40, 0xda, 0x08, 0x73,
+ 0x51, 0x6c, 0x7f, 0xff, 0x3a, 0x3c, 0xa7, 0x37, 0x06, 0x8e, 0xbd, 0x4b,
+ 0x11, 0x04, 0xeb, 0x7d, 0x24, 0xde, 0xe6, 0xf9, 0xfc, 0x31, 0x71, 0xfb,
+ 0x94, 0xd5, 0x60, 0xf3, 0x2e, 0x4a, 0xaf, 0x42, 0xd2, 0xcb, 0xea, 0xc4,
+ 0x6a, 0x1a, 0xb2, 0xcc, 0x53, 0xdd, 0x15, 0x4b, 0x8b, 0x1f, 0xc8, 0x19,
+ 0x61, 0x1f, 0xcd, 0x9d, 0xa8, 0x3e, 0x63, 0x2b, 0x84, 0x35, 0x69, 0x65,
+ 0x84, 0xc8, 0x19, 0xc5, 0x46, 0x22, 0xf8, 0x53, 0x95, 0xbe, 0xe3, 0x80,
+ 0x4a, 0x10, 0xc6, 0x2a, 0xec, 0xba, 0x97, 0x20, 0x11, 0xc7, 0x39, 0x99,
+ 0x10, 0x04, 0xa0, 0xf0, 0x61, 0x7a, 0x95, 0x25, 0x8c, 0x4e, 0x52, 0x75,
+ 0xe2, 0xb6, 0xed, 0x08, 0xca, 0x14, 0xfc, 0xce, 0x22, 0x6a, 0xb3, 0x4e,
+ 0xcf, 0x46, 0x03, 0x97, 0x97, 0x03, 0x7e, 0xc0, 0xb1, 0xde, 0x7b, 0xaf,
+ 0x45, 0x33, 0xcf, 0xba, 0x3e, 0x71, 0xb7, 0xde, 0xf4, 0x25, 0x25, 0xc2,
+ 0x0d, 0x35, 0x89, 0x9d, 0x9d, 0xfb, 0x0e, 0x11, 0x79, 0x89, 0x1e, 0x37,
+ 0xc5, 0xaf, 0x8e, 0x72, 0x69, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81,
+ 0xe7, 0x30, 0x81, 0xe4, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04,
+ 0x18, 0x30, 0x16, 0x80, 0x14, 0xc0, 0x7a, 0x98, 0x68, 0x8d, 0x89, 0xfb,
+ 0xab, 0x05, 0x64, 0x0c, 0x11, 0x7d, 0xaa, 0x7d, 0x65, 0xb8, 0xca, 0xcc,
+ 0x4e, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14,
+ 0x4a, 0xdd, 0x06, 0x16, 0x1b, 0xbc, 0xf6, 0x68, 0xb5, 0x76, 0xf5, 0x81,
+ 0xb6, 0xbb, 0x62, 0x1a, 0xba, 0x5a, 0x81, 0x2f, 0x30, 0x12, 0x06, 0x03,
+ 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01,
+ 0xff, 0x02, 0x01, 0x00, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01,
+ 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x35, 0x06, 0x03,
+ 0x55, 0x1d, 0x1f, 0x04, 0x2e, 0x30, 0x2c, 0x30, 0x2a, 0xa0, 0x28, 0xa0,
+ 0x26, 0x86, 0x24, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x67, 0x2e,
+ 0x73, 0x79, 0x6d, 0x63, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x72,
+ 0x6c, 0x73, 0x2f, 0x67, 0x74, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x2e,
+ 0x63, 0x72, 0x6c, 0x30, 0x2e, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05,
+ 0x07, 0x01, 0x01, 0x04, 0x22, 0x30, 0x20, 0x30, 0x1e, 0x06, 0x08, 0x2b,
+ 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x86, 0x12, 0x68, 0x74, 0x74,
+ 0x70, 0x3a, 0x2f, 0x2f, 0x67, 0x2e, 0x73, 0x79, 0x6d, 0x63, 0x64, 0x2e,
+ 0x63, 0x6f, 0x6d, 0x30, 0x17, 0x06, 0x03, 0x55, 0x1d, 0x20, 0x04, 0x10,
+ 0x30, 0x0e, 0x30, 0x0c, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xd6,
+ 0x79, 0x02, 0x05, 0x01, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
+ 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00,
+ 0x27, 0x8c, 0xcf, 0xe9, 0xc7, 0x3b, 0xbe, 0xc0, 0x6f, 0xe8, 0x96, 0x84,
+ 0xfb, 0x9c, 0x5c, 0x5d, 0x90, 0xe4, 0x77, 0xdb, 0x8b, 0x32, 0x60, 0x9b,
+ 0x65, 0xd8, 0x85, 0x26, 0xb5, 0xba, 0x9f, 0x1e, 0xde, 0x64, 0x4e, 0x1f,
+ 0xc6, 0xc8, 0x20, 0x5b, 0x09, 0x9f, 0xab, 0xa9, 0xe0, 0x09, 0x34, 0x45,
+ 0xa2, 0x65, 0x25, 0x37, 0x3d, 0x7f, 0x5a, 0x6f, 0x20, 0xcc, 0xf9, 0xfa,
+ 0xf1, 0x1d, 0x8f, 0x10, 0x0c, 0x02, 0x3a, 0xc4, 0xc9, 0x01, 0x76, 0x96,
+ 0xbe, 0x9b, 0xf9, 0x15, 0xd8, 0x39, 0xd1, 0xc5, 0x03, 0x47, 0x76, 0xb8,
+ 0x8a, 0x8c, 0x31, 0xd6, 0x60, 0xd5, 0xe4, 0x8f, 0xdb, 0xfa, 0x3c, 0xc6,
+ 0xd5, 0x98, 0x28, 0xf8, 0x1c, 0x8f, 0x17, 0x91, 0x34, 0xcb, 0xcb, 0x52,
+ 0x7a, 0xd1, 0xfb, 0x3a, 0x20, 0xe4, 0xe1, 0x86, 0xb1, 0xd8, 0x18, 0x0f,
+ 0xbe, 0xd6, 0x87, 0x64, 0x8d, 0xc5, 0x0a, 0x25, 0x42, 0x51, 0xef, 0xb2,
+ 0x38, 0xb8, 0xe0, 0x1d, 0xd0, 0xe1, 0xfc, 0xe6, 0xf4, 0xaf, 0x46, 0xba,
+ 0xef, 0xc0, 0xbf, 0xc5, 0xb4, 0x05, 0xf5, 0x94, 0x75, 0x0c, 0xfe, 0xa2,
+ 0xbe, 0x02, 0xba, 0xea, 0x86, 0x5b, 0xf9, 0x35, 0xb3, 0x66, 0xf5, 0xc5,
+ 0x8d, 0x85, 0xa1, 0x1a, 0x23, 0x77, 0x1a, 0x19, 0x17, 0x54, 0x13, 0x60,
+ 0x9f, 0x0b, 0xe1, 0xb4, 0x9c, 0x28, 0x2a, 0xf9, 0xae, 0x02, 0x34, 0x6d,
+ 0x25, 0x93, 0x9c, 0x82, 0xa8, 0x17, 0x7b, 0xf1, 0x85, 0xb0, 0xd3, 0x0f,
+ 0x58, 0xe1, 0xfb, 0xb1, 0xfe, 0x9c, 0xa1, 0xa3, 0xe8, 0xfd, 0xc9, 0x3f,
+ 0xf4, 0xd7, 0x71, 0xdc, 0xbd, 0x8c, 0xa4, 0x19, 0xe0, 0x21, 0x23, 0x23,
+ 0x55, 0x13, 0x8f, 0xa4, 0x16, 0x02, 0x09, 0x7e, 0xb9, 0xaf, 0xee, 0xdb,
+ 0x53, 0x64, 0xbd, 0x71, 0x2f, 0xb9, 0x39, 0xce, 0x30, 0xb7, 0xb4, 0xbc,
+ 0x54, 0xe0, 0x47, 0x07,
};
static const unsigned char kGIACertificate2[] = {
0x30, 0x82, 0x03, 0xf0, 0x30, 0x82, 0x02, 0xd8, 0xa0, 0x03, 0x02, 0x01,
diff --git a/net/quic/crypto/crypto_framer.cc b/net/quic/crypto/crypto_framer.cc
index fe76a7f..0b74796 100644
--- a/net/quic/crypto/crypto_framer.cc
+++ b/net/quic/crypto/crypto_framer.cc
@@ -43,9 +43,7 @@ class OneShotVisitor : public CryptoFramerVisitorInterface {
} // namespace
CryptoFramer::CryptoFramer()
- : visitor_(nullptr),
- num_entries_(0),
- values_len_(0) {
+ : visitor_(nullptr), num_entries_(0), values_len_(0) {
Clear();
}
@@ -220,7 +218,7 @@ QuicErrorCode CryptoFramer::Process(StringPiece input) {
values_len_ = 0;
case STATE_READING_TAGS_AND_LENGTHS: {
if (reader.BytesRemaining() <
- num_entries_ * (kQuicTagSize + kCryptoEndOffsetSize)) {
+ num_entries_ * (kQuicTagSize + kCryptoEndOffsetSize)) {
break;
}
@@ -228,8 +226,8 @@ QuicErrorCode CryptoFramer::Process(StringPiece input) {
for (unsigned i = 0; i < num_entries_; ++i) {
QuicTag tag;
reader.ReadUInt32(&tag);
- if (i > 0 && tag <= tags_and_lengths_[i-1].first) {
- if (tag == tags_and_lengths_[i-1].first) {
+ if (i > 0 && tag <= tags_and_lengths_[i - 1].first) {
+ if (tag == tags_and_lengths_[i - 1].first) {
return QUIC_CRYPTO_DUPLICATE_TAG;
}
return QUIC_CRYPTO_TAGS_OUT_OF_ORDER;
diff --git a/net/quic/crypto/crypto_framer_test.cc b/net/quic/crypto/crypto_framer_test.cc
index cdbf548..25af325 100644
--- a/net/quic/crypto/crypto_framer_test.cc
+++ b/net/quic/crypto/crypto_framer_test.cc
@@ -24,7 +24,9 @@ namespace net {
namespace {
-char* AsChars(unsigned char* data) { return reinterpret_cast<char*>(data); }
+char* AsChars(unsigned char* data) {
+ return reinterpret_cast<char*>(data);
+}
} // namespace
@@ -57,33 +59,30 @@ TEST(CryptoFramerTest, ConstructHandshakeMessage) {
message.SetStringPiece(0x1234567A, "lmnopqr");
unsigned char packet[] = {
- // tag
- 0x33, 0x77, 0xAA, 0xFF,
- // num entries
- 0x03, 0x00,
- // padding
- 0x00, 0x00,
- // tag 1
- 0x78, 0x56, 0x34, 0x12,
- // end offset 1
- 0x06, 0x00, 0x00, 0x00,
- // tag 2
- 0x79, 0x56, 0x34, 0x12,
- // end offset 2
- 0x0b, 0x00, 0x00, 0x00,
- // tag 3
- 0x7A, 0x56, 0x34, 0x12,
- // end offset 3
- 0x12, 0x00, 0x00, 0x00,
- // value 1
- 'a', 'b', 'c', 'd',
- 'e', 'f',
- // value 2
- 'g', 'h', 'i', 'j',
- 'k',
- // value 3
- 'l', 'm', 'n', 'o',
- 'p', 'q', 'r',
+ // tag
+ 0x33, 0x77, 0xAA, 0xFF,
+ // num entries
+ 0x03, 0x00,
+ // padding
+ 0x00, 0x00,
+ // tag 1
+ 0x78, 0x56, 0x34, 0x12,
+ // end offset 1
+ 0x06, 0x00, 0x00, 0x00,
+ // tag 2
+ 0x79, 0x56, 0x34, 0x12,
+ // end offset 2
+ 0x0b, 0x00, 0x00, 0x00,
+ // tag 3
+ 0x7A, 0x56, 0x34, 0x12,
+ // end offset 3
+ 0x12, 0x00, 0x00, 0x00,
+ // value 1
+ 'a', 'b', 'c', 'd', 'e', 'f',
+ // value 2
+ 'g', 'h', 'i', 'j', 'k',
+ // value 3
+ 'l', 'm', 'n', 'o', 'p', 'q', 'r',
};
CryptoFramer framer;
@@ -101,26 +100,24 @@ TEST(CryptoFramerTest, ConstructHandshakeMessageWithTwoKeys) {
message.SetStringPiece(0x12345679, "ghijk");
unsigned char packet[] = {
- // tag
- 0x33, 0x77, 0xAA, 0xFF,
- // num entries
- 0x02, 0x00,
- // padding
- 0x00, 0x00,
- // tag 1
- 0x78, 0x56, 0x34, 0x12,
- // end offset 1
- 0x06, 0x00, 0x00, 0x00,
- // tag 2
- 0x79, 0x56, 0x34, 0x12,
- // end offset 2
- 0x0b, 0x00, 0x00, 0x00,
- // value 1
- 'a', 'b', 'c', 'd',
- 'e', 'f',
- // value 2
- 'g', 'h', 'i', 'j',
- 'k',
+ // tag
+ 0x33, 0x77, 0xAA, 0xFF,
+ // num entries
+ 0x02, 0x00,
+ // padding
+ 0x00, 0x00,
+ // tag 1
+ 0x78, 0x56, 0x34, 0x12,
+ // end offset 1
+ 0x06, 0x00, 0x00, 0x00,
+ // tag 2
+ 0x79, 0x56, 0x34, 0x12,
+ // end offset 2
+ 0x0b, 0x00, 0x00, 0x00,
+ // value 1
+ 'a', 'b', 'c', 'd', 'e', 'f',
+ // value 2
+ 'g', 'h', 'i', 'j', 'k',
};
CryptoFramer framer;
@@ -138,16 +135,16 @@ TEST(CryptoFramerTest, ConstructHandshakeMessageZeroLength) {
message.SetStringPiece(0x12345678, "");
unsigned char packet[] = {
- // tag
- 0x33, 0x77, 0xAA, 0xFF,
- // num entries
- 0x01, 0x00,
- // padding
- 0x00, 0x00,
- // tag 1
- 0x78, 0x56, 0x34, 0x12,
- // end offset 1
- 0x00, 0x00, 0x00, 0x00,
+ // tag
+ 0x33, 0x77, 0xAA, 0xFF,
+ // num entries
+ 0x01, 0x00,
+ // padding
+ 0x00, 0x00,
+ // tag 1
+ 0x78, 0x56, 0x34, 0x12,
+ // end offset 1
+ 0x00, 0x00, 0x00, 0x00,
};
CryptoFramer framer;
@@ -178,28 +175,26 @@ TEST(CryptoFramerTest, ConstructHandshakeMessageMinimumSize) {
message.set_minimum_size(64);
unsigned char packet[] = {
- // tag
- 0x33, 0x77, 0xAA, 0xFF,
- // num entries
- 0x02, 0x00,
- // padding
- 0x00, 0x00,
- // tag 1
- 'P', 'A', 'D', 0,
- // end offset 1
- 0x24, 0x00, 0x00, 0x00,
- // tag 2
- 0x04, 0x03, 0x02, 0x01,
- // end offset 2
- 0x28, 0x00, 0x00, 0x00,
- // 36 bytes of padding.
- '-', '-', '-', '-', '-', '-', '-', '-',
- '-', '-', '-', '-', '-', '-', '-', '-',
- '-', '-', '-', '-', '-', '-', '-', '-',
- '-', '-', '-', '-', '-', '-', '-', '-',
- '-', '-', '-', '-',
- // value 2
- 't', 'e', 's', 't',
+ // tag
+ 0x33, 0x77, 0xAA, 0xFF,
+ // num entries
+ 0x02, 0x00,
+ // padding
+ 0x00, 0x00,
+ // tag 1
+ 'P', 'A', 'D', 0,
+ // end offset 1
+ 0x24, 0x00, 0x00, 0x00,
+ // tag 2
+ 0x04, 0x03, 0x02, 0x01,
+ // end offset 2
+ 0x28, 0x00, 0x00, 0x00,
+ // 36 bytes of padding.
+ '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-',
+ '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-',
+ '-', '-', '-', '-', '-', '-',
+ // value 2
+ 't', 'e', 's', 't',
};
CryptoFramer framer;
@@ -218,26 +213,24 @@ TEST(CryptoFramerTest, ConstructHandshakeMessageMinimumSizePadLast) {
message.set_minimum_size(64);
unsigned char packet[] = {
- // tag
- 0x33, 0x77, 0xAA, 0xFF,
- // num entries
- 0x02, 0x00,
- // padding
- 0x00, 0x00,
- // tag 1
- 0x01, 0x00, 0x00, 0x00,
- // end offset 1
- 0x00, 0x00, 0x00, 0x00,
- // tag 2
- 'P', 'A', 'D', 0,
- // end offset 2
- 0x28, 0x00, 0x00, 0x00,
- // 40 bytes of padding.
- '-', '-', '-', '-', '-', '-', '-', '-',
- '-', '-', '-', '-', '-', '-', '-', '-',
- '-', '-', '-', '-', '-', '-', '-', '-',
- '-', '-', '-', '-', '-', '-', '-', '-',
- '-', '-', '-', '-', '-', '-', '-', '-',
+ // tag
+ 0x33, 0x77, 0xAA, 0xFF,
+ // num entries
+ 0x02, 0x00,
+ // padding
+ 0x00, 0x00,
+ // tag 1
+ 0x01, 0x00, 0x00, 0x00,
+ // end offset 1
+ 0x00, 0x00, 0x00, 0x00,
+ // tag 2
+ 'P', 'A', 'D', 0,
+ // end offset 2
+ 0x28, 0x00, 0x00, 0x00,
+ // 40 bytes of padding.
+ '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-',
+ '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-',
+ '-', '-', '-', '-', '-', '-', '-', '-', '-', '-',
};
CryptoFramer framer;
@@ -255,26 +248,24 @@ TEST(CryptoFramerTest, ProcessInput) {
framer.set_visitor(&visitor);
unsigned char input[] = {
- // tag
- 0x33, 0x77, 0xAA, 0xFF,
- // num entries
- 0x02, 0x00,
- // padding
- 0x00, 0x00,
- // tag 1
- 0x78, 0x56, 0x34, 0x12,
- // end offset 1
- 0x06, 0x00, 0x00, 0x00,
- // tag 2
- 0x79, 0x56, 0x34, 0x12,
- // end offset 2
- 0x0b, 0x00, 0x00, 0x00,
- // value 1
- 'a', 'b', 'c', 'd',
- 'e', 'f',
- // value 2
- 'g', 'h', 'i', 'j',
- 'k',
+ // tag
+ 0x33, 0x77, 0xAA, 0xFF,
+ // num entries
+ 0x02, 0x00,
+ // padding
+ 0x00, 0x00,
+ // tag 1
+ 0x78, 0x56, 0x34, 0x12,
+ // end offset 1
+ 0x06, 0x00, 0x00, 0x00,
+ // tag 2
+ 0x79, 0x56, 0x34, 0x12,
+ // end offset 2
+ 0x0b, 0x00, 0x00, 0x00,
+ // value 1
+ 'a', 'b', 'c', 'd', 'e', 'f',
+ // value 2
+ 'g', 'h', 'i', 'j', 'k',
};
EXPECT_TRUE(
@@ -295,33 +286,30 @@ TEST(CryptoFramerTest, ProcessInputWithThreeKeys) {
framer.set_visitor(&visitor);
unsigned char input[] = {
- // tag
- 0x33, 0x77, 0xAA, 0xFF,
- // num entries
- 0x03, 0x00,
- // padding
- 0x00, 0x00,
- // tag 1
- 0x78, 0x56, 0x34, 0x12,
- // end offset 1
- 0x06, 0x00, 0x00, 0x00,
- // tag 2
- 0x79, 0x56, 0x34, 0x12,
- // end offset 2
- 0x0b, 0x00, 0x00, 0x00,
- // tag 3
- 0x7A, 0x56, 0x34, 0x12,
- // end offset 3
- 0x12, 0x00, 0x00, 0x00,
- // value 1
- 'a', 'b', 'c', 'd',
- 'e', 'f',
- // value 2
- 'g', 'h', 'i', 'j',
- 'k',
- // value 3
- 'l', 'm', 'n', 'o',
- 'p', 'q', 'r',
+ // tag
+ 0x33, 0x77, 0xAA, 0xFF,
+ // num entries
+ 0x03, 0x00,
+ // padding
+ 0x00, 0x00,
+ // tag 1
+ 0x78, 0x56, 0x34, 0x12,
+ // end offset 1
+ 0x06, 0x00, 0x00, 0x00,
+ // tag 2
+ 0x79, 0x56, 0x34, 0x12,
+ // end offset 2
+ 0x0b, 0x00, 0x00, 0x00,
+ // tag 3
+ 0x7A, 0x56, 0x34, 0x12,
+ // end offset 3
+ 0x12, 0x00, 0x00, 0x00,
+ // value 1
+ 'a', 'b', 'c', 'd', 'e', 'f',
+ // value 2
+ 'g', 'h', 'i', 'j', 'k',
+ // value 3
+ 'l', 'm', 'n', 'o', 'p', 'q', 'r',
};
EXPECT_TRUE(
@@ -343,26 +331,24 @@ TEST(CryptoFramerTest, ProcessInputIncrementally) {
framer.set_visitor(&visitor);
unsigned char input[] = {
- // tag
- 0x33, 0x77, 0xAA, 0xFF,
- // num entries
- 0x02, 0x00,
- // padding
- 0x00, 0x00,
- // tag 1
- 0x78, 0x56, 0x34, 0x12,
- // end offset 1
- 0x06, 0x00, 0x00, 0x00,
- // tag 2
- 0x79, 0x56, 0x34, 0x12,
- // end offset 2
- 0x0b, 0x00, 0x00, 0x00,
- // value 1
- 'a', 'b', 'c', 'd',
- 'e', 'f',
- // value 2
- 'g', 'h', 'i', 'j',
- 'k',
+ // tag
+ 0x33, 0x77, 0xAA, 0xFF,
+ // num entries
+ 0x02, 0x00,
+ // padding
+ 0x00, 0x00,
+ // tag 1
+ 0x78, 0x56, 0x34, 0x12,
+ // end offset 1
+ 0x06, 0x00, 0x00, 0x00,
+ // tag 2
+ 0x79, 0x56, 0x34, 0x12,
+ // end offset 2
+ 0x0b, 0x00, 0x00, 0x00,
+ // value 1
+ 'a', 'b', 'c', 'd', 'e', 'f',
+ // value 2
+ 'g', 'h', 'i', 'j', 'k',
};
for (size_t i = 0; i < arraysize(input); i++) {
@@ -383,20 +369,20 @@ TEST(CryptoFramerTest, ProcessInputTagsOutOfOrder) {
framer.set_visitor(&visitor);
unsigned char input[] = {
- // tag
- 0x33, 0x77, 0xAA, 0xFF,
- // num entries
- 0x02, 0x00,
- // padding
- 0x00, 0x00,
- // tag 1
- 0x78, 0x56, 0x34, 0x13,
- // end offset 1
- 0x01, 0x00, 0x00, 0x00,
- // tag 2
- 0x79, 0x56, 0x34, 0x12,
- // end offset 2
- 0x02, 0x00, 0x00, 0x00,
+ // tag
+ 0x33, 0x77, 0xAA, 0xFF,
+ // num entries
+ 0x02, 0x00,
+ // padding
+ 0x00, 0x00,
+ // tag 1
+ 0x78, 0x56, 0x34, 0x13,
+ // end offset 1
+ 0x01, 0x00, 0x00, 0x00,
+ // tag 2
+ 0x79, 0x56, 0x34, 0x12,
+ // end offset 2
+ 0x02, 0x00, 0x00, 0x00,
};
EXPECT_FALSE(
@@ -411,20 +397,20 @@ TEST(CryptoFramerTest, ProcessEndOffsetsOutOfOrder) {
framer.set_visitor(&visitor);
unsigned char input[] = {
- // tag
- 0x33, 0x77, 0xAA, 0xFF,
- // num entries
- 0x02, 0x00,
- // padding
- 0x00, 0x00,
- // tag 1
- 0x79, 0x56, 0x34, 0x12,
- // end offset 1
- 0x01, 0x00, 0x00, 0x00,
- // tag 2
- 0x78, 0x56, 0x34, 0x13,
- // end offset 2
- 0x00, 0x00, 0x00, 0x00,
+ // tag
+ 0x33, 0x77, 0xAA, 0xFF,
+ // num entries
+ 0x02, 0x00,
+ // padding
+ 0x00, 0x00,
+ // tag 1
+ 0x79, 0x56, 0x34, 0x12,
+ // end offset 1
+ 0x01, 0x00, 0x00, 0x00,
+ // tag 2
+ 0x78, 0x56, 0x34, 0x13,
+ // end offset 2
+ 0x00, 0x00, 0x00, 0x00,
};
EXPECT_FALSE(
@@ -439,12 +425,12 @@ TEST(CryptoFramerTest, ProcessInputTooManyEntries) {
framer.set_visitor(&visitor);
unsigned char input[] = {
- // tag
- 0x33, 0x77, 0xAA, 0xFF,
- // num entries
- 0xA0, 0x00,
- // padding
- 0x00, 0x00,
+ // tag
+ 0x33, 0x77, 0xAA, 0xFF,
+ // num entries
+ 0xA0, 0x00,
+ // padding
+ 0x00, 0x00,
};
EXPECT_FALSE(
@@ -459,20 +445,20 @@ TEST(CryptoFramerTest, ProcessInputZeroLength) {
framer.set_visitor(&visitor);
unsigned char input[] = {
- // tag
- 0x33, 0x77, 0xAA, 0xFF,
- // num entries
- 0x02, 0x00,
- // padding
- 0x00, 0x00,
- // tag 1
- 0x78, 0x56, 0x34, 0x12,
- // end offset 1
- 0x00, 0x00, 0x00, 0x00,
- // tag 2
- 0x79, 0x56, 0x34, 0x12,
- // end offset 2
- 0x05, 0x00, 0x00, 0x00,
+ // tag
+ 0x33, 0x77, 0xAA, 0xFF,
+ // num entries
+ 0x02, 0x00,
+ // padding
+ 0x00, 0x00,
+ // tag 1
+ 0x78, 0x56, 0x34, 0x12,
+ // end offset 1
+ 0x00, 0x00, 0x00, 0x00,
+ // tag 2
+ 0x79, 0x56, 0x34, 0x12,
+ // end offset 2
+ 0x05, 0x00, 0x00, 0x00,
};
EXPECT_TRUE(
diff --git a/net/quic/crypto/crypto_handshake.cc b/net/quic/crypto/crypto_handshake.cc
index 26e69bc..afe5991 100644
--- a/net/quic/crypto/crypto_handshake.cc
+++ b/net/quic/crypto/crypto_handshake.cc
@@ -39,8 +39,7 @@ const char QuicCryptoConfig::kForwardSecureLabel[] =
"QUIC forward secure key expansion";
QuicCryptoConfig::QuicCryptoConfig()
- : common_cert_sets(CommonCertSets::GetInstanceQUIC()) {
-}
+ : common_cert_sets(CommonCertSets::GetInstanceQUIC()) {}
QuicCryptoConfig::~QuicCryptoConfig() {}
diff --git a/net/quic/crypto/crypto_handshake_message.cc b/net/quic/crypto/crypto_handshake_message.cc
index fcbd4e0..7e57d5c 100644
--- a/net/quic/crypto/crypto_handshake_message.cc
+++ b/net/quic/crypto/crypto_handshake_message.cc
@@ -4,8 +4,8 @@
#include "net/quic/crypto/crypto_handshake_message.h"
-#include "base/strings/stringprintf.h"
#include "base/strings/string_number_conversions.h"
+#include "base/strings/stringprintf.h"
#include "net/quic/crypto/crypto_framer.h"
#include "net/quic/crypto/crypto_protocol.h"
#include "net/quic/crypto/crypto_utils.h"
@@ -19,9 +19,7 @@ using std::vector;
namespace net {
-CryptoHandshakeMessage::CryptoHandshakeMessage()
- : tag_(0),
- minimum_size_(0) {}
+CryptoHandshakeMessage::CryptoHandshakeMessage() : tag_(0), minimum_size_(0) {}
CryptoHandshakeMessage::CryptoHandshakeMessage(
const CryptoHandshakeMessage& other)
@@ -177,8 +175,7 @@ QuicErrorCode CryptoHandshakeMessage::GetUint64(QuicTag tag,
}
size_t CryptoHandshakeMessage::size() const {
- size_t ret = sizeof(QuicTag) +
- sizeof(uint16) /* number of entries */ +
+ size_t ret = sizeof(QuicTag) + sizeof(uint16) /* number of entries */ +
sizeof(uint16) /* padding */;
ret += (sizeof(QuicTag) + sizeof(uint32) /* end offset */) *
tag_value_map_.size();
@@ -206,8 +203,9 @@ string CryptoHandshakeMessage::DebugString() const {
return DebugStringInternal(0);
}
-QuicErrorCode CryptoHandshakeMessage::GetPOD(
- QuicTag tag, void* out, size_t len) const {
+QuicErrorCode CryptoHandshakeMessage::GetPOD(QuicTag tag,
+ void* out,
+ size_t len) const {
QuicTagValueMap::const_iterator it = tag_value_map_.find(tag);
QuicErrorCode ret = QUIC_NO_ERROR;
diff --git a/net/quic/crypto/crypto_handshake_message.h b/net/quic/crypto/crypto_handshake_message.h
index 7b68659..02af063 100644
--- a/net/quic/crypto/crypto_handshake_message.h
+++ b/net/quic/crypto/crypto_handshake_message.h
@@ -37,14 +37,16 @@ class NET_EXPORT_PRIVATE CryptoHandshakeMessage {
// SetValue sets an element with the given tag to the raw, memory contents of
// |v|.
- template<class T> void SetValue(QuicTag tag, const T& v) {
+ template <class T>
+ void SetValue(QuicTag tag, const T& v) {
tag_value_map_[tag] =
std::string(reinterpret_cast<const char*>(&v), sizeof(v));
}
// SetVector sets an element with the given tag to the raw contents of an
// array of elements in |v|.
- template<class T> void SetVector(QuicTag tag, const std::vector<T>& v) {
+ template <class T>
+ void SetVector(QuicTag tag, const std::vector<T>& v) {
if (v.empty()) {
tag_value_map_[tag] = std::string();
} else {
@@ -74,7 +76,8 @@ class NET_EXPORT_PRIVATE CryptoHandshakeMessage {
// |out_tags| and |out_len| to point to the array of tags and returns true.
// The array points into the CryptoHandshakeMessage and is valid only for as
// long as the CryptoHandshakeMessage exists and is not modified.
- QuicErrorCode GetTaglist(QuicTag tag, const QuicTag** out_tags,
+ QuicErrorCode GetTaglist(QuicTag tag,
+ const QuicTag** out_tags,
size_t* out_len) const;
bool GetStringPiece(QuicTag tag, base::StringPiece* out) const;
diff --git a/net/quic/crypto/crypto_protocol.h b/net/quic/crypto/crypto_protocol.h
index 6c68886..b4017ed 100644
--- a/net/quic/crypto/crypto_protocol.h
+++ b/net/quic/crypto/crypto_protocol.h
@@ -20,7 +20,7 @@
// We use a macro to ensure that no static initialisers are created. Use the
// MakeQuicTag function in normal code.
#define TAG(a, b, c, d) \
- static_cast<QuicTag>((d << 24) + (c << 16) + (b << 8) + a)
+ static_cast<QuicTag>((d << 24) + (c << 16) + (b << 8) + a)
namespace net {
@@ -187,12 +187,10 @@ const QuicTag kFIXD = TAG('F', 'I', 'X', 'D'); // Client hello
// message because the server mightn't hold state for a rejected client hello
// and therefore the client may have issues reassembling the rejection message
// in the event that it sent two client hellos.
-const QuicTag kServerNonceTag =
- TAG('S', 'N', 'O', 0); // The server's nonce
+const QuicTag kServerNonceTag = TAG('S', 'N', 'O', 0); // The server's nonce
const QuicTag kSourceAddressTokenTag =
TAG('S', 'T', 'K', 0); // Source-address token
-const QuicTag kCertificateTag =
- TAG('C', 'R', 'T', 255); // Certificate chain
+const QuicTag kCertificateTag = TAG('C', 'R', 'T', 255); // Certificate chain
const QuicTag kCertificateSCTTag =
TAG('C', 'S', 'C', 'T'); // Signed cert timestamp (RFC6962) of leaf cert.
diff --git a/net/quic/crypto/crypto_secret_boxer.cc b/net/quic/crypto/crypto_secret_boxer.cc
index 4e95442..6a7eecb 100644
--- a/net/quic/crypto/crypto_secret_boxer.cc
+++ b/net/quic/crypto/crypto_secret_boxer.cc
@@ -35,7 +35,9 @@ static const size_t kKeySize = 16;
static const size_t kBoxNonceSize = 12;
// static
-size_t CryptoSecretBoxer::GetKeySize() { return kKeySize; }
+size_t CryptoSecretBoxer::GetKeySize() {
+ return kKeySize;
+}
void CryptoSecretBoxer::SetKey(StringPiece key) {
DCHECK_EQ(kKeySize, key.size());
@@ -59,9 +61,9 @@ string CryptoSecretBoxer::Box(QuicRandom* rand, StringPiece plaintext) const {
rand->RandBytes(data, kBoxNonceSize);
memcpy(data + kBoxNonceSize, plaintext.data(), plaintext.size());
- if (!encrypter->Encrypt(StringPiece(data, kBoxNonceSize), StringPiece(),
- plaintext, reinterpret_cast<unsigned char*>(
- data + kBoxNonceSize))) {
+ if (!encrypter->Encrypt(
+ StringPiece(data, kBoxNonceSize), StringPiece(), plaintext,
+ reinterpret_cast<unsigned char*>(data + kBoxNonceSize))) {
DLOG(DFATAL) << "CryptoSecretBoxer's Encrypt failed.";
return string();
}
diff --git a/net/quic/crypto/crypto_secret_boxer_test.cc b/net/quic/crypto/crypto_secret_boxer_test.cc
index 427d052..79c3f81 100644
--- a/net/quic/crypto/crypto_secret_boxer_test.cc
+++ b/net/quic/crypto/crypto_secret_boxer_test.cc
@@ -33,8 +33,9 @@ TEST(CryptoSecretBoxerTest, BoxAndUnbox) {
EXPECT_FALSE(boxer.Unbox(string(1, 'X') + box, &storage, &result));
EXPECT_FALSE(boxer.Unbox(box.substr(1, string::npos), &storage, &result));
EXPECT_FALSE(boxer.Unbox(string(), &storage, &result));
- EXPECT_FALSE(boxer.Unbox(string(1, box[0]^0x80) + box.substr(1, string::npos),
- &storage, &result));
+ EXPECT_FALSE(
+ boxer.Unbox(string(1, box[0] ^ 0x80) + box.substr(1, string::npos),
+ &storage, &result));
}
} // namespace test
diff --git a/net/quic/crypto/crypto_server_config_protobuf.cc b/net/quic/crypto/crypto_server_config_protobuf.cc
index d292f9e9..e574faa 100644
--- a/net/quic/crypto/crypto_server_config_protobuf.cc
+++ b/net/quic/crypto/crypto_server_config_protobuf.cc
@@ -10,9 +10,7 @@
namespace net {
QuicServerConfigProtobuf::QuicServerConfigProtobuf()
- : primary_time_(QuicWallTime::Zero().ToUNIXSeconds()),
- priority_(0) {
-}
+ : primary_time_(QuicWallTime::Zero().ToUNIXSeconds()), priority_(0) {}
QuicServerConfigProtobuf::~QuicServerConfigProtobuf() {
STLDeleteElements(&keys_);
diff --git a/net/quic/crypto/crypto_server_config_protobuf.h b/net/quic/crypto/crypto_server_config_protobuf.h
index fca5f0a..5a98c2c 100644
--- a/net/quic/crypto/crypto_server_config_protobuf.h
+++ b/net/quic/crypto/crypto_server_config_protobuf.h
@@ -26,15 +26,9 @@ class NET_EXPORT_PRIVATE QuicServerConfigProtobuf {
// private key is specific to the algorithm in question.
class NET_EXPORT_PRIVATE PrivateKey {
public:
- QuicTag tag() const {
- return tag_;
- }
- void set_tag(QuicTag tag) {
- tag_ = tag;
- }
- std::string private_key() const {
- return private_key_;
- }
+ QuicTag tag() const { return tag_; }
+ void set_tag(QuicTag tag) { tag_ = tag; }
+ std::string private_key() const { return private_key_; }
void set_private_key(const std::string& key) { private_key_ = key; }
private:
@@ -45,55 +39,35 @@ class NET_EXPORT_PRIVATE QuicServerConfigProtobuf {
QuicServerConfigProtobuf();
~QuicServerConfigProtobuf();
- size_t key_size() const {
- return keys_.size();
- }
+ size_t key_size() const { return keys_.size(); }
const PrivateKey& key(size_t i) const {
DCHECK_GT(keys_.size(), i);
return *keys_[i];
}
- std::string config() const {
- return config_;
- }
+ std::string config() const { return config_; }
- void set_config(base::StringPiece config) {
- config.CopyToString(&config_);
- }
+ void set_config(base::StringPiece config) { config.CopyToString(&config_); }
QuicServerConfigProtobuf::PrivateKey* add_key() {
keys_.push_back(new PrivateKey);
return keys_.back();
}
- void clear_key() {
- STLDeleteElements(&keys_);
- }
+ void clear_key() { STLDeleteElements(&keys_); }
- bool has_primary_time() const {
- return primary_time_ > 0;
- }
+ bool has_primary_time() const { return primary_time_ > 0; }
- int64 primary_time() const {
- return primary_time_;
- }
+ int64 primary_time() const { return primary_time_; }
- void set_primary_time(int64 primary_time) {
- primary_time_ = primary_time;
- }
+ void set_primary_time(int64 primary_time) { primary_time_ = primary_time; }
- bool has_priority() const {
- return priority_ > 0;
- }
+ bool has_priority() const { return priority_ > 0; }
- uint64 priority() const {
- return priority_;
- }
+ uint64 priority() const { return priority_; }
- void set_priority(int64 priority) {
- priority_ = priority;
- }
+ void set_priority(int64 priority) { priority_ = priority; }
bool has_source_address_token_secret_override() const {
return !source_address_token_secret_override_.empty();
diff --git a/net/quic/crypto/crypto_utils.cc b/net/quic/crypto/crypto_utils.cc
index 8d5d4b4..ae8c319 100644
--- a/net/quic/crypto/crypto_utils.cc
+++ b/net/quic/crypto/crypto_utils.cc
@@ -58,8 +58,8 @@ bool CryptoUtils::IsValidSNI(StringPiece sni) {
url::CanonHostInfo host_info;
string canonicalized_host(CanonicalizeHost(sni.as_string(), &host_info));
return !host_info.IsIPAddress() &&
- IsCanonicalizedHostCompliant(canonicalized_host) &&
- sni.find_last_of('.') != string::npos;
+ IsCanonicalizedHostCompliant(canonicalized_host) &&
+ sni.find_last_of('.') != string::npos;
}
// static
@@ -150,12 +150,8 @@ bool CryptoUtils::ExportKeyingMaterial(StringPiece subkey_secret,
info.append(reinterpret_cast<char*>(&context_length), sizeof(context_length));
info.append(context.data(), context.length());
- crypto::HKDF hkdf(subkey_secret,
- StringPiece() /* no salt */,
- info,
- result_len,
- 0 /* no fixed IV */,
- 0 /* no subkey secret */);
+ crypto::HKDF hkdf(subkey_secret, StringPiece() /* no salt */, info,
+ result_len, 0 /* no fixed IV */, 0 /* no subkey secret */);
hkdf.client_write_key().CopyToString(result);
return true;
}
diff --git a/net/quic/crypto/crypto_utils_test.cc b/net/quic/crypto/crypto_utils_test.cc
index 0bfd649..c8be700 100644
--- a/net/quic/crypto/crypto_utils_test.cc
+++ b/net/quic/crypto/crypto_utils_test.cc
@@ -33,12 +33,24 @@ TEST(CryptoUtilsTest, NormalizeHostname) {
struct {
const char *input, *expected;
} tests[] = {
- { "www.google.com", "www.google.com", },
- { "WWW.GOOGLE.COM", "www.google.com", },
- { "www.google.com.", "www.google.com", },
- { "www.google.COM.", "www.google.com", },
- { "www.google.com..", "www.google.com", },
- { "www.google.com........", "www.google.com", },
+ {
+ "www.google.com", "www.google.com",
+ },
+ {
+ "WWW.GOOGLE.COM", "www.google.com",
+ },
+ {
+ "www.google.com.", "www.google.com",
+ },
+ {
+ "www.google.COM.", "www.google.com",
+ },
+ {
+ "www.google.com..", "www.google.com",
+ },
+ {
+ "www.google.com........", "www.google.com",
+ },
};
for (size_t i = 0; i < arraysize(tests); ++i) {
@@ -58,41 +70,24 @@ TEST(CryptoUtilsTest, TestExportKeyingMaterial) {
// Expected output (string of hexadecimal digits):
const char* expected; // Null if it should fail.
} test_vector[] = {
- // Try a typical input
- { "4823c1189ecc40fce888fbb4cf9ae6254f19ba12e6d9af54788f195a6f509ca3",
- "e934f78d7a71dd85420fceeb8cea0317",
- "b8d766b5d3c8aba0009c7ed3de553eba53b4de1030ea91383dcdf724cd8b7217",
- 32,
- "a9979da0d5f1c1387d7cbe68f5c4163ddb445a03c4ad6ee72cb49d56726d679e"
- },
- // Don't let the label contain nulls
- { "14fe51e082ffee7d1b4d8d4ab41f8c55",
- "3132333435363700",
- "58585858585858585858585858585858",
- 16,
- nullptr
- },
- // Make sure nulls in the context are fine
- { "d862c2e36b0a42f7827c67ebc8d44df7",
- "7a5b95e4e8378123",
- "4142434445464700",
- 16,
- "12d418c6d0738a2e4d85b2d0170f76e1"
- },
- // ... and give a different result than without
- { "d862c2e36b0a42f7827c67ebc8d44df7",
- "7a5b95e4e8378123",
- "41424344454647",
- 16,
- "abfa1c479a6e3ffb98a11dee7d196408"
- },
- // Try weird lengths
- { "d0ec8a34f6cc9a8c96",
- "49711798cc6251",
- "933d4a2f30d22f089cfba842791116adc121e0",
- 23,
- "c9a46ed0757bd1812f1f21b4d41e62125fec8364a21db7"
- },
+ // Try a typical input
+ {"4823c1189ecc40fce888fbb4cf9ae6254f19ba12e6d9af54788f195a6f509ca3",
+ "e934f78d7a71dd85420fceeb8cea0317",
+ "b8d766b5d3c8aba0009c7ed3de553eba53b4de1030ea91383dcdf724cd8b7217", 32,
+ "a9979da0d5f1c1387d7cbe68f5c4163ddb445a03c4ad6ee72cb49d56726d679e"},
+ // Don't let the label contain nulls
+ {"14fe51e082ffee7d1b4d8d4ab41f8c55", "3132333435363700",
+ "58585858585858585858585858585858", 16, nullptr},
+ // Make sure nulls in the context are fine
+ {"d862c2e36b0a42f7827c67ebc8d44df7", "7a5b95e4e8378123",
+ "4142434445464700", 16, "12d418c6d0738a2e4d85b2d0170f76e1"},
+ // ... and give a different result than without
+ {"d862c2e36b0a42f7827c67ebc8d44df7", "7a5b95e4e8378123", "41424344454647",
+ 16, "abfa1c479a6e3ffb98a11dee7d196408"},
+ // Try weird lengths
+ {"d0ec8a34f6cc9a8c96", "49711798cc6251",
+ "933d4a2f30d22f089cfba842791116adc121e0", 23,
+ "c9a46ed0757bd1812f1f21b4d41e62125fec8364a21db7"},
};
for (size_t i = 0; i < arraysize(test_vector); i++) {
@@ -111,18 +106,13 @@ TEST(CryptoUtilsTest, TestExportKeyingMaterial) {
}
string result;
- bool ok = CryptoUtils::ExportKeyingMaterial(subkey_secret,
- label,
- context,
- result_len,
- &result);
+ bool ok = CryptoUtils::ExportKeyingMaterial(subkey_secret, label, context,
+ result_len, &result);
EXPECT_EQ(expect_ok, ok);
if (expect_ok) {
EXPECT_EQ(result_len, result.length());
- test::CompareCharArraysWithHexError("HKDF output",
- result.data(),
- result.length(),
- expected.data(),
+ test::CompareCharArraysWithHexError("HKDF output", result.data(),
+ result.length(), expected.data(),
expected.length());
}
}
diff --git a/net/quic/crypto/curve25519_key_exchange.cc b/net/quic/crypto/curve25519_key_exchange.cc
index 2614934..b5cc5bf 100644
--- a/net/quic/crypto/curve25519_key_exchange.cc
+++ b/net/quic/crypto/curve25519_key_exchange.cc
@@ -82,6 +82,8 @@ StringPiece Curve25519KeyExchange::public_value() const {
sizeof(public_key_));
}
-QuicTag Curve25519KeyExchange::tag() const { return kC255; }
+QuicTag Curve25519KeyExchange::tag() const {
+ return kC255;
+}
} // namespace net
diff --git a/net/quic/crypto/local_strike_register_client.cc b/net/quic/crypto/local_strike_register_client.cc
index 71d2224..22fd879 100644
--- a/net/quic/crypto/local_strike_register_client.cc
+++ b/net/quic/crypto/local_strike_register_client.cc
@@ -17,9 +17,11 @@ LocalStrikeRegisterClient::LocalStrikeRegisterClient(
uint32 window_secs,
const uint8 orbit[8],
StrikeRegister::StartupType startup)
- : strike_register_(max_entries, current_time_external, window_secs,
- orbit, startup) {
-}
+ : strike_register_(max_entries,
+ current_time_external,
+ window_secs,
+ orbit,
+ startup) {}
bool LocalStrikeRegisterClient::IsKnownOrbit(StringPiece orbit) const {
base::AutoLock lock(m_);
@@ -38,9 +40,9 @@ void LocalStrikeRegisterClient::VerifyNonceIsValidAndUnique(
nonce_error = NONCE_INVALID_FAILURE;
} else {
base::AutoLock lock(m_);
- nonce_error = strike_register_.Insert(
- reinterpret_cast<const uint8*>(nonce.data()),
- static_cast<uint32>(now.ToUNIXSeconds()));
+ nonce_error =
+ strike_register_.Insert(reinterpret_cast<const uint8*>(nonce.data()),
+ static_cast<uint32>(now.ToUNIXSeconds()));
}
// m_ must not be held when the ResultCallback runs.
diff --git a/net/quic/crypto/local_strike_register_client_test.cc b/net/quic/crypto/local_strike_register_client_test.cc
index 5665cb6..5d8fc5a 100644
--- a/net/quic/crypto/local_strike_register_client_test.cc
+++ b/net/quic/crypto/local_strike_register_client_test.cc
@@ -57,8 +57,7 @@ uint32 kWindowSecs = 60;
class LocalStrikeRegisterClientTest : public ::testing::Test {
protected:
- LocalStrikeRegisterClientTest() {
- }
+ LocalStrikeRegisterClientTest() {}
void SetUp() override {
strike_register_.reset(new LocalStrikeRegisterClient(
@@ -94,8 +93,7 @@ TEST_F(LocalStrikeRegisterClientTest, IncorrectNonceLength) {
InsertStatus nonce_error = NONCE_UNKNOWN_FAILURE;
string short_nonce = valid_nonce.substr(0, valid_nonce.length() - 1);
strike_register_->VerifyNonceIsValidAndUnique(
- short_nonce,
- QuicWallTime::FromUNIXSeconds(kCurrentTimeExternalSecs),
+ short_nonce, QuicWallTime::FromUNIXSeconds(kCurrentTimeExternalSecs),
new RecordResultCallback(&called, &is_valid, &nonce_error));
EXPECT_TRUE(called);
EXPECT_FALSE(is_valid);
@@ -110,8 +108,7 @@ TEST_F(LocalStrikeRegisterClientTest, IncorrectNonceLength) {
string long_nonce(valid_nonce);
long_nonce.append("a");
strike_register_->VerifyNonceIsValidAndUnique(
- long_nonce,
- QuicWallTime::FromUNIXSeconds(kCurrentTimeExternalSecs),
+ long_nonce, QuicWallTime::FromUNIXSeconds(kCurrentTimeExternalSecs),
new RecordResultCallback(&called, &is_valid, &nonce_error));
EXPECT_TRUE(called);
EXPECT_FALSE(is_valid);
@@ -124,8 +121,7 @@ TEST_F(LocalStrikeRegisterClientTest, IncorrectNonceLength) {
bool is_valid = false;
InsertStatus nonce_error = NONCE_UNKNOWN_FAILURE;
strike_register_->VerifyNonceIsValidAndUnique(
- valid_nonce,
- QuicWallTime::FromUNIXSeconds(kCurrentTimeExternalSecs),
+ valid_nonce, QuicWallTime::FromUNIXSeconds(kCurrentTimeExternalSecs),
new RecordResultCallback(&called, &is_valid, &nonce_error));
EXPECT_TRUE(called);
EXPECT_TRUE(is_valid);
diff --git a/net/quic/crypto/null_decrypter.cc b/net/quic/crypto/null_decrypter.cc
index 4fb41a5..e04fc30 100644
--- a/net/quic/crypto/null_decrypter.cc
+++ b/net/quic/crypto/null_decrypter.cc
@@ -6,8 +6,8 @@
#include <stdint.h>
-#include "net/quic/quic_utils.h"
#include "net/quic/quic_data_reader.h"
+#include "net/quic/quic_utils.h"
using base::StringPiece;
using std::string;
@@ -16,7 +16,9 @@ namespace net {
NullDecrypter::NullDecrypter() {}
-bool NullDecrypter::SetKey(StringPiece key) { return key.empty(); }
+bool NullDecrypter::SetKey(StringPiece key) {
+ return key.empty();
+}
bool NullDecrypter::SetNoncePrefix(StringPiece nonce_prefix) {
return nonce_prefix.empty();
@@ -49,9 +51,13 @@ bool NullDecrypter::DecryptPacket(QuicPacketNumber /*packet_number*/,
return true;
}
-StringPiece NullDecrypter::GetKey() const { return StringPiece(); }
+StringPiece NullDecrypter::GetKey() const {
+ return StringPiece();
+}
-StringPiece NullDecrypter::GetNoncePrefix() const { return StringPiece(); }
+StringPiece NullDecrypter::GetNoncePrefix() const {
+ return StringPiece();
+}
const char* NullDecrypter::cipher_name() const {
return "NULL";
@@ -64,8 +70,7 @@ uint32 NullDecrypter::cipher_id() const {
bool NullDecrypter::ReadHash(QuicDataReader* reader, uint128* hash) {
uint64 lo;
uint32 hi;
- if (!reader->ReadUInt64(&lo) ||
- !reader->ReadUInt32(&hi)) {
+ if (!reader->ReadUInt64(&lo) || !reader->ReadUInt32(&hi)) {
return false;
}
*hash = hi;
diff --git a/net/quic/crypto/null_decrypter_test.cc b/net/quic/crypto/null_decrypter_test.cc
index 4c8bae4..4e53375 100644
--- a/net/quic/crypto/null_decrypter_test.cc
+++ b/net/quic/crypto/null_decrypter_test.cc
@@ -10,18 +10,14 @@ using base::StringPiece;
namespace net {
namespace test {
-class NullDecrypterTest : public ::testing::TestWithParam<bool> {
-};
+class NullDecrypterTest : public ::testing::TestWithParam<bool> {};
TEST_F(NullDecrypterTest, Decrypt) {
unsigned char expected[] = {
- // fnv hash
- 0xa0, 0x6f, 0x44, 0x8a,
- 0x44, 0xf8, 0x18, 0x3b,
- 0x47, 0x91, 0xb2, 0x13,
- // payload
- 'g', 'o', 'o', 'd',
- 'b', 'y', 'e', '!',
+ // fnv hash
+ 0xa0, 0x6f, 0x44, 0x8a, 0x44, 0xf8, 0x18, 0x3b, 0x47, 0x91, 0xb2, 0x13,
+ // payload
+ 'g', 'o', 'o', 'd', 'b', 'y', 'e', '!',
};
const char* data = reinterpret_cast<const char*>(expected);
size_t len = arraysize(expected);
@@ -36,13 +32,10 @@ TEST_F(NullDecrypterTest, Decrypt) {
TEST_F(NullDecrypterTest, BadHash) {
unsigned char expected[] = {
- // fnv hash
- 0x46, 0x11, 0xea, 0x5f,
- 0xcf, 0x1d, 0x66, 0x5b,
- 0xba, 0xf0, 0xbc, 0xfd,
- // payload
- 'g', 'o', 'o', 'd',
- 'b', 'y', 'e', '!',
+ // fnv hash
+ 0x46, 0x11, 0xea, 0x5f, 0xcf, 0x1d, 0x66, 0x5b, 0xba, 0xf0, 0xbc, 0xfd,
+ // payload
+ 'g', 'o', 'o', 'd', 'b', 'y', 'e', '!',
};
const char* data = reinterpret_cast<const char*>(expected);
size_t len = arraysize(expected);
@@ -55,10 +48,8 @@ TEST_F(NullDecrypterTest, BadHash) {
TEST_F(NullDecrypterTest, ShortInput) {
unsigned char expected[] = {
- // fnv hash (truncated)
- 0x46, 0x11, 0xea, 0x5f,
- 0xcf, 0x1d, 0x66, 0x5b,
- 0xba, 0xf0, 0xbc,
+ // fnv hash (truncated)
+ 0x46, 0x11, 0xea, 0x5f, 0xcf, 0x1d, 0x66, 0x5b, 0xba, 0xf0, 0xbc,
};
const char* data = reinterpret_cast<const char*>(expected);
size_t len = arraysize(expected);
diff --git a/net/quic/crypto/null_encrypter.cc b/net/quic/crypto/null_encrypter.cc
index 2f70409..470674b 100644
--- a/net/quic/crypto/null_encrypter.cc
+++ b/net/quic/crypto/null_encrypter.cc
@@ -16,7 +16,9 @@ const size_t kHashSizeShort = 12; // size of uint128 serialized short
NullEncrypter::NullEncrypter() {}
-bool NullEncrypter::SetKey(StringPiece key) { return key.empty(); }
+bool NullEncrypter::SetKey(StringPiece key) {
+ return key.empty();
+}
bool NullEncrypter::SetNoncePrefix(StringPiece nonce_prefix) {
return nonce_prefix.empty();
@@ -44,9 +46,13 @@ bool NullEncrypter::EncryptPacket(QuicPacketNumber /*packet_number*/,
return true;
}
-size_t NullEncrypter::GetKeySize() const { return 0; }
+size_t NullEncrypter::GetKeySize() const {
+ return 0;
+}
-size_t NullEncrypter::GetNoncePrefixSize() const { return 0; }
+size_t NullEncrypter::GetNoncePrefixSize() const {
+ return 0;
+}
size_t NullEncrypter::GetMaxPlaintextSize(size_t ciphertext_size) const {
return ciphertext_size - GetHashLength();
@@ -56,9 +62,13 @@ size_t NullEncrypter::GetCiphertextSize(size_t plaintext_size) const {
return plaintext_size + GetHashLength();
}
-StringPiece NullEncrypter::GetKey() const { return StringPiece(); }
+StringPiece NullEncrypter::GetKey() const {
+ return StringPiece();
+}
-StringPiece NullEncrypter::GetNoncePrefix() const { return StringPiece(); }
+StringPiece NullEncrypter::GetNoncePrefix() const {
+ return StringPiece();
+}
size_t NullEncrypter::GetHashLength() const {
return kHashSizeShort;
diff --git a/net/quic/crypto/null_encrypter_test.cc b/net/quic/crypto/null_encrypter_test.cc
index e9ae773..02a2f73 100644
--- a/net/quic/crypto/null_encrypter_test.cc
+++ b/net/quic/crypto/null_encrypter_test.cc
@@ -10,18 +10,14 @@ using base::StringPiece;
namespace net {
namespace test {
-class NullEncrypterTest : public ::testing::TestWithParam<bool> {
-};
+class NullEncrypterTest : public ::testing::TestWithParam<bool> {};
TEST_F(NullEncrypterTest, Encrypt) {
unsigned char expected[] = {
- // fnv hash
- 0xa0, 0x6f, 0x44, 0x8a,
- 0x44, 0xf8, 0x18, 0x3b,
- 0x47, 0x91, 0xb2, 0x13,
- // payload
- 'g', 'o', 'o', 'd',
- 'b', 'y', 'e', '!',
+ // fnv hash
+ 0xa0, 0x6f, 0x44, 0x8a, 0x44, 0xf8, 0x18, 0x3b, 0x47, 0x91, 0xb2, 0x13,
+ // payload
+ 'g', 'o', 'o', 'd', 'b', 'y', 'e', '!',
};
NullEncrypter encrypter;
char encrypted[256];
diff --git a/net/quic/crypto/p256_key_exchange_nss.cc b/net/quic/crypto/p256_key_exchange_nss.cc
index 3296a6f..2568e54 100644
--- a/net/quic/crypto/p256_key_exchange_nss.cc
+++ b/net/quic/crypto/p256_key_exchange_nss.cc
@@ -35,8 +35,7 @@ P256KeyExchange::P256KeyExchange(crypto::ECPrivateKey* key_pair,
memcpy(public_key_, public_key, sizeof(public_key_));
}
-P256KeyExchange::~P256KeyExchange() {
-}
+P256KeyExchange::~P256KeyExchange() {}
// static
P256KeyExchange* P256KeyExchange::New(StringPiece key) {
@@ -46,8 +45,8 @@ P256KeyExchange* P256KeyExchange::New(StringPiece key) {
}
const uint8* data = reinterpret_cast<const uint8*>(key.data());
- size_t size = static_cast<size_t>(data[0]) |
- (static_cast<size_t>(data[1]) << 8);
+ size_t size =
+ static_cast<size_t>(data[0]) | (static_cast<size_t>(data[1]) << 8);
key.remove_prefix(2);
if (key.size() < size) {
DVLOG(1) << "Key pair does not contain key material.";
@@ -96,8 +95,8 @@ P256KeyExchange* P256KeyExchange::New(StringPiece key) {
!public_key->u.ec.DEREncodedParams.data ||
public_key->u.ec.DEREncodedParams.data[0] != SEC_ASN1_OBJECT_ID ||
public_key->u.ec.DEREncodedParams.data[1] != oid_data->oid.len ||
- memcmp(public_key->u.ec.DEREncodedParams.data + 2,
- oid_data->oid.data, oid_data->oid.len) != 0) {
+ memcmp(public_key->u.ec.DEREncodedParams.data + 2, oid_data->oid.data,
+ oid_data->oid.len) != 0) {
DVLOG(1) << "Key is invalid.";
}
@@ -115,8 +114,7 @@ string P256KeyExchange::NewPrivateKey() {
}
vector<uint8> private_key;
- if (!key_pair->ExportEncryptedPrivateKey(kExportPassword,
- 1 /* iteration */,
+ if (!key_pair->ExportEncryptedPrivateKey(kExportPassword, 1 /* iteration */,
&private_key)) {
DVLOG(1) << "Can't export private key.";
return string();
@@ -133,9 +131,8 @@ string P256KeyExchange::NewPrivateKey() {
// TODO(thaidn): determine how large encrypted private key can be
uint16 private_key_size = base::checked_cast<uint16>(private_key.size());
- const size_t result_size = sizeof(private_key_size) +
- private_key_size +
- public_key.size();
+ const size_t result_size =
+ sizeof(private_key_size) + private_key_size + public_key.size();
vector<char> result(result_size);
char* resultp = &result[0];
// Export the key string.
@@ -189,19 +186,11 @@ bool P256KeyExchange::CalculateSharedKey(const StringPiece& peer_public_value,
// |CalculateSharedKey| is the actual ECDH shared key, not any derived keys
// from it.
crypto::ScopedPK11SymKey premaster_secret(
- PK11_PubDeriveWithKDF(
- key_pair_->key(),
- &peer_public_key,
- PR_FALSE,
- nullptr,
- nullptr,
- CKM_ECDH1_DERIVE, /* mechanism */
- CKM_GENERIC_SECRET_KEY_GEN, /* target */
- CKA_DERIVE,
- 0,
- CKD_NULL, /* kdf */
- nullptr,
- nullptr));
+ PK11_PubDeriveWithKDF(key_pair_->key(), &peer_public_key, PR_FALSE,
+ nullptr, nullptr, CKM_ECDH1_DERIVE, /* mechanism */
+ CKM_GENERIC_SECRET_KEY_GEN, /* target */
+ CKA_DERIVE, 0, CKD_NULL, /* kdf */
+ nullptr, nullptr));
if (!premaster_secret.get()) {
DVLOG(1) << "Can't derive ECDH shared key.";
@@ -228,6 +217,8 @@ StringPiece P256KeyExchange::public_value() const {
sizeof(public_key_));
}
-QuicTag P256KeyExchange::tag() const { return kP256; }
+QuicTag P256KeyExchange::tag() const {
+ return kP256;
+}
} // namespace net
diff --git a/net/quic/crypto/p256_key_exchange_openssl.cc b/net/quic/crypto/p256_key_exchange_openssl.cc
index 88d45c8..f5ca063 100644
--- a/net/quic/crypto/p256_key_exchange_openssl.cc
+++ b/net/quic/crypto/p256_key_exchange_openssl.cc
@@ -30,8 +30,8 @@ P256KeyExchange* P256KeyExchange::New(StringPiece key) {
}
const uint8* keyp = reinterpret_cast<const uint8*>(key.data());
- crypto::ScopedEC_KEY private_key(d2i_ECPrivateKey(nullptr, &keyp,
- key.size()));
+ crypto::ScopedEC_KEY private_key(
+ d2i_ECPrivateKey(nullptr, &keyp, key.size()));
if (!private_key.get() || !EC_KEY_check_key(private_key.get())) {
DVLOG(1) << "Private key is invalid.";
return nullptr;
@@ -112,6 +112,8 @@ StringPiece P256KeyExchange::public_value() const {
sizeof(public_key_));
}
-QuicTag P256KeyExchange::tag() const { return kP256; }
+QuicTag P256KeyExchange::tag() const {
+ return kP256;
+}
} // namespace net
diff --git a/net/quic/crypto/p256_key_exchange_test.cc b/net/quic/crypto/p256_key_exchange_test.cc
index 54c99a0..4052c2d 100644
--- a/net/quic/crypto/p256_key_exchange_test.cc
+++ b/net/quic/crypto/p256_key_exchange_test.cc
@@ -41,4 +41,3 @@ TEST(P256KeyExchange, SharedKey) {
} // namespace test
} // namespace net
-
diff --git a/net/quic/crypto/proof_test.cc b/net/quic/crypto/proof_test.cc
index 3a7db6f..3ee3781 100644
--- a/net/quic/crypto/proof_test.cc
+++ b/net/quic/crypto/proof_test.cc
@@ -35,9 +35,7 @@ class TestProofVerifierCallback : public ProofVerifierCallback {
TestProofVerifierCallback(TestCompletionCallback* comp_callback,
bool* ok,
string* error_details)
- : comp_callback_(comp_callback),
- ok_(ok),
- error_details_(error_details) {}
+ : comp_callback_(comp_callback), ok_(ok), error_details_(error_details) {}
void Run(bool ok,
const string& error_details,
@@ -133,28 +131,25 @@ TEST(ProofTest, DISABLED_Verify) {
ASSERT_EQ(signature, first_signature);
ASSERT_EQ(first_cert_sct, cert_sct);
- RunVerification(
- verifier.get(), hostname, server_config, *certs, signature, true);
+ RunVerification(verifier.get(), hostname, server_config, *certs, signature,
+ true);
- RunVerification(
- verifier.get(), "foo.com", server_config, *certs, signature, false);
+ RunVerification(verifier.get(), "foo.com", server_config, *certs, signature,
+ false);
- RunVerification(
- verifier.get(), server_config.substr(1, string::npos), server_config,
- *certs, signature, false);
+ RunVerification(verifier.get(), server_config.substr(1, string::npos),
+ server_config, *certs, signature, false);
const string corrupt_signature = "1" + signature;
- RunVerification(
- verifier.get(), hostname, server_config, *certs, corrupt_signature,
- false);
+ RunVerification(verifier.get(), hostname, server_config, *certs,
+ corrupt_signature, false);
vector<string> wrong_certs;
for (size_t i = 1; i < certs->size(); i++) {
wrong_certs.push_back((*certs)[i]);
}
- RunVerification(
- verifier.get(), "foo.com", server_config, wrong_certs, corrupt_signature,
- false);
+ RunVerification(verifier.get(), "foo.com", server_config, wrong_certs,
+ corrupt_signature, false);
}
// A known answer test that allows us to test ProofVerifier without a working
@@ -163,76 +158,76 @@ TEST(ProofTest, VerifyRSAKnownAnswerTest) {
// These sample signatures were generated by running the Proof.Verify test
// and dumping the bytes of the |signature| output of ProofSource::GetProof().
static const unsigned char signature_data_0[] = {
- 0x31, 0xd5, 0xfb, 0x40, 0x30, 0x75, 0xd2, 0x7d, 0x61, 0xf9, 0xd7, 0x54,
- 0x30, 0x06, 0xaf, 0x54, 0x0d, 0xb0, 0x0a, 0xda, 0x63, 0xca, 0x7e, 0x9e,
- 0xce, 0xba, 0x10, 0x05, 0x1b, 0xa6, 0x7f, 0xef, 0x2b, 0xa3, 0xff, 0x3c,
- 0xbb, 0x9a, 0xe4, 0xbf, 0xb8, 0x0c, 0xc1, 0xbd, 0xed, 0xc2, 0x90, 0x68,
- 0xeb, 0x45, 0x48, 0xea, 0x3c, 0x95, 0xf8, 0xa2, 0xb9, 0xe7, 0x62, 0x29,
- 0x00, 0xc3, 0x18, 0xb4, 0x16, 0x6f, 0x5e, 0xb0, 0xc1, 0x26, 0xc0, 0x4b,
- 0x84, 0xf5, 0x97, 0xfc, 0x17, 0xf9, 0x1c, 0x43, 0xb8, 0xf2, 0x3f, 0x38,
- 0x32, 0xad, 0x36, 0x52, 0x2c, 0x26, 0x92, 0x7a, 0xea, 0x2c, 0xa2, 0xf4,
- 0x28, 0x2f, 0x19, 0x4d, 0x1f, 0x11, 0x46, 0x82, 0xd0, 0xc4, 0x86, 0x56,
- 0x5c, 0x97, 0x9e, 0xc6, 0x37, 0x8e, 0xaf, 0x9d, 0x69, 0xe9, 0x4f, 0x5a,
- 0x6d, 0x70, 0x75, 0xc7, 0x41, 0x95, 0x68, 0x53, 0x94, 0xca, 0x31, 0x63,
- 0x61, 0x9f, 0xb8, 0x8c, 0x3b, 0x75, 0x36, 0x8b, 0x69, 0xa2, 0x35, 0xc0,
- 0x4b, 0x77, 0x55, 0x08, 0xc2, 0xb4, 0x56, 0xd2, 0x81, 0xce, 0x9e, 0x25,
- 0xdb, 0x50, 0x74, 0xb3, 0x8a, 0xd9, 0x20, 0x42, 0x3f, 0x85, 0x2d, 0xaa,
- 0xfd, 0x66, 0xfa, 0xd6, 0x95, 0x55, 0x6b, 0x63, 0x63, 0x04, 0xf8, 0x6c,
- 0x3e, 0x08, 0x22, 0x39, 0xb9, 0x9a, 0xe0, 0xd7, 0x01, 0xff, 0xeb, 0x8a,
- 0xb9, 0xe2, 0x34, 0xa5, 0xa0, 0x51, 0xe9, 0xbe, 0x15, 0x12, 0xbf, 0xbe,
- 0x64, 0x3d, 0x3f, 0x98, 0xce, 0xc1, 0xa6, 0x33, 0x32, 0xd3, 0x5c, 0xa8,
- 0x39, 0x93, 0xdc, 0x1c, 0xb9, 0xab, 0x3c, 0x80, 0x62, 0xb3, 0x76, 0x21,
- 0xdf, 0x47, 0x1e, 0xa9, 0x0e, 0x5e, 0x8a, 0xbe, 0x66, 0x5b, 0x7c, 0x21,
- 0xfa, 0x78, 0x2d, 0xd1, 0x1d, 0x5c, 0x35, 0x8a, 0x34, 0xb2, 0x1a, 0xc2,
- 0xc4, 0x4b, 0x53, 0x54,
+ 0x31, 0xd5, 0xfb, 0x40, 0x30, 0x75, 0xd2, 0x7d, 0x61, 0xf9, 0xd7, 0x54,
+ 0x30, 0x06, 0xaf, 0x54, 0x0d, 0xb0, 0x0a, 0xda, 0x63, 0xca, 0x7e, 0x9e,
+ 0xce, 0xba, 0x10, 0x05, 0x1b, 0xa6, 0x7f, 0xef, 0x2b, 0xa3, 0xff, 0x3c,
+ 0xbb, 0x9a, 0xe4, 0xbf, 0xb8, 0x0c, 0xc1, 0xbd, 0xed, 0xc2, 0x90, 0x68,
+ 0xeb, 0x45, 0x48, 0xea, 0x3c, 0x95, 0xf8, 0xa2, 0xb9, 0xe7, 0x62, 0x29,
+ 0x00, 0xc3, 0x18, 0xb4, 0x16, 0x6f, 0x5e, 0xb0, 0xc1, 0x26, 0xc0, 0x4b,
+ 0x84, 0xf5, 0x97, 0xfc, 0x17, 0xf9, 0x1c, 0x43, 0xb8, 0xf2, 0x3f, 0x38,
+ 0x32, 0xad, 0x36, 0x52, 0x2c, 0x26, 0x92, 0x7a, 0xea, 0x2c, 0xa2, 0xf4,
+ 0x28, 0x2f, 0x19, 0x4d, 0x1f, 0x11, 0x46, 0x82, 0xd0, 0xc4, 0x86, 0x56,
+ 0x5c, 0x97, 0x9e, 0xc6, 0x37, 0x8e, 0xaf, 0x9d, 0x69, 0xe9, 0x4f, 0x5a,
+ 0x6d, 0x70, 0x75, 0xc7, 0x41, 0x95, 0x68, 0x53, 0x94, 0xca, 0x31, 0x63,
+ 0x61, 0x9f, 0xb8, 0x8c, 0x3b, 0x75, 0x36, 0x8b, 0x69, 0xa2, 0x35, 0xc0,
+ 0x4b, 0x77, 0x55, 0x08, 0xc2, 0xb4, 0x56, 0xd2, 0x81, 0xce, 0x9e, 0x25,
+ 0xdb, 0x50, 0x74, 0xb3, 0x8a, 0xd9, 0x20, 0x42, 0x3f, 0x85, 0x2d, 0xaa,
+ 0xfd, 0x66, 0xfa, 0xd6, 0x95, 0x55, 0x6b, 0x63, 0x63, 0x04, 0xf8, 0x6c,
+ 0x3e, 0x08, 0x22, 0x39, 0xb9, 0x9a, 0xe0, 0xd7, 0x01, 0xff, 0xeb, 0x8a,
+ 0xb9, 0xe2, 0x34, 0xa5, 0xa0, 0x51, 0xe9, 0xbe, 0x15, 0x12, 0xbf, 0xbe,
+ 0x64, 0x3d, 0x3f, 0x98, 0xce, 0xc1, 0xa6, 0x33, 0x32, 0xd3, 0x5c, 0xa8,
+ 0x39, 0x93, 0xdc, 0x1c, 0xb9, 0xab, 0x3c, 0x80, 0x62, 0xb3, 0x76, 0x21,
+ 0xdf, 0x47, 0x1e, 0xa9, 0x0e, 0x5e, 0x8a, 0xbe, 0x66, 0x5b, 0x7c, 0x21,
+ 0xfa, 0x78, 0x2d, 0xd1, 0x1d, 0x5c, 0x35, 0x8a, 0x34, 0xb2, 0x1a, 0xc2,
+ 0xc4, 0x4b, 0x53, 0x54,
};
static const unsigned char signature_data_1[] = {
- 0x01, 0x7b, 0x52, 0x35, 0xe3, 0x51, 0xdd, 0xf1, 0x67, 0x8d, 0x31, 0x5e,
- 0xa3, 0x75, 0x1f, 0x68, 0x6c, 0xdd, 0x41, 0x7a, 0x18, 0x25, 0xe0, 0x12,
- 0x6e, 0x84, 0x46, 0x5e, 0xb2, 0x98, 0xd7, 0x84, 0xe1, 0x62, 0xe0, 0xc1,
- 0xc4, 0xd7, 0x4f, 0x4f, 0x80, 0xc1, 0x92, 0xd6, 0x02, 0xaf, 0xca, 0x28,
- 0x9f, 0xe0, 0xf3, 0x74, 0xd7, 0xf1, 0x44, 0x67, 0x59, 0x27, 0xc8, 0xc2,
- 0x8b, 0xd4, 0xe5, 0x4a, 0x07, 0xfd, 0x00, 0xd6, 0x8a, 0xbf, 0x8b, 0xcd,
- 0x6a, 0xe0, 0x1d, 0xf6, 0x4b, 0x68, 0x0f, 0xcf, 0xb9, 0xd0, 0xa1, 0xbc,
- 0x2e, 0xcf, 0x7c, 0x03, 0x47, 0x11, 0xe4, 0x4c, 0xbc, 0x1b, 0x6b, 0xa5,
- 0x2a, 0x82, 0x86, 0xa4, 0x7f, 0x1d, 0x85, 0x64, 0x21, 0x10, 0xd2, 0xb2,
- 0xa0, 0x31, 0xa2, 0x78, 0xe6, 0xf2, 0xea, 0x96, 0x38, 0x8c, 0x9a, 0xe1,
- 0x01, 0xab, 0x8e, 0x95, 0x66, 0xc8, 0xe5, 0xcc, 0x80, 0xa3, 0xbd, 0x16,
- 0xa7, 0x79, 0x19, 0x39, 0x61, 0x3d, 0xff, 0x37, 0xca, 0x9f, 0x97, 0x05,
- 0xc7, 0xcb, 0xf0, 0xea, 0xaf, 0x64, 0x07, 0xc0, 0xed, 0x2a, 0x98, 0xa4,
- 0xaf, 0x04, 0x6f, 0xf2, 0xc9, 0xb2, 0x73, 0x9a, 0x56, 0x85, 0x43, 0x64,
- 0x5f, 0xaa, 0xb7, 0xff, 0x31, 0x4c, 0x2e, 0x6c, 0x17, 0xcf, 0xe5, 0xbe,
- 0x7f, 0x7e, 0xad, 0xf5, 0x6f, 0x84, 0x50, 0x20, 0x29, 0xb3, 0x57, 0xe7,
- 0xb1, 0xdc, 0x2c, 0x95, 0x48, 0xfe, 0xb0, 0xc1, 0x92, 0xda, 0xc5, 0x58,
- 0x95, 0xb0, 0x1a, 0x3a, 0x05, 0x71, 0x3c, 0x6d, 0x20, 0x01, 0x4c, 0xa9,
- 0xe4, 0x38, 0x08, 0x65, 0xb4, 0xbd, 0x86, 0x76, 0xbd, 0xad, 0x25, 0x06,
- 0x74, 0x0b, 0xca, 0x95, 0x27, 0x0c, 0x13, 0x08, 0x7e, 0x30, 0xcf, 0xf6,
- 0xb5, 0xc1, 0x2a, 0x08, 0xfc, 0x4b, 0xc6, 0xb5, 0x2f, 0x23, 0x27, 0x32,
- 0x89, 0xdb, 0x0e, 0x4a,
+ 0x01, 0x7b, 0x52, 0x35, 0xe3, 0x51, 0xdd, 0xf1, 0x67, 0x8d, 0x31, 0x5e,
+ 0xa3, 0x75, 0x1f, 0x68, 0x6c, 0xdd, 0x41, 0x7a, 0x18, 0x25, 0xe0, 0x12,
+ 0x6e, 0x84, 0x46, 0x5e, 0xb2, 0x98, 0xd7, 0x84, 0xe1, 0x62, 0xe0, 0xc1,
+ 0xc4, 0xd7, 0x4f, 0x4f, 0x80, 0xc1, 0x92, 0xd6, 0x02, 0xaf, 0xca, 0x28,
+ 0x9f, 0xe0, 0xf3, 0x74, 0xd7, 0xf1, 0x44, 0x67, 0x59, 0x27, 0xc8, 0xc2,
+ 0x8b, 0xd4, 0xe5, 0x4a, 0x07, 0xfd, 0x00, 0xd6, 0x8a, 0xbf, 0x8b, 0xcd,
+ 0x6a, 0xe0, 0x1d, 0xf6, 0x4b, 0x68, 0x0f, 0xcf, 0xb9, 0xd0, 0xa1, 0xbc,
+ 0x2e, 0xcf, 0x7c, 0x03, 0x47, 0x11, 0xe4, 0x4c, 0xbc, 0x1b, 0x6b, 0xa5,
+ 0x2a, 0x82, 0x86, 0xa4, 0x7f, 0x1d, 0x85, 0x64, 0x21, 0x10, 0xd2, 0xb2,
+ 0xa0, 0x31, 0xa2, 0x78, 0xe6, 0xf2, 0xea, 0x96, 0x38, 0x8c, 0x9a, 0xe1,
+ 0x01, 0xab, 0x8e, 0x95, 0x66, 0xc8, 0xe5, 0xcc, 0x80, 0xa3, 0xbd, 0x16,
+ 0xa7, 0x79, 0x19, 0x39, 0x61, 0x3d, 0xff, 0x37, 0xca, 0x9f, 0x97, 0x05,
+ 0xc7, 0xcb, 0xf0, 0xea, 0xaf, 0x64, 0x07, 0xc0, 0xed, 0x2a, 0x98, 0xa4,
+ 0xaf, 0x04, 0x6f, 0xf2, 0xc9, 0xb2, 0x73, 0x9a, 0x56, 0x85, 0x43, 0x64,
+ 0x5f, 0xaa, 0xb7, 0xff, 0x31, 0x4c, 0x2e, 0x6c, 0x17, 0xcf, 0xe5, 0xbe,
+ 0x7f, 0x7e, 0xad, 0xf5, 0x6f, 0x84, 0x50, 0x20, 0x29, 0xb3, 0x57, 0xe7,
+ 0xb1, 0xdc, 0x2c, 0x95, 0x48, 0xfe, 0xb0, 0xc1, 0x92, 0xda, 0xc5, 0x58,
+ 0x95, 0xb0, 0x1a, 0x3a, 0x05, 0x71, 0x3c, 0x6d, 0x20, 0x01, 0x4c, 0xa9,
+ 0xe4, 0x38, 0x08, 0x65, 0xb4, 0xbd, 0x86, 0x76, 0xbd, 0xad, 0x25, 0x06,
+ 0x74, 0x0b, 0xca, 0x95, 0x27, 0x0c, 0x13, 0x08, 0x7e, 0x30, 0xcf, 0xf6,
+ 0xb5, 0xc1, 0x2a, 0x08, 0xfc, 0x4b, 0xc6, 0xb5, 0x2f, 0x23, 0x27, 0x32,
+ 0x89, 0xdb, 0x0e, 0x4a,
};
static const unsigned char signature_data_2[] = {
- 0x6d, 0x7d, 0x22, 0x8c, 0x85, 0xc4, 0x8a, 0x80, 0x05, 0xe4, 0x3c, 0xaf,
- 0x10, 0x3b, 0xe3, 0x51, 0xb1, 0x86, 0x52, 0x63, 0xb6, 0x17, 0x33, 0xbd,
- 0x1b, 0x1e, 0xc4, 0x50, 0x10, 0xfc, 0xcc, 0xea, 0x6b, 0x11, 0xeb, 0x6d,
- 0x5e, 0x00, 0xe7, 0xf3, 0x67, 0x99, 0x74, 0x53, 0x12, 0x8f, 0xe4, 0x3e,
- 0x20, 0x17, 0x8e, 0x83, 0xe6, 0xdc, 0x83, 0x91, 0x0e, 0xf3, 0x69, 0x22,
- 0x95, 0x14, 0xdf, 0xc1, 0xda, 0xb5, 0xdb, 0x6a, 0x1a, 0xb4, 0x4f, 0x26,
- 0xd0, 0x32, 0x1d, 0x73, 0x95, 0x1f, 0x39, 0x1d, 0x00, 0xcb, 0xc3, 0x92,
- 0x49, 0x53, 0xcb, 0x5c, 0x36, 0x70, 0x19, 0xd9, 0x64, 0x36, 0xda, 0xfb,
- 0x20, 0xe5, 0x47, 0xd9, 0x08, 0xc6, 0x5a, 0x9e, 0x87, 0x1a, 0xdb, 0x11,
- 0x7b, 0x17, 0xfc, 0x53, 0x7b, 0xc1, 0xa0, 0xc0, 0x33, 0xcf, 0x96, 0xba,
- 0x03, 0x79, 0x8e, 0xc6, 0x05, 0xd2, 0xb7, 0xa2, 0xe2, 0xc1, 0x67, 0xb7,
- 0x6a, 0xeb, 0xb1, 0x40, 0xbb, 0x7d, 0x57, 0xcb, 0xc2, 0x60, 0x9f, 0xf1,
- 0x72, 0xe5, 0xad, 0xce, 0x95, 0x45, 0x7c, 0xbc, 0x75, 0x81, 0x45, 0x19,
- 0xe1, 0xa7, 0x2f, 0x05, 0x52, 0xeb, 0xed, 0xdd, 0x19, 0xd9, 0x1a, 0xc9,
- 0x5a, 0x06, 0x8e, 0x29, 0x54, 0xb5, 0x4f, 0x80, 0xaa, 0x36, 0x36, 0xc0,
- 0xff, 0x64, 0xac, 0xe8, 0x0f, 0x99, 0x35, 0x5e, 0xc6, 0x72, 0x1f, 0x8c,
- 0xc4, 0x2b, 0x7d, 0xc1, 0xfb, 0xf0, 0x12, 0x61, 0xb1, 0x18, 0x65, 0xdd,
- 0xc2, 0x38, 0x92, 0xba, 0x84, 0xf8, 0xc8, 0x5e, 0x17, 0x63, 0xe0, 0x9c,
- 0x2c, 0xe6, 0x70, 0x71, 0xdc, 0xe5, 0xc1, 0xea, 0xb3, 0x9a, 0xb6, 0x91,
- 0xdc, 0xc5, 0x56, 0x84, 0x8a, 0x31, 0x31, 0x23, 0x61, 0x94, 0x7e, 0x01,
- 0x22, 0x49, 0xf3, 0xcb, 0x0e, 0x31, 0x03, 0x04, 0x1b, 0x14, 0x43, 0x7c,
- 0xad, 0x42, 0xe5, 0x55,
+ 0x6d, 0x7d, 0x22, 0x8c, 0x85, 0xc4, 0x8a, 0x80, 0x05, 0xe4, 0x3c, 0xaf,
+ 0x10, 0x3b, 0xe3, 0x51, 0xb1, 0x86, 0x52, 0x63, 0xb6, 0x17, 0x33, 0xbd,
+ 0x1b, 0x1e, 0xc4, 0x50, 0x10, 0xfc, 0xcc, 0xea, 0x6b, 0x11, 0xeb, 0x6d,
+ 0x5e, 0x00, 0xe7, 0xf3, 0x67, 0x99, 0x74, 0x53, 0x12, 0x8f, 0xe4, 0x3e,
+ 0x20, 0x17, 0x8e, 0x83, 0xe6, 0xdc, 0x83, 0x91, 0x0e, 0xf3, 0x69, 0x22,
+ 0x95, 0x14, 0xdf, 0xc1, 0xda, 0xb5, 0xdb, 0x6a, 0x1a, 0xb4, 0x4f, 0x26,
+ 0xd0, 0x32, 0x1d, 0x73, 0x95, 0x1f, 0x39, 0x1d, 0x00, 0xcb, 0xc3, 0x92,
+ 0x49, 0x53, 0xcb, 0x5c, 0x36, 0x70, 0x19, 0xd9, 0x64, 0x36, 0xda, 0xfb,
+ 0x20, 0xe5, 0x47, 0xd9, 0x08, 0xc6, 0x5a, 0x9e, 0x87, 0x1a, 0xdb, 0x11,
+ 0x7b, 0x17, 0xfc, 0x53, 0x7b, 0xc1, 0xa0, 0xc0, 0x33, 0xcf, 0x96, 0xba,
+ 0x03, 0x79, 0x8e, 0xc6, 0x05, 0xd2, 0xb7, 0xa2, 0xe2, 0xc1, 0x67, 0xb7,
+ 0x6a, 0xeb, 0xb1, 0x40, 0xbb, 0x7d, 0x57, 0xcb, 0xc2, 0x60, 0x9f, 0xf1,
+ 0x72, 0xe5, 0xad, 0xce, 0x95, 0x45, 0x7c, 0xbc, 0x75, 0x81, 0x45, 0x19,
+ 0xe1, 0xa7, 0x2f, 0x05, 0x52, 0xeb, 0xed, 0xdd, 0x19, 0xd9, 0x1a, 0xc9,
+ 0x5a, 0x06, 0x8e, 0x29, 0x54, 0xb5, 0x4f, 0x80, 0xaa, 0x36, 0x36, 0xc0,
+ 0xff, 0x64, 0xac, 0xe8, 0x0f, 0x99, 0x35, 0x5e, 0xc6, 0x72, 0x1f, 0x8c,
+ 0xc4, 0x2b, 0x7d, 0xc1, 0xfb, 0xf0, 0x12, 0x61, 0xb1, 0x18, 0x65, 0xdd,
+ 0xc2, 0x38, 0x92, 0xba, 0x84, 0xf8, 0xc8, 0x5e, 0x17, 0x63, 0xe0, 0x9c,
+ 0x2c, 0xe6, 0x70, 0x71, 0xdc, 0xe5, 0xc1, 0xea, 0xb3, 0x9a, 0xb6, 0x91,
+ 0xdc, 0xc5, 0x56, 0x84, 0x8a, 0x31, 0x31, 0x23, 0x61, 0x94, 0x7e, 0x01,
+ 0x22, 0x49, 0xf3, 0xcb, 0x0e, 0x31, 0x03, 0x04, 0x1b, 0x14, 0x43, 0x7c,
+ 0xad, 0x42, 0xe5, 0x55,
};
scoped_ptr<ProofVerifier> verifier(
@@ -258,18 +253,17 @@ TEST(ProofTest, VerifyRSAKnownAnswerTest) {
for (size_t i = 0; i < signatures.size(); i++) {
const string& signature = signatures[i];
- RunVerification(
- verifier.get(), hostname, server_config, certs, signature, true);
- RunVerification(
- verifier.get(), "foo.com", server_config, certs, signature, false);
- RunVerification(
- verifier.get(), hostname, server_config.substr(1, string::npos),
- certs, signature, false);
+ RunVerification(verifier.get(), hostname, server_config, certs, signature,
+ true);
+ RunVerification(verifier.get(), "foo.com", server_config, certs, signature,
+ false);
+ RunVerification(verifier.get(), hostname,
+ server_config.substr(1, string::npos), certs, signature,
+ false);
const string corrupt_signature = "1" + signature;
- RunVerification(
- verifier.get(), hostname, server_config, certs, corrupt_signature,
- false);
+ RunVerification(verifier.get(), hostname, server_config, certs,
+ corrupt_signature, false);
vector<string> wrong_certs;
for (size_t i = 1; i < certs.size(); i++) {
@@ -283,7 +277,7 @@ TEST(ProofTest, VerifyRSAKnownAnswerTest) {
// A known answer test that allows us to test ProofVerifier without a working
// ProofSource.
TEST(ProofTest, VerifyECDSAKnownAnswerTest) {
- // Disable this test on platforms that do not support ECDSA certificates.
+// Disable this test on platforms that do not support ECDSA certificates.
#if defined(OS_WIN)
if (base::win::GetVersion() < base::win::VERSION_VISTA)
return;
@@ -293,28 +287,28 @@ TEST(ProofTest, VerifyECDSAKnownAnswerTest) {
// (modified to use ECDSA for signing proofs) and dumping the bytes of the
// |signature| output of ProofSource::GetProof().
static const unsigned char signature_data_0[] = {
- 0x30, 0x45, 0x02, 0x21, 0x00, 0x89, 0xc4, 0x7d, 0x08, 0xd1, 0x49, 0x19,
- 0x6c, 0xd1, 0x7c, 0xb9, 0x25, 0xe0, 0xe3, 0xbd, 0x6a, 0x5c, 0xd7, 0xaa,
- 0x0c, 0xdc, 0x4f, 0x8e, 0xeb, 0xde, 0xbf, 0x32, 0xf8, 0xd1, 0x84, 0x95,
- 0x97, 0x02, 0x20, 0x29, 0x3d, 0x49, 0x22, 0x73, 0xed, 0x8b, 0xde, 0x3d,
- 0xc2, 0xa4, 0x20, 0xcc, 0xe7, 0xc8, 0x2a, 0x85, 0x20, 0x9b, 0x5b, 0xda,
- 0xcd, 0x58, 0x23, 0xbe, 0x89, 0x73, 0x31, 0x87, 0x51, 0xd1, 0x01,
+ 0x30, 0x45, 0x02, 0x21, 0x00, 0x89, 0xc4, 0x7d, 0x08, 0xd1, 0x49, 0x19,
+ 0x6c, 0xd1, 0x7c, 0xb9, 0x25, 0xe0, 0xe3, 0xbd, 0x6a, 0x5c, 0xd7, 0xaa,
+ 0x0c, 0xdc, 0x4f, 0x8e, 0xeb, 0xde, 0xbf, 0x32, 0xf8, 0xd1, 0x84, 0x95,
+ 0x97, 0x02, 0x20, 0x29, 0x3d, 0x49, 0x22, 0x73, 0xed, 0x8b, 0xde, 0x3d,
+ 0xc2, 0xa4, 0x20, 0xcc, 0xe7, 0xc8, 0x2a, 0x85, 0x20, 0x9b, 0x5b, 0xda,
+ 0xcd, 0x58, 0x23, 0xbe, 0x89, 0x73, 0x31, 0x87, 0x51, 0xd1, 0x01,
};
static const unsigned char signature_data_1[] = {
- 0x30, 0x46, 0x02, 0x21, 0x00, 0xec, 0xdf, 0x69, 0xc8, 0x24, 0x59, 0x93,
- 0xda, 0x49, 0xee, 0x37, 0x28, 0xaf, 0xeb, 0x0e, 0x2f, 0x80, 0x17, 0x4b,
- 0x3b, 0xf6, 0x54, 0xcd, 0x3b, 0x86, 0xc5, 0x98, 0x0d, 0xff, 0xc6, 0xb1,
- 0xe7, 0x02, 0x21, 0x00, 0xe1, 0x36, 0x8c, 0xc0, 0xf4, 0x50, 0x5f, 0xba,
- 0xfb, 0xe2, 0xff, 0x1d, 0x5d, 0x64, 0xe4, 0x07, 0xbb, 0x5a, 0x4b, 0x19,
- 0xb6, 0x39, 0x7a, 0xc4, 0x12, 0xc6, 0xe5, 0x42, 0xc8, 0x78, 0x33, 0xcd,
+ 0x30, 0x46, 0x02, 0x21, 0x00, 0xec, 0xdf, 0x69, 0xc8, 0x24, 0x59, 0x93,
+ 0xda, 0x49, 0xee, 0x37, 0x28, 0xaf, 0xeb, 0x0e, 0x2f, 0x80, 0x17, 0x4b,
+ 0x3b, 0xf6, 0x54, 0xcd, 0x3b, 0x86, 0xc5, 0x98, 0x0d, 0xff, 0xc6, 0xb1,
+ 0xe7, 0x02, 0x21, 0x00, 0xe1, 0x36, 0x8c, 0xc0, 0xf4, 0x50, 0x5f, 0xba,
+ 0xfb, 0xe2, 0xff, 0x1d, 0x5d, 0x64, 0xe4, 0x07, 0xbb, 0x5a, 0x4b, 0x19,
+ 0xb6, 0x39, 0x7a, 0xc4, 0x12, 0xc6, 0xe5, 0x42, 0xc8, 0x78, 0x33, 0xcd,
};
static const unsigned char signature_data_2[] = {
- 0x30, 0x45, 0x02, 0x20, 0x09, 0x51, 0xe9, 0xde, 0xdb, 0x01, 0xfd, 0xb4,
- 0xd8, 0x20, 0xbb, 0xad, 0x41, 0xe3, 0xaa, 0xe7, 0xa3, 0xc3, 0x32, 0x10,
- 0x9d, 0xfa, 0x37, 0xce, 0x17, 0xd1, 0x29, 0xf9, 0xd4, 0x1d, 0x0d, 0x19,
- 0x02, 0x21, 0x00, 0xc6, 0x20, 0xd4, 0x28, 0xf9, 0x70, 0xb5, 0xb4, 0xff,
- 0x4a, 0x35, 0xba, 0xa0, 0xf2, 0x8e, 0x00, 0xf7, 0xcb, 0x43, 0xaf, 0x2d,
- 0x1f, 0xce, 0x92, 0x05, 0xca, 0x29, 0xfe, 0xd2, 0x8f, 0xd9, 0x31,
+ 0x30, 0x45, 0x02, 0x20, 0x09, 0x51, 0xe9, 0xde, 0xdb, 0x01, 0xfd, 0xb4,
+ 0xd8, 0x20, 0xbb, 0xad, 0x41, 0xe3, 0xaa, 0xe7, 0xa3, 0xc3, 0x32, 0x10,
+ 0x9d, 0xfa, 0x37, 0xce, 0x17, 0xd1, 0x29, 0xf9, 0xd4, 0x1d, 0x0d, 0x19,
+ 0x02, 0x21, 0x00, 0xc6, 0x20, 0xd4, 0x28, 0xf9, 0x70, 0xb5, 0xb4, 0xff,
+ 0x4a, 0x35, 0xba, 0xa0, 0xf2, 0x8e, 0x00, 0xf7, 0xcb, 0x43, 0xaf, 0x2d,
+ 0x1f, 0xce, 0x92, 0x05, 0xca, 0x29, 0xfe, 0xd2, 0x8f, 0xd9, 0x31,
};
scoped_ptr<ProofVerifier> verifier(
@@ -340,35 +334,32 @@ TEST(ProofTest, VerifyECDSAKnownAnswerTest) {
for (size_t i = 0; i < signatures.size(); i++) {
const string& signature = signatures[i];
- RunVerification(
- verifier.get(), hostname, server_config, certs, signature, true);
- RunVerification(
- verifier.get(), "foo.com", server_config, certs, signature, false);
- RunVerification(
- verifier.get(), hostname, server_config.substr(1, string::npos),
- certs, signature, false);
+ RunVerification(verifier.get(), hostname, server_config, certs, signature,
+ true);
+ RunVerification(verifier.get(), "foo.com", server_config, certs, signature,
+ false);
+ RunVerification(verifier.get(), hostname,
+ server_config.substr(1, string::npos), certs, signature,
+ false);
// An ECDSA signature is DER-encoded. Corrupt the last byte so that the
// signature can still be DER-decoded correctly.
string corrupt_signature = signature;
corrupt_signature[corrupt_signature.size() - 1] += 1;
- RunVerification(
- verifier.get(), hostname, server_config, certs, corrupt_signature,
- false);
+ RunVerification(verifier.get(), hostname, server_config, certs,
+ corrupt_signature, false);
// Prepending a "1" makes the DER invalid.
const string bad_der_signature1 = "1" + signature;
- RunVerification(
- verifier.get(), hostname, server_config, certs, bad_der_signature1,
- false);
+ RunVerification(verifier.get(), hostname, server_config, certs,
+ bad_der_signature1, false);
vector<string> wrong_certs;
for (size_t i = 1; i < certs.size(); i++) {
wrong_certs.push_back(certs[i]);
}
- RunVerification(
- verifier.get(), hostname, server_config, wrong_certs, signature,
- false);
+ RunVerification(verifier.get(), hostname, server_config, wrong_certs,
+ signature, false);
}
}
diff --git a/net/quic/crypto/proof_verifier_chromium.cc b/net/quic/crypto/proof_verifier_chromium.cc
index 2cf7298..e247b59 100644
--- a/net/quic/crypto/proof_verifier_chromium.cc
+++ b/net/quic/crypto/proof_verifier_chromium.cc
@@ -317,8 +317,7 @@ bool ProofVerifierChromium::Job::VerifySignature(const string& signed_data,
size_t size_bits;
X509Certificate::PublicKeyType type;
- X509Certificate::GetPublicKeyInfo(cert_->os_cert_handle(), &size_bits,
- &type);
+ X509Certificate::GetPublicKeyInfo(cert_->os_cert_handle(), &size_bits, &type);
if (type == X509Certificate::kPublicKeyTypeRSA) {
crypto::SignatureVerifier::HashAlgorithm hash_alg =
crypto::SignatureVerifier::SHA256;
@@ -347,17 +346,13 @@ bool ProofVerifierChromium::Job::VerifySignature(const string& signed_data,
// SHA384, or ecdsa-with-SHA512.
// See also RFC 5480, Appendix A.
static const uint8 kECDSAWithSHA256AlgorithmID[] = {
- 0x30, 0x0a,
- 0x06, 0x08,
- 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02,
+ 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02,
};
if (!verifier.VerifyInit(
kECDSAWithSHA256AlgorithmID, sizeof(kECDSAWithSHA256AlgorithmID),
- reinterpret_cast<const uint8*>(signature.data()),
- signature.size(),
- reinterpret_cast<const uint8*>(spki.data()),
- spki.size())) {
+ reinterpret_cast<const uint8*>(signature.data()), signature.size(),
+ reinterpret_cast<const uint8*>(spki.data()), spki.size())) {
DLOG(WARNING) << "VerifyInit failed";
return false;
}
diff --git a/net/quic/crypto/proof_verifier_chromium.h b/net/quic/crypto/proof_verifier_chromium.h
index 215bc3d..508cfb0 100644
--- a/net/quic/crypto/proof_verifier_chromium.h
+++ b/net/quic/crypto/proof_verifier_chromium.h
@@ -31,7 +31,6 @@ class TransportSecurityState;
class NET_EXPORT_PRIVATE ProofVerifyDetailsChromium
: public ProofVerifyDetails {
public:
-
// ProofVerifyDetails implementation
ProofVerifyDetails* Clone() const override;
diff --git a/net/quic/crypto/quic_crypto_client_config.cc b/net/quic/crypto/quic_crypto_client_config.cc
index dd5c3d2..f79e05a 100644
--- a/net/quic/crypto/quic_crypto_client_config.cc
+++ b/net/quic/crypto/quic_crypto_client_config.cc
@@ -60,8 +60,7 @@ QuicCryptoClientConfig::~QuicCryptoClientConfig() {
}
QuicCryptoClientConfig::CachedState::CachedState()
- : server_config_valid_(false),
- generation_counter_(0) {}
+ : server_config_valid_(false), generation_counter_(0) {}
QuicCryptoClientConfig::CachedState::~CachedState() {}
@@ -138,8 +137,9 @@ bool QuicCryptoClientConfig::CachedState::has_server_nonce() const {
}
QuicCryptoClientConfig::CachedState::ServerConfigState
-QuicCryptoClientConfig::CachedState::SetServerConfig(
- StringPiece server_config, QuicWallTime now, string* error_details) {
+QuicCryptoClientConfig::CachedState::SetServerConfig(StringPiece server_config,
+ QuicWallTime now,
+ string* error_details) {
const bool matches_existing = server_config == server_config_;
// Even if the new server config matches the existing one, we still wish to
@@ -257,8 +257,7 @@ bool QuicCryptoClientConfig::CachedState::Initialize(
}
string error_details;
- ServerConfigState state = SetServerConfig(server_config, now,
- &error_details);
+ ServerConfigState state = SetServerConfig(server_config, now, &error_details);
RecordDiskCacheServerConfigState(state);
if (state != SERVER_CONFIG_VALID) {
DVLOG(1) << "SetServerConfig failed with " << error_details;
@@ -276,8 +275,8 @@ const string& QuicCryptoClientConfig::CachedState::server_config() const {
return server_config_;
}
-const string&
-QuicCryptoClientConfig::CachedState::source_address_token() const {
+const string& QuicCryptoClientConfig::CachedState::source_address_token()
+ const {
return source_address_token_;
}
@@ -454,8 +453,8 @@ void QuicCryptoClientConfig::FillInchoateClientHello(
if (!certs.empty()) {
vector<uint64> hashes;
hashes.reserve(certs.size());
- for (vector<string>::const_iterator i = certs.begin();
- i != certs.end(); ++i) {
+ for (vector<string>::const_iterator i = certs.begin(); i != certs.end();
+ ++i) {
hashes.push_back(QuicUtils::FNV1a_64_Hash(i->data(), i->size()));
}
out->SetVector(kCCRT, hashes);
@@ -475,8 +474,8 @@ QuicErrorCode QuicCryptoClientConfig::FillClientHello(
string* error_details) const {
DCHECK(error_details != nullptr);
- FillInchoateClientHello(server_id, preferred_version, cached,
- out_params, out);
+ FillInchoateClientHello(server_id, preferred_version, cached, out_params,
+ out);
const CryptoHandshakeMessage* scfg = cached->GetServerConfig();
if (!scfg) {
@@ -500,10 +499,10 @@ QuicErrorCode QuicCryptoClientConfig::FillClientHello(
const QuicTag* their_aeads;
const QuicTag* their_key_exchanges;
size_t num_their_aeads, num_their_key_exchanges;
- if (scfg->GetTaglist(kAEAD, &their_aeads,
- &num_their_aeads) != QUIC_NO_ERROR ||
- scfg->GetTaglist(kKEXS, &their_key_exchanges,
- &num_their_key_exchanges) != QUIC_NO_ERROR) {
+ if (scfg->GetTaglist(kAEAD, &their_aeads, &num_their_aeads) !=
+ QUIC_NO_ERROR ||
+ scfg->GetTaglist(kKEXS, &their_key_exchanges, &num_their_key_exchanges) !=
+ QUIC_NO_ERROR) {
*error_details = "Missing AEAD or KEXS";
return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER;
}
@@ -514,9 +513,9 @@ QuicErrorCode QuicCryptoClientConfig::FillClientHello(
// Key exchange: the client does more work than the server, so favor the
// client's preference.
size_t key_exchange_index;
- if (!QuicUtils::FindMutualTag(
- aead, their_aeads, num_their_aeads, QuicUtils::LOCAL_PRIORITY,
- &out_params->aead, nullptr) ||
+ if (!QuicUtils::FindMutualTag(aead, their_aeads, num_their_aeads,
+ QuicUtils::LOCAL_PRIORITY, &out_params->aead,
+ nullptr) ||
!QuicUtils::FindMutualTag(
kexs, their_key_exchanges, num_their_key_exchanges,
QuicUtils::LOCAL_PRIORITY, &out_params->key_exchange,
@@ -549,7 +548,7 @@ QuicErrorCode QuicCryptoClientConfig::FillClientHello(
StringPiece public_value;
if (scfg->GetNthValue24(kPUBS, key_exchange_index, &public_value) !=
- QUIC_NO_ERROR) {
+ QUIC_NO_ERROR) {
*error_details = "Missing public value";
return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER;
}
@@ -572,8 +571,8 @@ QuicErrorCode QuicCryptoClientConfig::FillClientHello(
Curve25519KeyExchange::NewPrivateKey(rand)));
break;
case kP256:
- out_params->client_key_exchange.reset(P256KeyExchange::New(
- P256KeyExchange::NewPrivateKey()));
+ out_params->client_key_exchange.reset(
+ P256KeyExchange::New(P256KeyExchange::NewPrivateKey()));
break;
default:
DCHECK(false);
@@ -707,8 +706,8 @@ QuicErrorCode QuicCryptoClientConfig::CacheNewServerConfig(
return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND;
}
- CachedState::ServerConfigState state = cached->SetServerConfig(
- scfg, now, error_details);
+ CachedState::ServerConfigState state =
+ cached->SetServerConfig(scfg, now, error_details);
if (state == CachedState::SERVER_CONFIG_EXPIRED) {
return QUIC_CRYPTO_SERVER_CONFIG_EXPIRED;
}
diff --git a/net/quic/crypto/quic_crypto_client_config_test.cc b/net/quic/crypto/quic_crypto_client_config_test.cc
index 7f5fea5..b11f504 100644
--- a/net/quic/crypto/quic_crypto_client_config_test.cc
+++ b/net/quic/crypto/quic_crypto_client_config_test.cc
@@ -156,8 +156,8 @@ TEST(QuicCryptoClientConfigTest, InchoateChlo) {
QuicCryptoNegotiatedParameters params;
CryptoHandshakeMessage msg;
QuicServerId server_id("www.google.com", 80, PRIVACY_MODE_DISABLED);
- config.FillInchoateClientHello(server_id, QuicVersionMax(), &state,
- &params, &msg);
+ config.FillInchoateClientHello(server_id, QuicVersionMax(), &state, &params,
+ &msg);
QuicTag cver;
EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kVER, &cver));
@@ -178,8 +178,8 @@ TEST(QuicCryptoClientConfigTest, InchoateChloSecure) {
QuicCryptoNegotiatedParameters params;
CryptoHandshakeMessage msg;
QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED);
- config.FillInchoateClientHello(server_id, QuicVersionMax(), &state,
- &params, &msg);
+ config.FillInchoateClientHello(server_id, QuicVersionMax(), &state, &params,
+ &msg);
QuicTag pdmd;
EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kPDMD, &pdmd));
@@ -218,8 +218,8 @@ TEST(QuicCryptoClientConfigTest, InchoateChloSecureNoEcdsa) {
QuicCryptoNegotiatedParameters params;
CryptoHandshakeMessage msg;
QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED);
- config.FillInchoateClientHello(server_id, QuicVersionMax(), &state,
- &params, &msg);
+ config.FillInchoateClientHello(server_id, QuicVersionMax(), &state, &params,
+ &msg);
QuicTag pdmd;
EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kPDMD, &pdmd));
@@ -235,16 +235,10 @@ TEST(QuicCryptoClientConfigTest, FillClientHello) {
MockRandom rand;
CryptoHandshakeMessage chlo;
QuicServerId server_id("www.google.com", 80, PRIVACY_MODE_DISABLED);
- config.FillClientHello(server_id,
- kConnectionId,
- QuicVersionMax(),
- &state,
- QuicWallTime::Zero(),
- &rand,
+ config.FillClientHello(server_id, kConnectionId, QuicVersionMax(), &state,
+ QuicWallTime::Zero(), &rand,
nullptr, // channel_id_key
- &params,
- &chlo,
- &error_details);
+ &params, &chlo, &error_details);
// Verify that certain QuicTags have been set correctly in the CHLO.
QuicTag cver;
diff --git a/net/quic/crypto/quic_crypto_server_config.cc b/net/quic/crypto/quic_crypto_server_config.cc
index f0586bd..dfdf486 100644
--- a/net/quic/crypto/quic_crypto_server_config.cc
+++ b/net/quic/crypto/quic_crypto_server_config.cc
@@ -59,11 +59,9 @@ const size_t kMultiplier = 3;
const int kMaxTokenAddresses = 4;
string DeriveSourceAddressTokenKey(StringPiece source_address_token_secret) {
- crypto::HKDF hkdf(source_address_token_secret,
- StringPiece() /* no salt */,
+ crypto::HKDF hkdf(source_address_token_secret, StringPiece() /* no salt */,
"QUIC source address token key",
- CryptoSecretBoxer::GetKeySize(),
- 0 /* no fixed IV needed */,
+ CryptoSecretBoxer::GetKeySize(), 0 /* no fixed IV needed */,
0 /* no subkey secret */);
return hkdf.server_write_key().as_string();
}
@@ -81,8 +79,7 @@ class ValidateClientHelloHelper {
public:
ValidateClientHelloHelper(ValidateClientHelloResultCallback::Result* result,
ValidateClientHelloResultCallback* done_cb)
- : result_(result), done_cb_(done_cb) {
- }
+ : result_(result), done_cb_(done_cb) {}
~ValidateClientHelloHelper() {
LOG_IF(DFATAL, done_cb_ != nullptr)
@@ -96,9 +93,7 @@ class ValidateClientHelloHelper {
DetachCallback();
}
- void StartedAsyncCallback() {
- DetachCallback();
- }
+ void StartedAsyncCallback() { DetachCallback(); }
private:
void DetachCallback() {
@@ -118,8 +113,7 @@ class VerifyNonceIsValidAndUniqueCallback
VerifyNonceIsValidAndUniqueCallback(
ValidateClientHelloResultCallback::Result* result,
ValidateClientHelloResultCallback* done_cb)
- : result_(result), done_cb_(done_cb) {
- }
+ : result_(result), done_cb_(done_cb) {}
protected:
void RunImpl(bool nonce_is_valid_and_unique,
@@ -175,14 +169,11 @@ ClientHelloInfo::ClientHelloInfo(const IPAddressNumber& in_client_ip,
QuicWallTime in_now)
: client_ip(in_client_ip), now(in_now), valid_source_address_token(false) {}
-ClientHelloInfo::~ClientHelloInfo() {
-}
+ClientHelloInfo::~ClientHelloInfo() {}
-PrimaryConfigChangedCallback::PrimaryConfigChangedCallback() {
-}
+PrimaryConfigChangedCallback::PrimaryConfigChangedCallback() {}
-PrimaryConfigChangedCallback::~PrimaryConfigChangedCallback() {
-}
+PrimaryConfigChangedCallback::~PrimaryConfigChangedCallback() {}
ValidateClientHelloResultCallback::Result::Result(
const CryptoHandshakeMessage& in_client_hello,
@@ -190,17 +181,13 @@ ValidateClientHelloResultCallback::Result::Result(
QuicWallTime in_now)
: client_hello(in_client_hello),
info(in_client_ip, in_now),
- error_code(QUIC_NO_ERROR) {
-}
+ error_code(QUIC_NO_ERROR) {}
-ValidateClientHelloResultCallback::Result::~Result() {
-}
+ValidateClientHelloResultCallback::Result::~Result() {}
-ValidateClientHelloResultCallback::ValidateClientHelloResultCallback() {
-}
+ValidateClientHelloResultCallback::ValidateClientHelloResultCallback() {}
-ValidateClientHelloResultCallback::~ValidateClientHelloResultCallback() {
-}
+ValidateClientHelloResultCallback::~ValidateClientHelloResultCallback() {}
void ValidateClientHelloResultCallback::Run(const Result* result) {
RunImpl(result->client_hello, *result);
@@ -412,7 +399,7 @@ CryptoHandshakeMessage* QuicCryptoServerConfig::AddDefaultConfig(
bool QuicCryptoServerConfig::SetConfigs(
const vector<QuicServerConfigProtobuf*>& protobufs,
const QuicWallTime now) {
- vector<scoped_refptr<Config> > parsed_configs;
+ vector<scoped_refptr<Config>> parsed_configs;
bool ok = true;
for (vector<QuicServerConfigProtobuf*>::const_iterator i = protobufs.begin();
@@ -439,31 +426,32 @@ bool QuicCryptoServerConfig::SetConfigs(
base::AutoLock locked(configs_lock_);
ConfigMap new_configs;
- for (vector<scoped_refptr<Config> >::const_iterator i =
+ for (vector<scoped_refptr<Config>>::const_iterator i =
parsed_configs.begin();
i != parsed_configs.end(); ++i) {
scoped_refptr<Config> config = *i;
ConfigMap::iterator it = configs_.find(config->id);
if (it != configs_.end()) {
- VLOG(1)
- << "Keeping scid: " << base::HexEncode(
- config->id.data(), config->id.size())
- << " orbit: " << base::HexEncode(
- reinterpret_cast<const char *>(config->orbit), kOrbitSize)
- << " new primary_time " << config->primary_time.ToUNIXSeconds()
- << " old primary_time " << it->second->primary_time.ToUNIXSeconds()
- << " new priority " << config->priority
- << " old priority " << it->second->priority;
+ VLOG(1) << "Keeping scid: "
+ << base::HexEncode(config->id.data(), config->id.size())
+ << " orbit: "
+ << base::HexEncode(reinterpret_cast<const char*>(config->orbit),
+ kOrbitSize)
+ << " new primary_time " << config->primary_time.ToUNIXSeconds()
+ << " old primary_time "
+ << it->second->primary_time.ToUNIXSeconds() << " new priority "
+ << config->priority << " old priority " << it->second->priority;
// Update primary_time and priority.
it->second->primary_time = config->primary_time;
it->second->priority = config->priority;
new_configs.insert(*it);
} else {
- VLOG(1) << "Adding scid: " << base::HexEncode(
- config->id.data(), config->id.size())
- << " orbit: " << base::HexEncode(
- reinterpret_cast<const char *>(config->orbit), kOrbitSize)
+ VLOG(1) << "Adding scid: "
+ << base::HexEncode(config->id.data(), config->id.size())
+ << " orbit: "
+ << base::HexEncode(reinterpret_cast<const char*>(config->orbit),
+ kOrbitSize)
<< " primary_time " << config->primary_time.ToUNIXSeconds()
<< " priority " << config->priority;
new_configs.insert(std::make_pair(config->id, config));
@@ -481,8 +469,8 @@ bool QuicCryptoServerConfig::SetConfigs(
void QuicCryptoServerConfig::GetConfigIds(vector<string>* scids) const {
base::AutoLock locked(configs_lock_);
- for (ConfigMap::const_iterator it = configs_.begin();
- it != configs_.end(); ++it) {
+ for (ConfigMap::const_iterator it = configs_.begin(); it != configs_.end();
+ ++it) {
scids->push_back(it->first);
}
}
@@ -498,8 +486,8 @@ void QuicCryptoServerConfig::ValidateClientHello(
const QuicWallTime now(clock->WallNow());
ValidateClientHelloResultCallback::Result* result =
- new ValidateClientHelloResultCallback::Result(
- client_hello, client_ip, now);
+ new ValidateClientHelloResultCallback::Result(client_hello, client_ip,
+ now);
StringPiece requested_scid;
client_hello.GetStringPiece(kSCID, &requested_scid);
@@ -639,12 +627,11 @@ QuicErrorCode QuicCryptoServerConfig::ProcessClientHello(
const QuicTag* their_aeads;
const QuicTag* their_key_exchanges;
size_t num_their_aeads, num_their_key_exchanges;
- if (client_hello.GetTaglist(kAEAD, &their_aeads,
- &num_their_aeads) != QUIC_NO_ERROR ||
+ if (client_hello.GetTaglist(kAEAD, &their_aeads, &num_their_aeads) !=
+ QUIC_NO_ERROR ||
client_hello.GetTaglist(kKEXS, &their_key_exchanges,
&num_their_key_exchanges) != QUIC_NO_ERROR ||
- num_their_aeads != 1 ||
- num_their_key_exchanges != 1) {
+ num_their_aeads != 1 || num_their_key_exchanges != 1) {
*error_details = "Missing or invalid AEAD or KEXS";
return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER;
}
@@ -653,10 +640,10 @@ QuicErrorCode QuicCryptoServerConfig::ProcessClientHello(
if (!QuicUtils::FindMutualTag(requested_config->aead, their_aeads,
num_their_aeads, QuicUtils::LOCAL_PRIORITY,
&params->aead, nullptr) ||
- !QuicUtils::FindMutualTag(
- requested_config->kexs, their_key_exchanges, num_their_key_exchanges,
- QuicUtils::LOCAL_PRIORITY, &params->key_exchange,
- &key_exchange_index)) {
+ !QuicUtils::FindMutualTag(requested_config->kexs, their_key_exchanges,
+ num_their_key_exchanges,
+ QuicUtils::LOCAL_PRIORITY,
+ &params->key_exchange, &key_exchange_index)) {
*error_details = "Unsupported AEAD or KEXS";
return QUIC_CRYPTO_NO_SUPPORT;
}
@@ -836,8 +823,8 @@ QuicErrorCode QuicCryptoServerConfig::ProcessClientHello(
out->set_tag(kSHLO);
QuicTagVector supported_version_tags;
for (size_t i = 0; i < supported_versions.size(); ++i) {
- supported_version_tags.push_back
- (QuicVersionToQuicTag(supported_versions[i]));
+ supported_version_tags.push_back(
+ QuicVersionToQuicTag(supported_versions[i]));
}
out->SetVector(kVER, supported_version_tags);
out->SetStringPiece(
@@ -890,11 +877,11 @@ bool QuicCryptoServerConfig::ConfigPrimaryTimeLessThan(
void QuicCryptoServerConfig::SelectNewPrimaryConfig(
const QuicWallTime now) const {
- vector<scoped_refptr<Config> > configs;
+ vector<scoped_refptr<Config>> configs;
configs.reserve(configs_.size());
- for (ConfigMap::const_iterator it = configs_.begin();
- it != configs_.end(); ++it) {
+ for (ConfigMap::const_iterator it = configs_.begin(); it != configs_.end();
+ ++it) {
// TODO(avd) Exclude expired configs?
configs.push_back(it->second);
}
@@ -943,8 +930,8 @@ void QuicCryptoServerConfig::SelectNewPrimaryConfig(
new_primary->is_primary = true;
DVLOG(1) << "New primary config. orbit: "
<< base::HexEncode(
- reinterpret_cast<const char*>(primary_config_->orbit),
- kOrbitSize);
+ reinterpret_cast<const char*>(primary_config_->orbit),
+ kOrbitSize);
if (primary_config_changed_cb_.get() != nullptr) {
primary_config_changed_cb_->Run(primary_config_->id);
}
@@ -962,8 +949,8 @@ void QuicCryptoServerConfig::SelectNewPrimaryConfig(
new_primary->is_primary = true;
DVLOG(1) << "New primary config. orbit: "
<< base::HexEncode(
- reinterpret_cast<const char*>(primary_config_->orbit),
- kOrbitSize)
+ reinterpret_cast<const char*>(primary_config_->orbit),
+ kOrbitSize)
<< " scid: " << base::HexEncode(primary_config_->id.data(),
primary_config_->id.size());
next_config_promotion_time_ = QuicWallTime::Zero();
@@ -983,8 +970,7 @@ void QuicCryptoServerConfig::EvaluateClientHello(
ValidateClientHelloResultCallback* done_cb) const {
ValidateClientHelloHelper helper(client_hello_state, done_cb);
- const CryptoHandshakeMessage& client_hello =
- client_hello_state->client_hello;
+ const CryptoHandshakeMessage& client_hello = client_hello_state->client_hello;
ClientHelloInfo* info = &(client_hello_state->info);
if (client_hello.size() < kClientHelloMinimumSize) {
@@ -1157,18 +1143,16 @@ void QuicCryptoServerConfig::EvaluateClientHello(
strike_register_client_.reset(new LocalStrikeRegisterClient(
strike_register_max_entries_,
static_cast<uint32>(info->now.ToUNIXSeconds()),
- strike_register_window_secs_,
- primary_orbit,
- strike_register_no_startup_period_ ?
- StrikeRegister::NO_STARTUP_PERIOD_NEEDED :
- StrikeRegister::DENY_REQUESTS_AT_STARTUP));
+ strike_register_window_secs_, primary_orbit,
+ strike_register_no_startup_period_
+ ? StrikeRegister::NO_STARTUP_PERIOD_NEEDED
+ : StrikeRegister::DENY_REQUESTS_AT_STARTUP));
}
strike_register_client = strike_register_client_.get();
}
strike_register_client->VerifyNonceIsValidAndUnique(
- info->client_nonce,
- info->now,
+ info->client_nonce, info->now,
new VerifyNonceIsValidAndUniqueCallback(client_hello_state, done_cb));
helper.StartedAsyncCallback();
}
@@ -1383,7 +1367,8 @@ QuicCryptoServerConfig::ParseConfigProtobuf(
if (orbit.size() != kOrbitSize) {
LOG(WARNING) << "Orbit value in server config is the wrong length."
- " Got " << orbit.size() << " want " << kOrbitSize;
+ " Got "
+ << orbit.size() << " want " << kOrbitSize;
return nullptr;
}
static_assert(sizeof(config->orbit) == kOrbitSize,
@@ -1401,7 +1386,7 @@ QuicCryptoServerConfig::ParseConfigProtobuf(
!strike_register_client->IsKnownOrbit(orbit)) {
LOG(WARNING)
<< "Rejecting server config with orbit that the strike register "
- "client doesn't know about.";
+ "client doesn't know about.";
return nullptr;
}
}
@@ -1441,7 +1426,8 @@ QuicCryptoServerConfig::ParseConfigProtobuf(
if (private_key.empty()) {
LOG(WARNING) << "Server config contains key exchange method without "
- "corresponding private key: " << tag;
+ "corresponding private key: "
+ << tag;
return nullptr;
}
@@ -1465,7 +1451,8 @@ QuicCryptoServerConfig::ParseConfigProtobuf(
break;
default:
LOG(WARNING) << "Server config message contains unknown key exchange "
- "method: " << tag;
+ "method: "
+ << tag;
return nullptr;
}
@@ -1806,6 +1793,8 @@ QuicCryptoServerConfig::Config::Config()
priority(0),
source_address_token_boxer(nullptr) {}
-QuicCryptoServerConfig::Config::~Config() { STLDeleteElements(&key_exchanges); }
+QuicCryptoServerConfig::Config::~Config() {
+ STLDeleteElements(&key_exchanges);
+}
} // namespace net
diff --git a/net/quic/crypto/quic_crypto_server_config.h b/net/quic/crypto/quic_crypto_server_config.h
index d795df1..68aa3b5 100644
--- a/net/quic/crypto/quic_crypto_server_config.h
+++ b/net/quic/crypto/quic_crypto_server_config.h
@@ -159,10 +159,9 @@ class NET_EXPORT_PRIVATE QuicCryptoServerConfig {
// Generates a QuicServerConfigProtobuf protobuf suitable for
// AddConfig and SetConfigs.
- static QuicServerConfigProtobuf* GenerateConfig(
- QuicRandom* rand,
- const QuicClock* clock,
- const ConfigOptions& options);
+ static QuicServerConfigProtobuf* GenerateConfig(QuicRandom* rand,
+ const QuicClock* clock,
+ const ConfigOptions& options);
// AddConfig adds a QuicServerConfigProtobuf to the availible configurations.
// It returns the SCFG message from the config if successful. The caller
@@ -175,10 +174,9 @@ class NET_EXPORT_PRIVATE QuicCryptoServerConfig {
// AddDefaultConfig calls DefaultConfig to create a config and then calls
// AddConfig to add it. See the comment for |DefaultConfig| for details of
// the arguments.
- CryptoHandshakeMessage* AddDefaultConfig(
- QuicRandom* rand,
- const QuicClock* clock,
- const ConfigOptions& options);
+ CryptoHandshakeMessage* AddDefaultConfig(QuicRandom* rand,
+ const QuicClock* clock,
+ const ConfigOptions& options);
// SetConfigs takes a vector of config protobufs and the current time.
// Configs are assumed to be uniquely identified by their server config ID.
@@ -423,7 +421,7 @@ class NET_EXPORT_PRIVATE QuicCryptoServerConfig {
DISALLOW_COPY_AND_ASSIGN(Config);
};
- typedef std::map<ServerConfigID, scoped_refptr<Config> > ConfigMap;
+ typedef std::map<ServerConfigID, scoped_refptr<Config>> ConfigMap;
// Get a ref to the config with a given server config id.
scoped_refptr<Config> GetConfigWithScid(
diff --git a/net/quic/crypto/quic_crypto_server_config_test.cc b/net/quic/crypto/quic_crypto_server_config_test.cc
index 21c338d..f02a132 100644
--- a/net/quic/crypto/quic_crypto_server_config_test.cc
+++ b/net/quic/crypto/quic_crypto_server_config_test.cc
@@ -187,9 +187,7 @@ class QuicCryptoServerConfigPeer {
class TestStrikeRegisterClient : public StrikeRegisterClient {
public:
explicit TestStrikeRegisterClient(QuicCryptoServerConfig* config)
- : config_(config),
- is_known_orbit_called_(false) {
- }
+ : config_(config), is_known_orbit_called_(false) {}
bool IsKnownOrbit(StringPiece orbit) const override {
// Ensure that the strike register client lock is not held.
@@ -223,9 +221,8 @@ TEST(QuicCryptoServerConfigTest, ServerConfig) {
CryptoTestUtils::ProofSourceForTesting());
MockClock clock;
- scoped_ptr<CryptoHandshakeMessage>(
- server.AddDefaultConfig(rand, &clock,
- QuicCryptoServerConfig::ConfigOptions()));
+ scoped_ptr<CryptoHandshakeMessage>(server.AddDefaultConfig(
+ rand, &clock, QuicCryptoServerConfig::ConfigOptions()));
}
TEST(QuicCryptoServerConfigTest, GetOrbitIsCalledWithoutTheStrikeRegisterLock) {
@@ -462,8 +459,7 @@ class CryptoServerConfigsTest : public ::testing::Test {
config_(QuicCryptoServerConfig::TESTING,
rand_,
CryptoTestUtils::ProofSourceForTesting()),
- test_peer_(&config_) {
- }
+ test_peer_(&config_) {}
void SetUp() override {
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1000));
@@ -546,221 +542,99 @@ TEST_F(CryptoServerConfigsTest, NoConfigs) {
TEST_F(CryptoServerConfigsTest, MakePrimaryFirst) {
// Make sure that "b" is primary even though "a" comes first.
- SetConfigs("a", 1100, 1,
- "b", 900, 1,
- nullptr);
- test_peer_.CheckConfigs(
- "a", false,
- "b", true,
- nullptr);
+ SetConfigs("a", 1100, 1, "b", 900, 1, nullptr);
+ test_peer_.CheckConfigs("a", false, "b", true, nullptr);
}
TEST_F(CryptoServerConfigsTest, MakePrimarySecond) {
// Make sure that a remains primary after b is added.
- SetConfigs("a", 900, 1,
- "b", 1100, 1,
- nullptr);
- test_peer_.CheckConfigs(
- "a", true,
- "b", false,
- nullptr);
+ SetConfigs("a", 900, 1, "b", 1100, 1, nullptr);
+ test_peer_.CheckConfigs("a", true, "b", false, nullptr);
}
TEST_F(CryptoServerConfigsTest, Delete) {
// Ensure that configs get deleted when removed.
- SetConfigs("a", 800, 1,
- "b", 900, 1,
- "c", 1100, 1,
- nullptr);
- test_peer_.CheckConfigs(
- "a", false,
- "b", true,
- "c", false,
- nullptr);
- SetConfigs("b", 900, 1,
- "c", 1100, 1,
- nullptr);
- test_peer_.CheckConfigs(
- "b", true,
- "c", false,
- nullptr);
+ SetConfigs("a", 800, 1, "b", 900, 1, "c", 1100, 1, nullptr);
+ test_peer_.CheckConfigs("a", false, "b", true, "c", false, nullptr);
+ SetConfigs("b", 900, 1, "c", 1100, 1, nullptr);
+ test_peer_.CheckConfigs("b", true, "c", false, nullptr);
}
TEST_F(CryptoServerConfigsTest, DeletePrimary) {
// Ensure that deleting the primary config works.
- SetConfigs("a", 800, 1,
- "b", 900, 1,
- "c", 1100, 1,
- nullptr);
- test_peer_.CheckConfigs(
- "a", false,
- "b", true,
- "c", false,
- nullptr);
- SetConfigs("a", 800, 1,
- "c", 1100, 1,
- nullptr);
- test_peer_.CheckConfigs(
- "a", true,
- "c", false,
- nullptr);
+ SetConfigs("a", 800, 1, "b", 900, 1, "c", 1100, 1, nullptr);
+ test_peer_.CheckConfigs("a", false, "b", true, "c", false, nullptr);
+ SetConfigs("a", 800, 1, "c", 1100, 1, nullptr);
+ test_peer_.CheckConfigs("a", true, "c", false, nullptr);
}
TEST_F(CryptoServerConfigsTest, FailIfDeletingAllConfigs) {
// Ensure that configs get deleted when removed.
- SetConfigs("a", 800, 1,
- "b", 900, 1,
- nullptr);
- test_peer_.CheckConfigs(
- "a", false,
- "b", true,
- nullptr);
+ SetConfigs("a", 800, 1, "b", 900, 1, nullptr);
+ test_peer_.CheckConfigs("a", false, "b", true, nullptr);
SetConfigs(nullptr);
// Config change is rejected, still using old configs.
- test_peer_.CheckConfigs(
- "a", false,
- "b", true,
- nullptr);
+ test_peer_.CheckConfigs("a", false, "b", true, nullptr);
}
TEST_F(CryptoServerConfigsTest, ChangePrimaryTime) {
// Check that updates to primary time get picked up.
- SetConfigs("a", 400, 1,
- "b", 800, 1,
- "c", 1200, 1,
- nullptr);
+ SetConfigs("a", 400, 1, "b", 800, 1, "c", 1200, 1, nullptr);
test_peer_.SelectNewPrimaryConfig(500);
- test_peer_.CheckConfigs(
- "a", true,
- "b", false,
- "c", false,
- nullptr);
- SetConfigs("a", 1200, 1,
- "b", 800, 1,
- "c", 400, 1,
- nullptr);
+ test_peer_.CheckConfigs("a", true, "b", false, "c", false, nullptr);
+ SetConfigs("a", 1200, 1, "b", 800, 1, "c", 400, 1, nullptr);
test_peer_.SelectNewPrimaryConfig(500);
- test_peer_.CheckConfigs(
- "a", false,
- "b", false,
- "c", true,
- nullptr);
+ test_peer_.CheckConfigs("a", false, "b", false, "c", true, nullptr);
}
TEST_F(CryptoServerConfigsTest, AllConfigsInThePast) {
// Check that the most recent config is selected.
- SetConfigs("a", 400, 1,
- "b", 800, 1,
- "c", 1200, 1,
- nullptr);
+ SetConfigs("a", 400, 1, "b", 800, 1, "c", 1200, 1, nullptr);
test_peer_.SelectNewPrimaryConfig(1500);
- test_peer_.CheckConfigs(
- "a", false,
- "b", false,
- "c", true,
- nullptr);
+ test_peer_.CheckConfigs("a", false, "b", false, "c", true, nullptr);
}
TEST_F(CryptoServerConfigsTest, AllConfigsInTheFuture) {
// Check that the first config is selected.
- SetConfigs("a", 400, 1,
- "b", 800, 1,
- "c", 1200, 1,
- nullptr);
+ SetConfigs("a", 400, 1, "b", 800, 1, "c", 1200, 1, nullptr);
test_peer_.SelectNewPrimaryConfig(100);
- test_peer_.CheckConfigs(
- "a", true,
- "b", false,
- "c", false,
- nullptr);
+ test_peer_.CheckConfigs("a", true, "b", false, "c", false, nullptr);
}
TEST_F(CryptoServerConfigsTest, SortByPriority) {
// Check that priority is used to decide on a primary config when
// configs have the same primary time.
- SetConfigs("a", 900, 1,
- "b", 900, 2,
- "c", 900, 3,
- nullptr);
- test_peer_.CheckConfigs(
- "a", true,
- "b", false,
- "c", false,
- nullptr);
+ SetConfigs("a", 900, 1, "b", 900, 2, "c", 900, 3, nullptr);
+ test_peer_.CheckConfigs("a", true, "b", false, "c", false, nullptr);
test_peer_.SelectNewPrimaryConfig(800);
- test_peer_.CheckConfigs(
- "a", true,
- "b", false,
- "c", false,
- nullptr);
+ test_peer_.CheckConfigs("a", true, "b", false, "c", false, nullptr);
test_peer_.SelectNewPrimaryConfig(1000);
- test_peer_.CheckConfigs(
- "a", true,
- "b", false,
- "c", false,
- nullptr);
+ test_peer_.CheckConfigs("a", true, "b", false, "c", false, nullptr);
// Change priorities and expect sort order to change.
- SetConfigs("a", 900, 2,
- "b", 900, 1,
- "c", 900, 0,
- nullptr);
- test_peer_.CheckConfigs(
- "a", false,
- "b", false,
- "c", true,
- nullptr);
+ SetConfigs("a", 900, 2, "b", 900, 1, "c", 900, 0, nullptr);
+ test_peer_.CheckConfigs("a", false, "b", false, "c", true, nullptr);
test_peer_.SelectNewPrimaryConfig(800);
- test_peer_.CheckConfigs(
- "a", false,
- "b", false,
- "c", true,
- nullptr);
+ test_peer_.CheckConfigs("a", false, "b", false, "c", true, nullptr);
test_peer_.SelectNewPrimaryConfig(1000);
- test_peer_.CheckConfigs(
- "a", false,
- "b", false,
- "c", true,
- nullptr);
+ test_peer_.CheckConfigs("a", false, "b", false, "c", true, nullptr);
}
TEST_F(CryptoServerConfigsTest, AdvancePrimary) {
// Check that a new primary config is enabled at the right time.
- SetConfigs("a", 900, 1,
- "b", 1100, 1,
- nullptr);
+ SetConfigs("a", 900, 1, "b", 1100, 1, nullptr);
test_peer_.SelectNewPrimaryConfig(1000);
- test_peer_.CheckConfigs(
- "a", true,
- "b", false,
- nullptr);
+ test_peer_.CheckConfigs("a", true, "b", false, nullptr);
test_peer_.SelectNewPrimaryConfig(1101);
- test_peer_.CheckConfigs(
- "a", false,
- "b", true,
- nullptr);
+ test_peer_.CheckConfigs("a", false, "b", true, nullptr);
}
TEST_F(CryptoServerConfigsTest, InvalidConfigs) {
// Ensure that invalid configs don't change anything.
- SetConfigs("a", 800, 1,
- "b", 900, 1,
- "c", 1100, 1,
- nullptr);
- test_peer_.CheckConfigs(
- "a", false,
- "b", true,
- "c", false,
- nullptr);
- SetConfigs("a", 800, 1,
- "c", 1100, 1,
- "INVALID1", 1000, 1,
- nullptr);
- test_peer_.CheckConfigs(
- "a", false,
- "b", true,
- "c", false,
- nullptr);
+ SetConfigs("a", 800, 1, "b", 900, 1, "c", 1100, 1, nullptr);
+ test_peer_.CheckConfigs("a", false, "b", true, "c", false, nullptr);
+ SetConfigs("a", 800, 1, "c", 1100, 1, "INVALID1", 1000, 1, nullptr);
+ test_peer_.CheckConfigs("a", false, "b", true, "c", false, nullptr);
}
} // namespace test
diff --git a/net/quic/crypto/quic_random.cc b/net/quic/crypto/quic_random.cc
index 941b389..5670e34 100644
--- a/net/quic/crypto/quic_random.cc
+++ b/net/quic/crypto/quic_random.cc
@@ -22,7 +22,7 @@ class DefaultRandom : public QuicRandom {
void Reseed(const void* additional_entropy, size_t entropy_len) override;
private:
- DefaultRandom() {};
+ DefaultRandom() {}
~DefaultRandom() override {}
friend struct base::DefaultSingletonTraits<DefaultRandom>;
@@ -50,6 +50,8 @@ void DefaultRandom::Reseed(const void* additional_entropy, size_t entropy_len) {
} // namespace
// static
-QuicRandom* QuicRandom::GetInstance() { return DefaultRandom::GetInstance(); }
+QuicRandom* QuicRandom::GetInstance() {
+ return DefaultRandom::GetInstance();
+}
} // namespace net
diff --git a/net/quic/crypto/quic_server_info.cc b/net/quic/crypto/quic_server_info.cc
index 4011151..6c6fff9 100644
--- a/net/quic/crypto/quic_server_info.cc
+++ b/net/quic/crypto/quic_server_info.cc
@@ -30,11 +30,9 @@ void QuicServerInfo::State::Clear() {
}
QuicServerInfo::QuicServerInfo(const QuicServerId& server_id)
- : server_id_(server_id) {
-}
+ : server_id_(server_id) {}
-QuicServerInfo::~QuicServerInfo() {
-}
+QuicServerInfo::~QuicServerInfo() {}
const QuicServerInfo::State& QuicServerInfo::state() const {
return state_;
@@ -133,7 +131,7 @@ string QuicServerInfo::SerializeInner() const {
}
}
- return string(reinterpret_cast<const char *>(p.data()), p.size());
+ return string(reinterpret_cast<const char*>(p.data()), p.size());
}
QuicServerInfoFactory::~QuicServerInfoFactory() {}
diff --git a/net/quic/crypto/strike_register.cc b/net/quic/crypto/strike_register.cc
index d521adb..2b995a4 100644
--- a/net/quic/crypto/strike_register.cc
+++ b/net/quic/crypto/strike_register.cc
@@ -98,8 +98,9 @@ StrikeRegister::StrikeRegister(unsigned max_entries,
internal_epoch_(current_time > kCreationTimeFromInternalEpoch
? current_time - kCreationTimeFromInternalEpoch
: 0),
- horizon_(GetInitialHorizon(
- ExternalTimeToInternal(current_time), window_secs, startup)) {
+ horizon_(GetInitialHorizon(ExternalTimeToInternal(current_time),
+ window_secs,
+ startup)) {
memcpy(orbit_, orbit, sizeof(orbit_));
ValidateStrikeRegisterConfig(max_entries);
@@ -109,7 +110,9 @@ StrikeRegister::StrikeRegister(unsigned max_entries,
Reset();
}
-StrikeRegister::~StrikeRegister() { delete[] internal_nodes_; }
+StrikeRegister::~StrikeRegister() {
+ delete[] internal_nodes_;
+}
void StrikeRegister::Reset() {
// Thread a free list through all of the internal nodes.
@@ -133,8 +136,7 @@ void StrikeRegister::Reset() {
InsertStatus StrikeRegister::Insert(const uint8 nonce[32],
uint32 current_time_external) {
// Make space for the insertion if the strike register is full.
- while (external_node_free_head_ == kNil ||
- internal_node_free_head_ == kNil) {
+ while (external_node_free_head_ == kNil || internal_node_free_head_ == kNil) {
DropOldestNode();
}
@@ -274,8 +276,8 @@ const uint8* StrikeRegister::orbit() const {
uint32 StrikeRegister::GetCurrentValidWindowSecs(
uint32 current_time_external) const {
uint32 current_time = ExternalTimeToInternal(current_time_external);
- pair<uint32, uint32> valid_range = StrikeRegister::GetValidRange(
- current_time);
+ pair<uint32, uint32> valid_range =
+ StrikeRegister::GetValidRange(current_time);
if (valid_range.second >= valid_range.first) {
return valid_range.second - current_time + 1;
} else {
@@ -314,10 +316,8 @@ void StrikeRegister::Validate() {
// static
uint32 StrikeRegister::TimeFromBytes(const uint8 d[4]) {
- return static_cast<uint32>(d[0]) << 24 |
- static_cast<uint32>(d[1]) << 16 |
- static_cast<uint32>(d[2]) << 8 |
- static_cast<uint32>(d[3]);
+ return static_cast<uint32>(d[0]) << 24 | static_cast<uint32>(d[1]) << 16 |
+ static_cast<uint32>(d[2]) << 8 | static_cast<uint32>(d[3]);
}
pair<uint32, uint32> StrikeRegister::GetValidRange(
@@ -498,8 +498,8 @@ void StrikeRegister::ValidateTree(uint32 internal_node,
unsigned byte = pair.first / 8;
DCHECK_LE(byte, 0xffu);
unsigned bit_new = pair.first % 8;
- static const uint8 kMasks[8] =
- {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
+ static const uint8 kMasks[8] = {0x80, 0x40, 0x20, 0x10,
+ 0x08, 0x04, 0x02, 0x01};
CHECK_EQ((bytes[byte] & kMasks[bit_new]) != 0, pair.second);
}
} else {
diff --git a/net/quic/crypto/strike_register_client.h b/net/quic/crypto/strike_register_client.h
index dae3519..6a9dbd8 100644
--- a/net/quic/crypto/strike_register_client.h
+++ b/net/quic/crypto/strike_register_client.h
@@ -47,10 +47,9 @@ class NET_EXPORT_PRIVATE StrikeRegisterClient {
// Will invoke cb->Run(ValidateResponse::nonce_is_valid_and_unique(),
// ValidateResponse::nonce_error())
// once the asynchronous operation is complete.
- virtual void VerifyNonceIsValidAndUnique(
- base::StringPiece nonce,
- QuicWallTime now,
- ResultCallback* cb) = 0;
+ virtual void VerifyNonceIsValidAndUnique(base::StringPiece nonce,
+ QuicWallTime now,
+ ResultCallback* cb) = 0;
private:
DISALLOW_COPY_AND_ASSIGN(StrikeRegisterClient);
diff --git a/net/quic/crypto/strike_register_test.cc b/net/quic/crypto/strike_register_test.cc
index cbb189a..4f5aef8 100644
--- a/net/quic/crypto/strike_register_test.cc
+++ b/net/quic/crypto/strike_register_test.cc
@@ -20,7 +20,7 @@ using std::pair;
using std::set;
using std::string;
-const uint8 kOrbit[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
+const uint8 kOrbit[8] = {1, 2, 3, 4, 5, 6, 7, 8};
// StrikeRegisterTests don't look at the random bytes so this function can
// simply set the random bytes to 0.
@@ -88,7 +88,7 @@ TEST(StrikeRegisterTest, BadOrbit) {
100 /* window secs */, kOrbit,
StrikeRegister::DENY_REQUESTS_AT_STARTUP);
uint8 nonce[32];
- static const uint8 kBadOrbit[8] = { 0, 0, 0, 0, 1, 1, 1, 1 };
+ static const uint8 kBadOrbit[8] = {0, 0, 0, 0, 1, 1, 1, 1};
SetNonce(nonce, 1101, kBadOrbit);
EXPECT_EQ(NONCE_INVALID_ORBIT_FAILURE, set.Insert(nonce, 1100));
}
@@ -115,14 +115,12 @@ TEST(StrikeRegisterTest, RejectDuplicate) {
TEST(StrikeRegisterTest, HorizonUpdating) {
StrikeRegister::StartupType startup_types[] = {
- StrikeRegister::DENY_REQUESTS_AT_STARTUP,
- StrikeRegister::NO_STARTUP_PERIOD_NEEDED
- };
+ StrikeRegister::DENY_REQUESTS_AT_STARTUP,
+ StrikeRegister::NO_STARTUP_PERIOD_NEEDED};
for (size_t type_idx = 0; type_idx < arraysize(startup_types); ++type_idx) {
StrikeRegister set(5 /* max size */, 500 /* current time */,
- 100 /* window secs */, kOrbit,
- startup_types[type_idx]);
+ 100 /* window secs */, kOrbit, startup_types[type_idx]);
uint8 nonce[6][32];
for (unsigned i = 0; i < 5; i++) {
SetNonce(nonce[i], 1101 + i, kOrbit);
@@ -175,13 +173,12 @@ TEST(StrikeRegisterTest, InsertMany) {
uint8 nonce[32];
SetNonce(nonce, 1101, kOrbit);
for (unsigned i = 0; i < 100000; i++) {
- SetNonce(nonce, 1101 + i/500, kOrbit);
+ SetNonce(nonce, 1101 + i / 500, kOrbit);
memcpy(nonce + 12, &i, sizeof(i));
EXPECT_EQ(NONCE_INVALID_TIME_FAILURE, set.Insert(nonce, 1100));
}
}
-
// For the following test we create a slow, but simple, version of a
// StrikeRegister. The behaviour of this object is much easier to understand
// than the fully fledged version. We then create a test to show, empirically,
@@ -192,8 +189,10 @@ TEST(StrikeRegisterTest, InsertMany) {
// empirically test that their behaviours are identical.
class SlowStrikeRegister {
public:
- SlowStrikeRegister(unsigned max_entries, uint32 current_time,
- uint32 window_secs, const uint8 orbit[8])
+ SlowStrikeRegister(unsigned max_entries,
+ uint32 current_time,
+ uint32 window_secs,
+ const uint8 orbit[8])
: max_entries_(max_entries),
window_secs_(window_secs),
creation_time_(current_time),
@@ -254,10 +253,8 @@ class SlowStrikeRegister {
private:
// TimeFromBytes returns a big-endian uint32 from |d|.
static uint32 TimeFromBytes(const uint8 d[4]) {
- return static_cast<uint32>(d[0]) << 24 |
- static_cast<uint32>(d[1]) << 16 |
- static_cast<uint32>(d[2]) << 8 |
- static_cast<uint32>(d[3]);
+ return static_cast<uint32>(d[0]) << 24 | static_cast<uint32>(d[1]) << 16 |
+ static_cast<uint32>(d[2]) << 8 | static_cast<uint32>(d[3]);
}
uint32 ExternalTimeToInternal(uint32 external_time) const {
@@ -285,8 +282,7 @@ class SlowStrikeRegister {
set<pair<uint32, string>> nonces_;
};
-class StrikeRegisterStressTest : public ::testing::Test {
-};
+class StrikeRegisterStressTest : public ::testing::Test {};
TEST_F(StrikeRegisterStressTest, InOrderInsertion) {
// Fixed seed gives reproducibility for this test.
diff --git a/net/quic/iovector.h b/net/quic/iovector.h
index fcf50e8..ae9230a 100644
--- a/net/quic/iovector.h
+++ b/net/quic/iovector.h
@@ -118,7 +118,8 @@ class NET_EXPORT_PRIVATE IOVector {
// It returns the number of bytes actually consumed (it'll only be smaller
// than the requested number if the IOVector contains less data).
size_t Consume(size_t length) {
- if (length == 0) return 0;
+ if (length == 0)
+ return 0;
size_t bytes_to_consume = length;
std::vector<struct iovec>::iterator iter = iovec_.begin();
@@ -198,7 +199,9 @@ class NET_EXPORT_PRIVATE IOVector {
// Returns the pointer to the beginning of the iovec to be used for vector
// I/O operations. If the IOVector has no blocks appened, this function
// returns NULL.
- struct iovec* iovec() { return !Empty() ? &iovec_[0] : NULL; }
+ struct iovec* iovec() {
+ return !Empty() ? &iovec_[0] : NULL;
+ }
// Const version.
const struct iovec* iovec() const { return !Empty() ? &iovec_[0] : NULL; }
@@ -206,17 +209,16 @@ class NET_EXPORT_PRIVATE IOVector {
// Returns a pointer to one past the last byte of the last block. If the
// IOVector is empty, NULL is returned.
const char* LastBlockEnd() const {
- return iovec_.size() > 0 ?
- static_cast<char *>(iovec_.back().iov_base) + iovec_.back().iov_len :
- NULL;
+ return iovec_.size() > 0
+ ? static_cast<char*>(iovec_.back().iov_base) +
+ iovec_.back().iov_len
+ : NULL;
}
// Returns the total number of bytes in the IOVector.
size_t TotalBufferSize() const { return TotalIovecLength(iovec(), Size()); }
- void Resize(size_t count) {
- iovec_.resize(count);
- }
+ void Resize(size_t count) { iovec_.resize(count); }
private:
std::vector<struct iovec> iovec_;
diff --git a/net/quic/iovector_test.cc b/net/quic/iovector_test.cc
index f25ae1b..7a1d00a 100644
--- a/net/quic/iovector_test.cc
+++ b/net/quic/iovector_test.cc
@@ -18,10 +18,8 @@ namespace test {
namespace {
const char* const test_data[] = {
- "test string 1, a medium size one.",
- "test string2",
- "test string 3, a looooooooooooong loooooooooooooooong string"
-};
+ "test string 1, a medium size one.", "test string2",
+ "test string 3, a looooooooooooong loooooooooooooooong string"};
TEST(IOVectorTest, CopyConstructor) {
IOVector iov1;
@@ -88,11 +86,9 @@ TEST(IOVectorTest, Append) {
TEST(IOVectorTest, AppendIovec) {
IOVector iov;
- const struct iovec test_iov[] = {
- {const_cast<char*>("foo"), 3},
- {const_cast<char*>("bar"), 3},
- {const_cast<char*>("buzzzz"), 6}
- };
+ const struct iovec test_iov[] = {{const_cast<char*>("foo"), 3},
+ {const_cast<char*>("bar"), 3},
+ {const_cast<char*>("buzzzz"), 6}};
iov.AppendIovec(test_iov, arraysize(test_iov));
for (size_t i = 0; i < arraysize(test_iov); ++i) {
EXPECT_EQ(test_iov[i].iov_base, iov.iovec()[i].iov_base);
@@ -199,9 +195,8 @@ TEST(IOVectorTest, ConsumeTooMuch) {
}
int consumed = 0;
- EXPECT_DFATAL(
- {consumed = iov.Consume(length + 1);},
- "Attempting to consume 1 non-existent bytes.");
+ EXPECT_DFATAL({ consumed = iov.Consume(length + 1); },
+ "Attempting to consume 1 non-existent bytes.");
ASSERT_EQ(length, consumed);
const struct iovec* iov2 = iov.iovec();
ASSERT_EQ(0u, iov.Size());
diff --git a/net/quic/network_connection.cc b/net/quic/network_connection.cc
index 8984b16..a105b90 100644
--- a/net/quic/network_connection.cc
+++ b/net/quic/network_connection.cc
@@ -10,8 +10,7 @@ namespace net {
NetworkConnection::NetworkConnection()
: connection_type_(NetworkChangeNotifier::CONNECTION_UNKNOWN),
- connection_description_(nullptr) {
-}
+ connection_description_(nullptr) {}
const char* NetworkConnection::GetDescription() {
NetworkChangeNotifier::ConnectionType type =
diff --git a/net/quic/port_suggester.cc b/net/quic/port_suggester.cc
index b1dfa48..b556a24 100644
--- a/net/quic/port_suggester.cc
+++ b/net/quic/port_suggester.cc
@@ -10,8 +10,7 @@
namespace net {
PortSuggester::PortSuggester(const HostPortPair& server, uint64 seed)
- : call_count_(0),
- previous_suggestion_(-1) {
+ : call_count_(0), previous_suggestion_(-1) {
unsigned char hash_bytes[base::kSHA1Length];
base::SHA1HashBytes(
reinterpret_cast<const unsigned char*>(server.host().data()),
@@ -27,7 +26,7 @@ int PortSuggester::SuggestPort(int min, int max) {
if (++call_count_ > 1) {
// Evolve the seed.
unsigned char hash_bytes[base::kSHA1Length];
- base::SHA1HashBytes(reinterpret_cast<const unsigned char *>(&seed_),
+ base::SHA1HashBytes(reinterpret_cast<const unsigned char*>(&seed_),
sizeof(seed_), hash_bytes);
memcpy(&seed_, hash_bytes, sizeof(seed_));
}
diff --git a/net/quic/port_suggester_unittest.cc b/net/quic/port_suggester_unittest.cc
index add5258..093719a 100644
--- a/net/quic/port_suggester_unittest.cc
+++ b/net/quic/port_suggester_unittest.cc
@@ -18,8 +18,7 @@ class PortSuggesterTest : public ::testing::Test {
PortSuggesterTest()
: entropy_(1345689),
min_ephemeral_port_(1025),
- max_ephemeral_port_(65535) {
- }
+ max_ephemeral_port_(65535) {}
uint64 entropy_;
int min_ephemeral_port_;
@@ -47,8 +46,8 @@ TEST_F(PortSuggesterTest, SuggestAllPorts) {
const uint32 port_range = 20;
const int insertion_limit = 200; // We should be done by then.
for (int i = 0; i < insertion_limit; ++i) {
- ports.insert(port_suggester->SuggestPort(min_ephemeral_port_,
- min_ephemeral_port_ + port_range - 1));
+ ports.insert(port_suggester->SuggestPort(
+ min_ephemeral_port_, min_ephemeral_port_ + port_range - 1));
if (ports.size() == port_range) {
break;
}
@@ -64,8 +63,8 @@ TEST_F(PortSuggesterTest, AvoidDuplication) {
std::set<int> ports;
const size_t port_count = 200;
for (size_t i = 0; i < port_count; ++i) {
- ports.insert(port_suggester->SuggestPort(min_ephemeral_port_,
- max_ephemeral_port_));
+ ports.insert(
+ port_suggester->SuggestPort(min_ephemeral_port_, max_ephemeral_port_));
}
EXPECT_EQ(port_suggester->call_count(), port_count);
EXPECT_EQ(port_count, ports.size());
@@ -79,10 +78,9 @@ TEST_F(PortSuggesterTest, ConsistentPorts) {
scoped_refptr<PortSuggester> port_suggester2 =
new PortSuggester(HostPortPair("www.example.com", 443), entropy_);
for (int test_count = 20; test_count > 0; --test_count) {
- EXPECT_EQ(port_suggester1->SuggestPort(min_ephemeral_port_,
- min_ephemeral_port_),
- port_suggester2->SuggestPort(min_ephemeral_port_,
- min_ephemeral_port_));
+ EXPECT_EQ(
+ port_suggester1->SuggestPort(min_ephemeral_port_, min_ephemeral_port_),
+ port_suggester2->SuggestPort(min_ephemeral_port_, min_ephemeral_port_));
}
}
@@ -100,9 +98,9 @@ TEST_F(PortSuggesterTest, DifferentHostPortEntropy) {
size_t insertion_count = 0;
for (size_t j = 0; j < arraysize(port_suggester); ++j) {
for (int i = 0; i < port_count; ++i) {
- ports.insert(port_suggester[j]->SuggestPort(min_ephemeral_port_,
- max_ephemeral_port_));
- ++insertion_count;
+ ports.insert(port_suggester[j]->SuggestPort(min_ephemeral_port_,
+ max_ephemeral_port_));
+ ++insertion_count;
}
}
EXPECT_EQ(insertion_count, ports.size());
diff --git a/net/quic/quic_address_mismatch_test.cc b/net/quic/quic_address_mismatch_test.cc
index b7c683b..02f3dcc 100644
--- a/net/quic/quic_address_mismatch_test.cc
+++ b/net/quic/quic_address_mismatch_test.cc
@@ -34,8 +34,7 @@ TEST(QuicAddressMismatchTest, GetAddressMismatch) {
EXPECT_EQ(-1, GetAddressMismatch(IPEndPoint(ip4_1, 443), IPEndPoint()));
EXPECT_EQ(QUIC_ADDRESS_AND_PORT_MATCH_V4_V4,
- GetAddressMismatch(IPEndPoint(ip4_1, 443),
- IPEndPoint(ip4_1, 443)));
+ GetAddressMismatch(IPEndPoint(ip4_1, 443), IPEndPoint(ip4_1, 443)));
EXPECT_EQ(QUIC_ADDRESS_AND_PORT_MATCH_V4_V4,
GetAddressMismatch(IPEndPoint(ip4_1, 443),
IPEndPoint(ip4_mapped_1, 443)));
@@ -43,25 +42,21 @@ TEST(QuicAddressMismatchTest, GetAddressMismatch) {
GetAddressMismatch(IPEndPoint(ip4_mapped_1, 443),
IPEndPoint(ip4_mapped_1, 443)));
EXPECT_EQ(QUIC_ADDRESS_AND_PORT_MATCH_V6_V6,
- GetAddressMismatch(IPEndPoint(ip6_1, 443),
- IPEndPoint(ip6_1, 443)));
+ GetAddressMismatch(IPEndPoint(ip6_1, 443), IPEndPoint(ip6_1, 443)));
EXPECT_EQ(QUIC_PORT_MISMATCH_V4_V4,
- GetAddressMismatch(IPEndPoint(ip4_1, 80),
- IPEndPoint(ip4_1, 443)));
- EXPECT_EQ(QUIC_PORT_MISMATCH_V4_V4,
- GetAddressMismatch(IPEndPoint(ip4_1, 80),
- IPEndPoint(ip4_mapped_1, 443)));
+ GetAddressMismatch(IPEndPoint(ip4_1, 80), IPEndPoint(ip4_1, 443)));
+ EXPECT_EQ(
+ QUIC_PORT_MISMATCH_V4_V4,
+ GetAddressMismatch(IPEndPoint(ip4_1, 80), IPEndPoint(ip4_mapped_1, 443)));
EXPECT_EQ(QUIC_PORT_MISMATCH_V4_V4,
GetAddressMismatch(IPEndPoint(ip4_mapped_1, 80),
IPEndPoint(ip4_mapped_1, 443)));
EXPECT_EQ(QUIC_PORT_MISMATCH_V6_V6,
- GetAddressMismatch(IPEndPoint(ip6_1, 80),
- IPEndPoint(ip6_1, 443)));
+ GetAddressMismatch(IPEndPoint(ip6_1, 80), IPEndPoint(ip6_1, 443)));
EXPECT_EQ(QUIC_ADDRESS_MISMATCH_V4_V4,
- GetAddressMismatch(IPEndPoint(ip4_1, 443),
- IPEndPoint(ip4_2, 443)));
+ GetAddressMismatch(IPEndPoint(ip4_1, 443), IPEndPoint(ip4_2, 443)));
EXPECT_EQ(QUIC_ADDRESS_MISMATCH_V4_V4,
GetAddressMismatch(IPEndPoint(ip4_1, 443),
IPEndPoint(ip4_mapped_2, 443)));
@@ -69,44 +64,37 @@ TEST(QuicAddressMismatchTest, GetAddressMismatch) {
GetAddressMismatch(IPEndPoint(ip4_mapped_1, 443),
IPEndPoint(ip4_mapped_2, 443)));
EXPECT_EQ(QUIC_ADDRESS_MISMATCH_V4_V4,
- GetAddressMismatch(IPEndPoint(ip4_1, 80),
- IPEndPoint(ip4_2, 443)));
- EXPECT_EQ(QUIC_ADDRESS_MISMATCH_V4_V4,
- GetAddressMismatch(IPEndPoint(ip4_1, 80),
- IPEndPoint(ip4_mapped_2, 443)));
+ GetAddressMismatch(IPEndPoint(ip4_1, 80), IPEndPoint(ip4_2, 443)));
+ EXPECT_EQ(
+ QUIC_ADDRESS_MISMATCH_V4_V4,
+ GetAddressMismatch(IPEndPoint(ip4_1, 80), IPEndPoint(ip4_mapped_2, 443)));
EXPECT_EQ(QUIC_ADDRESS_MISMATCH_V4_V4,
GetAddressMismatch(IPEndPoint(ip4_mapped_1, 80),
IPEndPoint(ip4_mapped_2, 443)));
EXPECT_EQ(QUIC_ADDRESS_MISMATCH_V6_V6,
- GetAddressMismatch(IPEndPoint(ip6_1, 443),
- IPEndPoint(ip6_2, 443)));
+ GetAddressMismatch(IPEndPoint(ip6_1, 443), IPEndPoint(ip6_2, 443)));
EXPECT_EQ(QUIC_ADDRESS_MISMATCH_V6_V6,
- GetAddressMismatch(IPEndPoint(ip6_1, 80),
- IPEndPoint(ip6_2, 443)));
+ GetAddressMismatch(IPEndPoint(ip6_1, 80), IPEndPoint(ip6_2, 443)));
EXPECT_EQ(QUIC_ADDRESS_MISMATCH_V4_V6,
- GetAddressMismatch(IPEndPoint(ip4_1, 443),
- IPEndPoint(ip6_1, 443)));
+ GetAddressMismatch(IPEndPoint(ip4_1, 443), IPEndPoint(ip6_1, 443)));
EXPECT_EQ(QUIC_ADDRESS_MISMATCH_V4_V6,
GetAddressMismatch(IPEndPoint(ip4_mapped_1, 443),
IPEndPoint(ip6_1, 443)));
EXPECT_EQ(QUIC_ADDRESS_MISMATCH_V4_V6,
- GetAddressMismatch(IPEndPoint(ip4_1, 80),
- IPEndPoint(ip6_1, 443)));
- EXPECT_EQ(QUIC_ADDRESS_MISMATCH_V4_V6,
- GetAddressMismatch(IPEndPoint(ip4_mapped_1, 80),
- IPEndPoint(ip6_1, 443)));
+ GetAddressMismatch(IPEndPoint(ip4_1, 80), IPEndPoint(ip6_1, 443)));
+ EXPECT_EQ(
+ QUIC_ADDRESS_MISMATCH_V4_V6,
+ GetAddressMismatch(IPEndPoint(ip4_mapped_1, 80), IPEndPoint(ip6_1, 443)));
EXPECT_EQ(QUIC_ADDRESS_MISMATCH_V6_V4,
- GetAddressMismatch(IPEndPoint(ip6_1, 443),
- IPEndPoint(ip4_1, 443)));
+ GetAddressMismatch(IPEndPoint(ip6_1, 443), IPEndPoint(ip4_1, 443)));
EXPECT_EQ(QUIC_ADDRESS_MISMATCH_V6_V4,
GetAddressMismatch(IPEndPoint(ip6_1, 443),
IPEndPoint(ip4_mapped_1, 443)));
EXPECT_EQ(QUIC_ADDRESS_MISMATCH_V6_V4,
- GetAddressMismatch(IPEndPoint(ip6_1, 80),
- IPEndPoint(ip4_1, 443)));
- EXPECT_EQ(QUIC_ADDRESS_MISMATCH_V6_V4,
- GetAddressMismatch(IPEndPoint(ip6_1, 80),
- IPEndPoint(ip4_mapped_1, 443)));
+ GetAddressMismatch(IPEndPoint(ip6_1, 80), IPEndPoint(ip4_1, 443)));
+ EXPECT_EQ(
+ QUIC_ADDRESS_MISMATCH_V6_V4,
+ GetAddressMismatch(IPEndPoint(ip6_1, 80), IPEndPoint(ip4_mapped_1, 443)));
}
} // namespace test
diff --git a/net/quic/quic_alarm.cc b/net/quic/quic_alarm.cc
index b5aca8c..6df6492 100644
--- a/net/quic/quic_alarm.cc
+++ b/net/quic/quic_alarm.cc
@@ -9,9 +9,7 @@
namespace net {
QuicAlarm::QuicAlarm(Delegate* delegate)
- : delegate_(delegate),
- deadline_(QuicTime::Zero()) {
-}
+ : delegate_(delegate), deadline_(QuicTime::Zero()) {}
QuicAlarm::~QuicAlarm() {}
@@ -33,7 +31,7 @@ void QuicAlarm::Update(QuicTime deadline, QuicTime::Delta granularity) {
return;
}
if (std::abs(deadline.Subtract(deadline_).ToMicroseconds()) <
- granularity.ToMicroseconds()) {
+ granularity.ToMicroseconds()) {
return;
}
Cancel();
diff --git a/net/quic/quic_alarm_test.cc b/net/quic/quic_alarm_test.cc
index dfd40ed..42d44a2 100644
--- a/net/quic/quic_alarm_test.cc
+++ b/net/quic/quic_alarm_test.cc
@@ -53,12 +53,9 @@ class QuicAlarmTest : public ::testing::Test {
alarm_(delegate_),
deadline_(QuicTime::Zero().Add(QuicTime::Delta::FromSeconds(7))),
deadline2_(QuicTime::Zero().Add(QuicTime::Delta::FromSeconds(14))),
- new_deadline_(QuicTime::Zero()) {
- }
+ new_deadline_(QuicTime::Zero()) {}
- void ResetAlarm() {
- alarm_.Set(new_deadline_);
- }
+ void ResetAlarm() { alarm_.Set(new_deadline_); }
MockDelegate* delegate_; // not owned
TestAlarm alarm_;
@@ -129,9 +126,9 @@ TEST_F(QuicAlarmTest, FireAndResetViaReturn) {
TEST_F(QuicAlarmTest, FireAndResetViaSet) {
alarm_.Set(deadline_);
new_deadline_ = deadline2_;
- EXPECT_CALL(*delegate_, OnAlarm()).WillOnce(DoAll(
- Invoke(this, &QuicAlarmTest::ResetAlarm),
- Return(QuicTime::Zero())));
+ EXPECT_CALL(*delegate_, OnAlarm())
+ .WillOnce(DoAll(Invoke(this, &QuicAlarmTest::ResetAlarm),
+ Return(QuicTime::Zero())));
alarm_.FireAlarm();
EXPECT_TRUE(alarm_.IsSet());
EXPECT_TRUE(alarm_.scheduled());
diff --git a/net/quic/quic_bandwidth_test.cc b/net/quic/quic_bandwidth_test.cc
index 7f07a6a..191405c 100644
--- a/net/quic/quic_bandwidth_test.cc
+++ b/net/quic/quic_bandwidth_test.cc
@@ -8,8 +8,7 @@
namespace net {
namespace test {
-class QuicBandwidthTest : public ::testing::Test {
-};
+class QuicBandwidthTest : public ::testing::Test {};
TEST_F(QuicBandwidthTest, FromTo) {
EXPECT_EQ(QuicBandwidth::FromKBitsPerSecond(1),
@@ -66,16 +65,15 @@ TEST_F(QuicBandwidthTest, Scale) {
QuicBandwidth::FromKBytesPerSecond(1000).Scale(1.25f));
}
-
TEST_F(QuicBandwidthTest, BytesPerPeriod) {
- EXPECT_EQ(2000u, QuicBandwidth::FromKBytesPerSecond(2000).ToBytesPerPeriod(
- QuicTime::Delta::FromMilliseconds(1)));
- EXPECT_EQ(2u, QuicBandwidth::FromKBytesPerSecond(2000).ToKBytesPerPeriod(
- QuicTime::Delta::FromMilliseconds(1)));
+ EXPECT_EQ(2000u, QuicBandwidth::FromKBytesPerSecond(2000)
+ .ToBytesPerPeriod(QuicTime::Delta::FromMilliseconds(1)));
+ EXPECT_EQ(2u, QuicBandwidth::FromKBytesPerSecond(2000)
+ .ToKBytesPerPeriod(QuicTime::Delta::FromMilliseconds(1)));
EXPECT_EQ(200000u, QuicBandwidth::FromKBytesPerSecond(2000).ToBytesPerPeriod(
- QuicTime::Delta::FromMilliseconds(100)));
+ QuicTime::Delta::FromMilliseconds(100)));
EXPECT_EQ(200u, QuicBandwidth::FromKBytesPerSecond(2000).ToKBytesPerPeriod(
- QuicTime::Delta::FromMilliseconds(100)));
+ QuicTime::Delta::FromMilliseconds(100)));
}
TEST_F(QuicBandwidthTest, TransferTime) {
diff --git a/net/quic/quic_client_session_base.cc b/net/quic/quic_client_session_base.cc
index 12173e5..740263d 100644
--- a/net/quic/quic_client_session_base.cc
+++ b/net/quic/quic_client_session_base.cc
@@ -10,8 +10,7 @@ namespace net {
QuicClientSessionBase::QuicClientSessionBase(QuicConnection* connection,
const QuicConfig& config)
- : QuicSpdySession(connection, config) {
-}
+ : QuicSpdySession(connection, config) {}
QuicClientSessionBase::~QuicClientSessionBase() {}
@@ -19,8 +18,7 @@ void QuicClientSessionBase::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) {
QuicSession::OnCryptoHandshakeEvent(event);
// Set FEC policy for streams immediately after sending CHLO and before any
// more data is sent.
- if (!FLAGS_enable_quic_fec ||
- event != ENCRYPTION_FIRST_ESTABLISHED ||
+ if (!FLAGS_enable_quic_fec || event != ENCRYPTION_FIRST_ESTABLISHED ||
!config()->HasSendConnectionOptions() ||
!ContainsQuicTag(config()->SendConnectionOptions(), kFHDR)) {
return;
diff --git a/net/quic/quic_client_session_base.h b/net/quic/quic_client_session_base.h
index 0e3c0fa..1940dc8 100644
--- a/net/quic/quic_client_session_base.h
+++ b/net/quic/quic_client_session_base.h
@@ -13,8 +13,7 @@ namespace net {
// Base class for all client-specific QuicSession subclasses.
class NET_EXPORT_PRIVATE QuicClientSessionBase : public QuicSpdySession {
public:
- QuicClientSessionBase(QuicConnection* connection,
- const QuicConfig& config);
+ QuicClientSessionBase(QuicConnection* connection, const QuicConfig& config);
~QuicClientSessionBase() override;
diff --git a/net/quic/quic_clock.cc b/net/quic/quic_clock.cc
index b20b9c4..61a2716 100644
--- a/net/quic/quic_clock.cc
+++ b/net/quic/quic_clock.cc
@@ -8,8 +8,7 @@
namespace net {
-QuicClock::QuicClock() {
-}
+QuicClock::QuicClock() {}
QuicClock::~QuicClock() {}
diff --git a/net/quic/quic_config.cc b/net/quic/quic_config.cc
index d91fd7b..292e6d9 100644
--- a/net/quic/quic_config.cc
+++ b/net/quic/quic_config.cc
@@ -45,18 +45,13 @@ QuicErrorCode ReadUint32(const CryptoHandshakeMessage& msg,
return error;
}
-QuicConfigValue::QuicConfigValue(QuicTag tag,
- QuicConfigPresence presence)
- : tag_(tag),
- presence_(presence) {
-}
+QuicConfigValue::QuicConfigValue(QuicTag tag, QuicConfigPresence presence)
+ : tag_(tag), presence_(presence) {}
QuicConfigValue::~QuicConfigValue() {}
QuicNegotiableValue::QuicNegotiableValue(QuicTag tag,
QuicConfigPresence presence)
- : QuicConfigValue(tag, presence),
- negotiated_(false) {
-}
+ : QuicConfigValue(tag, presence), negotiated_(false) {}
QuicNegotiableValue::~QuicNegotiableValue() {}
QuicNegotiableUint32::QuicNegotiableUint32(QuicTag tag,
@@ -64,8 +59,7 @@ QuicNegotiableUint32::QuicNegotiableUint32(QuicTag tag,
: QuicNegotiableValue(tag, presence),
max_value_(0),
default_value_(0),
- negotiated_value_(0) {
-}
+ negotiated_value_(0) {}
QuicNegotiableUint32::~QuicNegotiableUint32() {}
void QuicNegotiableUint32::set(uint32 max, uint32 default_value) {
@@ -97,12 +91,8 @@ QuicErrorCode QuicNegotiableUint32::ProcessPeerHello(
DCHECK(!negotiated());
DCHECK(error_details != nullptr);
uint32 value;
- QuicErrorCode error = ReadUint32(peer_hello,
- tag_,
- presence_,
- default_value_,
- &value,
- error_details);
+ QuicErrorCode error = ReadUint32(peer_hello, tag_, presence_, default_value_,
+ &value, error_details);
if (error != QUIC_NO_ERROR) {
return error;
}
@@ -120,8 +110,7 @@ QuicErrorCode QuicNegotiableUint32::ProcessPeerHello(
QuicNegotiableTag::QuicNegotiableTag(QuicTag tag, QuicConfigPresence presence)
: QuicNegotiableValue(tag, presence),
negotiated_tag_(0),
- default_value_(0) {
-}
+ default_value_(0) {}
QuicNegotiableTag::~QuicNegotiableTag() {}
@@ -142,11 +131,10 @@ void QuicNegotiableTag::ToHandshakeMessage(CryptoHandshakeMessage* out) const {
}
}
-QuicErrorCode QuicNegotiableTag::ReadVector(
- const CryptoHandshakeMessage& msg,
- const QuicTag** out,
- size_t* out_length,
- string* error_details) const {
+QuicErrorCode QuicNegotiableTag::ReadVector(const CryptoHandshakeMessage& msg,
+ const QuicTag** out,
+ size_t* out_length,
+ string* error_details) const {
DCHECK(error_details != nullptr);
QuicErrorCode error = msg.GetTaglist(tag_, out, out_length);
switch (error) {
@@ -184,19 +172,16 @@ QuicErrorCode QuicNegotiableTag::ProcessPeerHello(
if (hello_type == SERVER) {
if (received_tags_length != 1 ||
- !ContainsQuicTag(possible_values_, *received_tags)) {
+ !ContainsQuicTag(possible_values_, *received_tags)) {
*error_details = "Invalid " + QuicUtils::TagToString(tag_);
return QUIC_INVALID_NEGOTIATED_VALUE;
}
negotiated_tag_ = *received_tags;
} else {
QuicTag negotiated_tag;
- if (!QuicUtils::FindMutualTag(possible_values_,
- received_tags,
- received_tags_length,
- QuicUtils::LOCAL_PRIORITY,
- &negotiated_tag,
- nullptr)) {
+ if (!QuicUtils::FindMutualTag(
+ possible_values_, received_tags, received_tags_length,
+ QuicUtils::LOCAL_PRIORITY, &negotiated_tag, nullptr)) {
*error_details = "Unsupported " + QuicUtils::TagToString(tag_);
return QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP;
}
@@ -210,8 +195,7 @@ QuicErrorCode QuicNegotiableTag::ProcessPeerHello(
QuicFixedUint32::QuicFixedUint32(QuicTag tag, QuicConfigPresence presence)
: QuicConfigValue(tag, presence),
has_send_value_(false),
- has_receive_value_(false) {
-}
+ has_receive_value_(false) {}
QuicFixedUint32::~QuicFixedUint32() {}
bool QuicFixedUint32::HasSendValue() const {
@@ -219,8 +203,8 @@ bool QuicFixedUint32::HasSendValue() const {
}
uint32 QuicFixedUint32::GetSendValue() const {
- LOG_IF(DFATAL, !has_send_value_)
- << "No send value to get for tag:" << QuicUtils::TagToString(tag_);
+ LOG_IF(DFATAL, !has_send_value_) << "No send value to get for tag:"
+ << QuicUtils::TagToString(tag_);
return send_value_;
}
@@ -234,8 +218,8 @@ bool QuicFixedUint32::HasReceivedValue() const {
}
uint32 QuicFixedUint32::GetReceivedValue() const {
- LOG_IF(DFATAL, !has_receive_value_)
- << "No receive value to get for tag:" << QuicUtils::TagToString(tag_);
+ LOG_IF(DFATAL, !has_receive_value_) << "No receive value to get for tag:"
+ << QuicUtils::TagToString(tag_);
return receive_value_;
}
@@ -277,8 +261,7 @@ QuicFixedTagVector::QuicFixedTagVector(QuicTag name,
QuicConfigPresence presence)
: QuicConfigValue(name, presence),
has_send_values_(false),
- has_receive_values_(false) {
-}
+ has_receive_values_(false) {}
QuicFixedTagVector::~QuicFixedTagVector() {}
@@ -287,8 +270,8 @@ bool QuicFixedTagVector::HasSendValues() const {
}
QuicTagVector QuicFixedTagVector::GetSendValues() const {
- LOG_IF(DFATAL, !has_send_values_)
- << "No send values to get for tag:" << QuicUtils::TagToString(tag_);
+ LOG_IF(DFATAL, !has_send_values_) << "No send values to get for tag:"
+ << QuicUtils::TagToString(tag_);
return send_values_;
}
@@ -302,8 +285,8 @@ bool QuicFixedTagVector::HasReceivedValues() const {
}
QuicTagVector QuicFixedTagVector::GetReceivedValues() const {
- LOG_IF(DFATAL, !has_receive_values_)
- << "No receive value to get for tag:" << QuicUtils::TagToString(tag_);
+ LOG_IF(DFATAL, !has_receive_values_) << "No receive value to get for tag:"
+ << QuicUtils::TagToString(tag_);
return receive_values_;
}
@@ -587,16 +570,16 @@ QuicErrorCode QuicConfig::ProcessPeerHello(
silent_close_.ProcessPeerHello(peer_hello, hello_type, error_details);
}
if (error == QUIC_NO_ERROR) {
- error = max_streams_per_connection_.ProcessPeerHello(
- peer_hello, hello_type, error_details);
+ error = max_streams_per_connection_.ProcessPeerHello(peer_hello, hello_type,
+ error_details);
}
if (error == QUIC_NO_ERROR) {
- error = bytes_for_connection_id_.ProcessPeerHello(
- peer_hello, hello_type, error_details);
+ error = bytes_for_connection_id_.ProcessPeerHello(peer_hello, hello_type,
+ error_details);
}
if (error == QUIC_NO_ERROR) {
- error = initial_round_trip_time_us_.ProcessPeerHello(
- peer_hello, hello_type, error_details);
+ error = initial_round_trip_time_us_.ProcessPeerHello(peer_hello, hello_type,
+ error_details);
}
if (error == QUIC_NO_ERROR) {
error = initial_stream_flow_control_window_bytes_.ProcessPeerHello(
@@ -607,12 +590,12 @@ QuicErrorCode QuicConfig::ProcessPeerHello(
peer_hello, hello_type, error_details);
}
if (error == QUIC_NO_ERROR) {
- error = socket_receive_buffer_.ProcessPeerHello(
- peer_hello, hello_type, error_details);
+ error = socket_receive_buffer_.ProcessPeerHello(peer_hello, hello_type,
+ error_details);
}
if (error == QUIC_NO_ERROR) {
- error = connection_options_.ProcessPeerHello(
- peer_hello, hello_type, error_details);
+ error = connection_options_.ProcessPeerHello(peer_hello, hello_type,
+ error_details);
}
return error;
}
diff --git a/net/quic/quic_config.h b/net/quic/quic_config.h
index 755aa39..037aa7d 100644
--- a/net/quic/quic_config.h
+++ b/net/quic/quic_config.h
@@ -63,9 +63,7 @@ class NET_EXPORT_PRIVATE QuicNegotiableValue : public QuicConfigValue {
QuicNegotiableValue(QuicTag tag, QuicConfigPresence presence);
~QuicNegotiableValue() override;
- bool negotiated() const {
- return negotiated_;
- }
+ bool negotiated() const { return negotiated_; }
protected:
void set_negotiated(bool negotiated) { negotiated_ = negotiated; }
diff --git a/net/quic/quic_config_test.cc b/net/quic/quic_config_test.cc
index 0a568c2..2581c57 100644
--- a/net/quic/quic_config_test.cc
+++ b/net/quic/quic_config_test.cc
@@ -67,8 +67,8 @@ TEST_F(QuicConfigTest, ProcessClientHello) {
client_config.SetIdleConnectionStateLifetime(
QuicTime::Delta::FromSeconds(2 * kMaximumIdleTimeoutSecs),
QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs));
- client_config.SetMaxStreamsPerConnection(
- 2 * kDefaultMaxStreamsPerConnection, kDefaultMaxStreamsPerConnection);
+ client_config.SetMaxStreamsPerConnection(2 * kDefaultMaxStreamsPerConnection,
+ kDefaultMaxStreamsPerConnection);
client_config.SetInitialRoundTripTimeUsToSend(10 * kNumMicrosPerMilli);
client_config.SetInitialStreamFlowControlWindowToSend(
2 * kInitialStreamFlowControlWindowForTest);
@@ -99,8 +99,7 @@ TEST_F(QuicConfigTest, ProcessClientHello) {
EXPECT_TRUE(config_.negotiated());
EXPECT_EQ(QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs),
config_.IdleConnectionStateLifetime());
- EXPECT_EQ(kDefaultMaxStreamsPerConnection,
- config_.MaxStreamsPerConnection());
+ EXPECT_EQ(kDefaultMaxStreamsPerConnection, config_.MaxStreamsPerConnection());
EXPECT_EQ(10 * kNumMicrosPerMilli, config_.ReceivedInitialRoundTripTimeUs());
EXPECT_TRUE(config_.HasReceivedConnectionOptions());
EXPECT_EQ(3u, config_.ReceivedConnectionOptions().size());
@@ -111,8 +110,7 @@ TEST_F(QuicConfigTest, ProcessClientHello) {
2 * kInitialStreamFlowControlWindowForTest);
EXPECT_EQ(config_.ReceivedInitialSessionFlowControlWindowBytes(),
2 * kInitialSessionFlowControlWindowForTest);
- EXPECT_EQ(config_.ReceivedSocketReceiveBuffer(),
- kDefaultSocketReceiveBuffer);
+ EXPECT_EQ(config_.ReceivedSocketReceiveBuffer(), kDefaultSocketReceiveBuffer);
}
TEST_F(QuicConfigTest, ProcessServerHello) {
@@ -122,9 +120,8 @@ TEST_F(QuicConfigTest, ProcessServerHello) {
server_config.SetIdleConnectionStateLifetime(
QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2),
QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2));
- server_config.SetMaxStreamsPerConnection(
- kDefaultMaxStreamsPerConnection / 2,
- kDefaultMaxStreamsPerConnection / 2);
+ server_config.SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection / 2,
+ kDefaultMaxStreamsPerConnection / 2);
server_config.SetInitialRoundTripTimeUsToSend(10 * kNumMicrosPerMilli);
server_config.SetInitialStreamFlowControlWindowToSend(
2 * kInitialStreamFlowControlWindowForTest);
@@ -147,8 +144,7 @@ TEST_F(QuicConfigTest, ProcessServerHello) {
2 * kInitialStreamFlowControlWindowForTest);
EXPECT_EQ(config_.ReceivedInitialSessionFlowControlWindowBytes(),
2 * kInitialSessionFlowControlWindowForTest);
- EXPECT_EQ(config_.ReceivedSocketReceiveBuffer(),
- kDefaultSocketReceiveBuffer);
+ EXPECT_EQ(config_.ReceivedSocketReceiveBuffer(), kDefaultSocketReceiveBuffer);
}
TEST_F(QuicConfigTest, MissingOptionalValuesInCHLO) {
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc
index 5e38744..0b4c74f 100644
--- a/net/quic/quic_connection.cc
+++ b/net/quic/quic_connection.cc
@@ -79,9 +79,7 @@ bool Near(QuicPacketNumber a, QuicPacketNumber b) {
// An alarm that is scheduled to send an ack if a timeout occurs.
class AckAlarm : public QuicAlarm::Delegate {
public:
- explicit AckAlarm(QuicConnection* connection)
- : connection_(connection) {
- }
+ explicit AckAlarm(QuicConnection* connection) : connection_(connection) {}
QuicTime OnAlarm() override {
DCHECK(connection_->ack_frame_updated());
@@ -101,8 +99,7 @@ class AckAlarm : public QuicAlarm::Delegate {
class RetransmissionAlarm : public QuicAlarm::Delegate {
public:
explicit RetransmissionAlarm(QuicConnection* connection)
- : connection_(connection) {
- }
+ : connection_(connection) {}
QuicTime OnAlarm() override {
connection_->OnRetransmissionTimeout();
@@ -119,9 +116,7 @@ class RetransmissionAlarm : public QuicAlarm::Delegate {
// before sending packets and fires when the packet may be sent.
class SendAlarm : public QuicAlarm::Delegate {
public:
- explicit SendAlarm(QuicConnection* connection)
- : connection_(connection) {
- }
+ explicit SendAlarm(QuicConnection* connection) : connection_(connection) {}
QuicTime OnAlarm() override {
connection_->WriteIfNotBlocked();
@@ -137,9 +132,7 @@ class SendAlarm : public QuicAlarm::Delegate {
class TimeoutAlarm : public QuicAlarm::Delegate {
public:
- explicit TimeoutAlarm(QuicConnection* connection)
- : connection_(connection) {
- }
+ explicit TimeoutAlarm(QuicConnection* connection) : connection_(connection) {}
QuicTime OnAlarm() override {
connection_->CheckForTimeout();
@@ -155,9 +148,7 @@ class TimeoutAlarm : public QuicAlarm::Delegate {
class PingAlarm : public QuicAlarm::Delegate {
public:
- explicit PingAlarm(QuicConnection* connection)
- : connection_(connection) {
- }
+ explicit PingAlarm(QuicConnection* connection) : connection_(connection) {}
QuicTime OnAlarm() override {
connection_->SendPing();
@@ -332,8 +323,8 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id,
largest_received_packet_size_(0),
goaway_sent_(false),
goaway_received_(false) {
- DVLOG(1) << ENDPOINT << "Created connection with connection_id: "
- << connection_id;
+ DVLOG(1) << ENDPOINT
+ << "Created connection with connection_id: " << connection_id;
framer_.set_visitor(this);
framer_.set_received_entropy_calculator(&received_packet_manager_);
last_stop_waiting_frame_.least_unacked = 0;
@@ -589,8 +580,7 @@ void QuicConnection::OnVersionNegotiationPacket(
RetransmitUnackedPackets(ALL_UNACKED_RETRANSMISSION);
}
-void QuicConnection::OnRevivedPacket() {
-}
+void QuicConnection::OnRevivedPacket() {}
bool QuicConnection::OnUnauthenticatedPublicHeader(
const QuicPacketPublicHeader& header) {
@@ -1038,7 +1028,7 @@ void QuicConnection::MaybeCloseIfTooManyOutstandingPackets() {
// This occurs if we don't discard old packets we've sent fast enough.
// It's possible largest observed is less than least unacked.
if (sent_packet_manager_.largest_observed() >
- (sent_packet_manager_.GetLeastUnacked() + kMaxTrackedPackets)) {
+ (sent_packet_manager_.GetLeastUnacked() + kMaxTrackedPackets)) {
SendConnectionCloseWithDetails(
QUIC_TOO_MANY_OUTSTANDING_SENT_PACKETS,
StringPrintf("More than %" PRIu64 " outstanding.", kMaxTrackedPackets));
@@ -1091,9 +1081,9 @@ void QuicConnection::SendVersionNegotiationPacket() {
scoped_ptr<QuicEncryptedPacket> version_packet(
packet_generator_.SerializeVersionNegotiationPacket(
framer_.supported_versions()));
- WriteResult result = writer_->WritePacket(
- version_packet->data(), version_packet->length(),
- self_address().address(), peer_address());
+ WriteResult result =
+ writer_->WritePacket(version_packet->data(), version_packet->length(),
+ self_address().address(), peer_address());
if (result.status == WRITE_STATUS_ERROR) {
OnWriteError(result.error_code);
@@ -1261,8 +1251,8 @@ void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address,
SetPingAlarm();
}
-void QuicConnection::CheckForAddressMigration(
- const IPEndPoint& self_address, const IPEndPoint& peer_address) {
+void QuicConnection::CheckForAddressMigration(const IPEndPoint& self_address,
+ const IPEndPoint& peer_address) {
peer_ip_changed_ = false;
peer_port_changed_ = false;
self_ip_changed_ = false;
@@ -1312,15 +1302,14 @@ void QuicConnection::OnCanWrite() {
return;
}
- { // Limit the scope of the bundler. ACK inclusion happens elsewhere.
+ { // Limit the scope of the bundler. ACK inclusion happens elsewhere.
ScopedPacketBundler bundler(this, NO_ACK);
visitor_->OnCanWrite();
}
// After the visitor writes, it may have caused the socket to become write
// blocked or the congestion manager to prohibit sending, so check again.
- if (visitor_->WillingAndAbleToWrite() &&
- !resume_writes_alarm_->IsSet() &&
+ if (visitor_->WillingAndAbleToWrite() && !resume_writes_alarm_->IsSet() &&
CanWrite(HAS_RETRANSMITTABLE_DATA)) {
// We're not write blocked, but some stream didn't write out all of its
// bytes. Register for 'immediate' resumption so we'll keep writing after
@@ -1525,8 +1514,8 @@ bool QuicConnection::CanWrite(HasRetransmittableData retransmittable) {
}
QuicTime now = clock_->Now();
- QuicTime::Delta delay = sent_packet_manager_.TimeUntilSend(
- now, retransmittable);
+ QuicTime::Delta delay =
+ sent_packet_manager_.TimeUntilSend(now, retransmittable);
if (delay.IsInfinite()) {
send_alarm_->Cancel();
return false;
@@ -1616,10 +1605,9 @@ bool QuicConnection::WritePacketInner(QueuedPacket* packet) {
// min_rtt_, especially in cases where the thread blocks or gets swapped out
// during the WritePacket below.
QuicTime packet_send_time = clock_->Now();
- WriteResult result = writer_->WritePacket(encrypted->data(),
- encrypted->length(),
- self_address().address(),
- peer_address());
+ WriteResult result =
+ writer_->WritePacket(encrypted->data(), encrypted->length(),
+ self_address().address(), peer_address());
if (result.error_code == ERR_IO_PENDING) {
DCHECK_EQ(WRITE_STATUS_BLOCKED, result.status);
}
@@ -1692,8 +1680,7 @@ bool QuicConnection::WritePacketInner(QueuedPacket* packet) {
bool QuicConnection::ShouldDiscardPacket(const QueuedPacket& packet) {
if (!connected_) {
- DVLOG(1) << ENDPOINT
- << "Not sending packet as connection is disconnected.";
+ DVLOG(1) << ENDPOINT << "Not sending packet as connection is disconnected.";
return true;
}
@@ -1722,8 +1709,8 @@ bool QuicConnection::ShouldDiscardPacket(const QueuedPacket& packet) {
}
void QuicConnection::OnWriteError(int error_code) {
- DVLOG(1) << ENDPOINT << "Write failed with error: " << error_code
- << " (" << ErrorToString(error_code) << ")";
+ DVLOG(1) << ENDPOINT << "Write failed with error: " << error_code << " ("
+ << ErrorToString(error_code) << ")";
// We can't send an error as the socket is presumably borked.
CloseConnection(QUIC_PACKET_WRITE_ERROR, false);
}
@@ -2015,9 +2002,9 @@ void QuicConnection::SendConnectionCloseWithDetails(QuicErrorCode error,
void QuicConnection::SendConnectionClosePacket(QuicErrorCode error,
const string& details) {
- DVLOG(1) << ENDPOINT << "Force closing " << connection_id()
- << " with error " << QuicUtils::ErrorToString(error)
- << " (" << error << ") " << details;
+ DVLOG(1) << ENDPOINT << "Force closing " << connection_id() << " with error "
+ << QuicUtils::ErrorToString(error) << " (" << error << ") "
+ << details;
// Don't send explicit connection close packets for timeouts.
// This is particularly important on mobile, where connections are short.
if (silent_close_enabled_ &&
@@ -2065,8 +2052,7 @@ void QuicConnection::SendGoAway(QuicErrorCode error,
goaway_sent_ = true;
DVLOG(1) << ENDPOINT << "Going away with error "
- << QuicUtils::ErrorToString(error)
- << " (" << error << ")";
+ << QuicUtils::ErrorToString(error) << " (" << error << ")";
// Opportunistically bundle an ack with this outgoing packet.
ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK);
@@ -2104,8 +2090,8 @@ void QuicConnection::SetMaxPacketLength(QuicByteCount length) {
}
bool QuicConnection::HasQueuedData() const {
- return pending_version_negotiation_packet_ ||
- !queued_packets_.empty() || packet_generator_.HasQueuedFrames();
+ return pending_version_negotiation_packet_ || !queued_packets_.empty() ||
+ packet_generator_.HasQueuedFrames();
}
void QuicConnection::EnableSavingCryptoPackets() {
@@ -2119,8 +2105,8 @@ bool QuicConnection::CanWriteStreamData() {
return false;
}
- IsHandshake pending_handshake = visitor_->HasPendingHandshake() ?
- IS_HANDSHAKE : NOT_HANDSHAKE;
+ IsHandshake pending_handshake =
+ visitor_->HasPendingHandshake() ? IS_HANDSHAKE : NOT_HANDSHAKE;
// Sending queued packets may have caused the socket to become write blocked,
// or the congestion manager to prohibit sending. If we've sent everything
// we had queued and we're still not blocked, let the visitor know it can
@@ -2176,12 +2162,13 @@ void QuicConnection::CheckForTimeout() {
if (!overall_connection_timeout_.IsInfinite()) {
QuicTime::Delta connected_duration =
now.Subtract(stats_.connection_creation_time);
- DVLOG(1) << ENDPOINT << "connection time: "
- << connected_duration.ToMicroseconds() << " overall timeout: "
+ DVLOG(1) << ENDPOINT
+ << "connection time: " << connected_duration.ToMicroseconds()
+ << " overall timeout: "
<< overall_connection_timeout_.ToMicroseconds();
if (connected_duration >= overall_connection_timeout_) {
- DVLOG(1) << ENDPOINT <<
- "Connection timedout due to overall connection timeout.";
+ DVLOG(1) << ENDPOINT
+ << "Connection timedout due to overall connection timeout.";
SendConnectionClose(QUIC_CONNECTION_OVERALL_TIMED_OUT);
return;
}
@@ -2191,14 +2178,14 @@ void QuicConnection::CheckForTimeout() {
}
void QuicConnection::SetTimeoutAlarm() {
- QuicTime time_of_last_packet = max(time_of_last_received_packet_,
- time_of_last_sent_new_packet_);
+ QuicTime time_of_last_packet =
+ max(time_of_last_received_packet_, time_of_last_sent_new_packet_);
QuicTime deadline = time_of_last_packet.Add(idle_network_timeout_);
if (!overall_connection_timeout_.IsInfinite()) {
- deadline = min(deadline,
- stats_.connection_creation_time.Add(
- overall_connection_timeout_));
+ deadline =
+ min(deadline,
+ stats_.connection_creation_time.Add(overall_connection_timeout_));
}
timeout_alarm_->Cancel();
diff --git a/net/quic/quic_connection.h b/net/quic/quic_connection.h
index f59ed55..1eaf9e6 100644
--- a/net/quic/quic_connection.h
+++ b/net/quic/quic_connection.h
@@ -171,8 +171,7 @@ class NET_EXPORT_PRIVATE QuicConnectionDebugVisitor
// Called when a packet is received with a connection id that does not
// match the ID of this connection.
- virtual void OnIncorrectConnectionId(
- QuicConnectionId connection_id) {}
+ virtual void OnIncorrectConnectionId(QuicConnectionId connection_id) {}
// Called when an undecryptable packet has been received.
virtual void OnUndecryptablePacket() {}
@@ -206,8 +205,7 @@ class NET_EXPORT_PRIVATE QuicConnectionDebugVisitor
virtual void OnRstStreamFrame(const QuicRstStreamFrame& frame) {}
// Called when a ConnectionCloseFrame has been parsed.
- virtual void OnConnectionCloseFrame(
- const QuicConnectionCloseFrame& frame) {}
+ virtual void OnConnectionCloseFrame(const QuicConnectionCloseFrame& frame) {}
// Called when a WindowUpdate has been parsed.
virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) {}
@@ -340,8 +338,7 @@ class NET_EXPORT_PRIVATE QuicConnection
virtual void SendBlocked(QuicStreamId id);
// Send a WINDOW_UPDATE frame to the peer.
- virtual void SendWindowUpdate(QuicStreamId id,
- QuicStreamOffset byte_offset);
+ virtual void SendWindowUpdate(QuicStreamId id, QuicStreamOffset byte_offset);
// Sends the connection close packet without affecting the state of the
// connection. This should only be called if the session is actively being
@@ -816,7 +813,7 @@ class NET_EXPORT_PRIVATE QuicConnection
// decrypted.
bool last_packet_decrypted_;
bool last_packet_revived_; // True if the last packet was revived from FEC.
- QuicByteCount last_size_; // Size of the last received packet.
+ QuicByteCount last_size_; // Size of the last received packet.
EncryptionLevel last_decrypted_packet_level_;
QuicPacketHeader last_header_;
QuicStopWaitingFrame last_stop_waiting_frame_;
diff --git a/net/quic/quic_connection_helper.cc b/net/quic/quic_connection_helper.cc
index 195dfb3..a57bc94 100644
--- a/net/quic/quic_connection_helper.cc
+++ b/net/quic/quic_connection_helper.cc
@@ -97,11 +97,9 @@ QuicConnectionHelper::QuicConnectionHelper(base::TaskRunner* task_runner,
: task_runner_(task_runner),
clock_(clock),
random_generator_(random_generator),
- weak_factory_(this) {
-}
+ weak_factory_(this) {}
-QuicConnectionHelper::~QuicConnectionHelper() {
-}
+QuicConnectionHelper::~QuicConnectionHelper() {}
const QuicClock* QuicConnectionHelper::GetClock() const {
return clock_;
diff --git a/net/quic/quic_connection_helper_test.cc b/net/quic/quic_connection_helper_test.cc
index f5a6907..cfe8b96 100644
--- a/net/quic/quic_connection_helper_test.cc
+++ b/net/quic/quic_connection_helper_test.cc
@@ -23,7 +23,7 @@ class TestDelegate : public QuicAlarm::Delegate {
}
bool fired() const { return fired_; }
- void Clear() { fired_= false; }
+ void Clear() { fired_ = false; }
private:
bool fired_;
@@ -33,8 +33,7 @@ class QuicConnectionHelperTest : public ::testing::Test {
protected:
QuicConnectionHelperTest()
: runner_(new TestTaskRunner(&clock_)),
- helper_(runner_.get(), &clock_, &random_generator_) {
- }
+ helper_(runner_.get(), &clock_, &random_generator_) {}
scoped_refptr<TestTaskRunner> runner_;
QuicConnectionHelper helper_;
@@ -167,10 +166,9 @@ TEST_F(QuicConnectionHelperTest, CreateAlarmAndUpdate) {
QuicTime::Delta::FromMicroseconds(2));
ASSERT_EQ(1u, runner_->GetPostedTasks().size());
- EXPECT_EQ(
- base::TimeDelta::FromMicroseconds(
- new_delta.Subtract(delta).ToMicroseconds()),
- runner_->GetPostedTasks()[0].delay);
+ EXPECT_EQ(base::TimeDelta::FromMicroseconds(
+ new_delta.Subtract(delta).ToMicroseconds()),
+ runner_->GetPostedTasks()[0].delay);
runner_->RunNextTask();
EXPECT_EQ(start.Add(new_delta), clock->Now());
EXPECT_TRUE(delegate->fired());
diff --git a/net/quic/quic_connection_logger.cc b/net/quic/quic_connection_logger.cc
index f4d4f6a..1332979 100644
--- a/net/quic/quic_connection_logger.cc
+++ b/net/quic/quic_connection_logger.cc
@@ -116,8 +116,7 @@ scoped_ptr<base::Value> NetLogQuicAckFrameCallback(
dict->SetString(
"delta_time_largest_observed_us",
base::Int64ToString(frame->delta_time_largest_observed.ToMicroseconds()));
- dict->SetInteger("entropy_hash",
- frame->entropy_hash);
+ dict->SetInteger("entropy_hash", frame->entropy_hash);
dict->SetBoolean("truncated", frame->is_truncated);
base::ListValue* missing = new base::ListValue();
@@ -268,8 +267,8 @@ void UpdatePublicResetAddressMismatchHistogram(
// If |address| is an IPv4-mapped IPv6 address, returns ADDRESS_FAMILY_IPV4
// instead of ADDRESS_FAMILY_IPV6. Othewise, behaves like GetAddressFamily().
AddressFamily GetRealAddressFamily(const IPAddressNumber& address) {
- return IsIPv4Mapped(address) ? ADDRESS_FAMILY_IPV4 :
- GetAddressFamily(address);
+ return IsIPv4Mapped(address) ? ADDRESS_FAMILY_IPV4
+ : GetAddressFamily(address);
}
} // namespace
@@ -335,7 +334,6 @@ QuicConnectionLogger::~QuicConnectionLogger() {
UMA_HISTOGRAM_CUSTOM_COUNTS(
"Net.QuicSession.StreamFrameDuplicatedLongConnection",
duplicate_stream_frame_per_thousand, 1, 1000, 75);
-
}
}
@@ -379,28 +377,24 @@ void QuicConnectionLogger::OnFrameAddedToPacket(const QuicFrame& frame) {
case RST_STREAM_FRAME:
UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeClient",
frame.rst_stream_frame->error_code);
- net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_RST_STREAM_FRAME_SENT,
- base::Bind(&NetLogQuicRstStreamFrameCallback,
- frame.rst_stream_frame));
+ net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_RST_STREAM_FRAME_SENT,
+ base::Bind(&NetLogQuicRstStreamFrameCallback,
+ frame.rst_stream_frame));
break;
case CONNECTION_CLOSE_FRAME:
- net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_CONNECTION_CLOSE_FRAME_SENT,
- base::Bind(&NetLogQuicConnectionCloseFrameCallback,
- frame.connection_close_frame));
+ net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_CONNECTION_CLOSE_FRAME_SENT,
+ base::Bind(&NetLogQuicConnectionCloseFrameCallback,
+ frame.connection_close_frame));
break;
case GOAWAY_FRAME:
net_log_.AddEvent(
NetLog::TYPE_QUIC_SESSION_GOAWAY_FRAME_SENT,
- base::Bind(&NetLogQuicGoAwayFrameCallback,
- frame.goaway_frame));
+ base::Bind(&NetLogQuicGoAwayFrameCallback, frame.goaway_frame));
break;
case WINDOW_UPDATE_FRAME:
- net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_SENT,
- base::Bind(&NetLogQuicWindowUpdateFrameCallback,
- frame.window_update_frame));
+ net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_SENT,
+ base::Bind(&NetLogQuicWindowUpdateFrameCallback,
+ frame.window_update_frame));
break;
case BLOCKED_FRAME:
++num_blocked_frames_sent_;
@@ -409,10 +403,9 @@ void QuicConnectionLogger::OnFrameAddedToPacket(const QuicFrame& frame) {
base::Bind(&NetLogQuicBlockedFrameCallback, frame.blocked_frame));
break;
case STOP_WAITING_FRAME:
- net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_SENT,
- base::Bind(&NetLogQuicStopWaitingFrameCallback,
- frame.stop_waiting_frame));
+ net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_SENT,
+ base::Bind(&NetLogQuicStopWaitingFrameCallback,
+ frame.stop_waiting_frame));
break;
case PING_FRAME:
UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ConnectionFlowControlBlocked",
@@ -442,7 +435,7 @@ void QuicConnectionLogger::OnPacketSent(
NetLog::TYPE_QUIC_SESSION_PACKET_SENT,
base::Bind(&NetLogQuicPacketSentCallback, serialized_packet,
transmission_type, encrypted_length, sent_time));
- } else {
+ } else {
net_log_.AddEvent(
NetLog::TYPE_QUIC_SESSION_PACKET_RETRANSMITTED,
base::Bind(&NetLogQuicPacketRetransmittedCallback,
@@ -472,10 +465,9 @@ void QuicConnectionLogger::OnPacketReceived(const IPEndPoint& self_address,
previous_received_packet_size_ = last_received_packet_size_;
last_received_packet_size_ = packet.length();
- net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_PACKET_RECEIVED,
- base::Bind(&NetLogQuicPacketCallback, &self_address, &peer_address,
- packet.length()));
+ net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PACKET_RECEIVED,
+ base::Bind(&NetLogQuicPacketCallback, &self_address,
+ &peer_address, packet.length()));
}
void QuicConnectionLogger::OnUnauthenticatedHeader(
@@ -537,15 +529,13 @@ void QuicConnectionLogger::OnPacketHeader(const QuicPacketHeader& header) {
}
void QuicConnectionLogger::OnStreamFrame(const QuicStreamFrame& frame) {
- net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_STREAM_FRAME_RECEIVED,
- base::Bind(&NetLogQuicStreamFrameCallback, &frame));
+ net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_STREAM_FRAME_RECEIVED,
+ base::Bind(&NetLogQuicStreamFrameCallback, &frame));
}
void QuicConnectionLogger::OnAckFrame(const QuicAckFrame& frame) {
- net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_ACK_FRAME_RECEIVED,
- base::Bind(&NetLogQuicAckFrameCallback, &frame));
+ net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_ACK_FRAME_RECEIVED,
+ base::Bind(&NetLogQuicAckFrameCallback, &frame));
const size_t kApproximateLargestSoloAckBytes = 100;
if (last_received_packet_number_ < received_acks_.size() &&
@@ -593,17 +583,15 @@ void QuicConnectionLogger::OnAckFrame(const QuicAckFrame& frame) {
void QuicConnectionLogger::OnStopWaitingFrame(
const QuicStopWaitingFrame& frame) {
- net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_RECEIVED,
- base::Bind(&NetLogQuicStopWaitingFrameCallback, &frame));
+ net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_STOP_WAITING_FRAME_RECEIVED,
+ base::Bind(&NetLogQuicStopWaitingFrameCallback, &frame));
}
void QuicConnectionLogger::OnRstStreamFrame(const QuicRstStreamFrame& frame) {
UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.RstStreamErrorCodeServer",
frame.error_code);
- net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_RST_STREAM_FRAME_RECEIVED,
- base::Bind(&NetLogQuicRstStreamFrameCallback, &frame));
+ net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_RST_STREAM_FRAME_RECEIVED,
+ base::Bind(&NetLogQuicRstStreamFrameCallback, &frame));
}
void QuicConnectionLogger::OnConnectionCloseFrame(
@@ -615,22 +603,19 @@ void QuicConnectionLogger::OnConnectionCloseFrame(
void QuicConnectionLogger::OnWindowUpdateFrame(
const QuicWindowUpdateFrame& frame) {
- net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_RECEIVED,
- base::Bind(&NetLogQuicWindowUpdateFrameCallback, &frame));
+ net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_WINDOW_UPDATE_FRAME_RECEIVED,
+ base::Bind(&NetLogQuicWindowUpdateFrameCallback, &frame));
}
void QuicConnectionLogger::OnBlockedFrame(const QuicBlockedFrame& frame) {
++num_blocked_frames_received_;
- net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_RECEIVED,
- base::Bind(&NetLogQuicBlockedFrameCallback, &frame));
+ net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_BLOCKED_FRAME_RECEIVED,
+ base::Bind(&NetLogQuicBlockedFrameCallback, &frame));
}
void QuicConnectionLogger::OnGoAwayFrame(const QuicGoAwayFrame& frame) {
- net_log_.AddEvent(
- NetLog::TYPE_QUIC_SESSION_GOAWAY_FRAME_RECEIVED,
- base::Bind(&NetLogQuicGoAwayFrameCallback, &frame));
+ net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_GOAWAY_FRAME_RECEIVED,
+ base::Bind(&NetLogQuicGoAwayFrameCallback, &frame));
}
void QuicConnectionLogger::OnPingFrame(const QuicPingFrame& frame) {
@@ -672,10 +657,10 @@ void QuicConnectionLogger::OnCryptoHandshakeMessageReceived(
if (message.GetStringPiece(kCADR, &address) &&
decoder.Decode(address.data(), address.size())) {
local_address_from_shlo_ = IPEndPoint(decoder.ip(), decoder.port());
- UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionTypeFromPeer",
- GetRealAddressFamily(
- local_address_from_shlo_.address()),
- ADDRESS_FAMILY_LAST);
+ UMA_HISTOGRAM_ENUMERATION(
+ "Net.QuicSession.ConnectionTypeFromPeer",
+ GetRealAddressFamily(local_address_from_shlo_.address()),
+ ADDRESS_FAMILY_LAST);
}
}
}
@@ -726,8 +711,8 @@ base::HistogramBase* QuicConnectionLogger::GetPacketNumberHistogram(
const char* statistic_name) const {
string prefix("Net.QuicSession.PacketReceived_");
return base::LinearHistogram::FactoryGet(
- prefix + statistic_name + connection_description_,
- 1, received_packets_.size(), received_packets_.size() + 1,
+ prefix + statistic_name + connection_description_, 1,
+ received_packets_.size(), received_packets_.size() + 1,
base::HistogramBase::kUmaTargetedHistogramFlag);
}
@@ -742,7 +727,7 @@ base::HistogramBase* QuicConnectionLogger::Get6PacketHistogram(
}
base::HistogramBase* QuicConnectionLogger::Get21CumulativeHistogram(
- const char* which_21) const {
+ const char* which_21) const {
// This histogram contains, for each sequence of 21 packets, the results from
// 21 distinct questions about that sequence. Conceptually the histogtram is
// broken into 21 distinct ranges, and one sample is added into each of those
@@ -758,8 +743,8 @@ base::HistogramBase* QuicConnectionLogger::Get21CumulativeHistogram(
// etc.
string prefix("Net.QuicSession.21CumulativePacketsReceived_");
return base::LinearHistogram::FactoryGet(
- prefix + which_21 + connection_description_,
- 1, kBoundingSampleInCumulativeHistogram,
+ prefix + which_21 + connection_description_, 1,
+ kBoundingSampleInCumulativeHistogram,
kBoundingSampleInCumulativeHistogram + 1,
base::HistogramBase::kUmaTargetedHistogramFlag);
}
diff --git a/net/quic/quic_connection_logger.h b/net/quic/quic_connection_logger.h
index 7bf86ea..7d308b1 100644
--- a/net/quic/quic_connection_logger.h
+++ b/net/quic/quic_connection_logger.h
@@ -72,10 +72,8 @@ class NET_EXPORT_PRIVATE QuicConnectionLogger
void OnSuccessfulVersionNegotiation(const QuicVersion& version) override;
void OnRttChanged(QuicTime::Delta rtt) const override;
- void OnCryptoHandshakeMessageReceived(
- const CryptoHandshakeMessage& message);
- void OnCryptoHandshakeMessageSent(
- const CryptoHandshakeMessage& message);
+ void OnCryptoHandshakeMessageReceived(const CryptoHandshakeMessage& message);
+ void OnCryptoHandshakeMessageSent(const CryptoHandshakeMessage& message);
void UpdateReceivedFrameCounts(QuicStreamId stream_id,
int num_frames_received,
int num_duplicate_frames_received);
diff --git a/net/quic/quic_connection_stats.cc b/net/quic/quic_connection_stats.cc
index e581c17..2c98fcc 100644
--- a/net/quic/quic_connection_stats.cc
+++ b/net/quic/quic_connection_stats.cc
@@ -39,8 +39,7 @@ QuicConnectionStats::QuicConnectionStats()
max_sequence_reordering(0),
max_time_reordering_us(0),
tcp_loss_events(0),
- connection_creation_time(QuicTime::Zero()) {
-}
+ connection_creation_time(QuicTime::Zero()) {}
QuicConnectionStats::~QuicConnectionStats() {}
diff --git a/net/quic/quic_connection_stats.h b/net/quic/quic_connection_stats.h
index 14f2c2c..737d81a 100644
--- a/net/quic/quic_connection_stats.h
+++ b/net/quic/quic_connection_stats.h
@@ -20,7 +20,8 @@ struct NET_EXPORT_PRIVATE QuicConnectionStats {
~QuicConnectionStats();
NET_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os, const QuicConnectionStats& s);
+ std::ostream& os,
+ const QuicConnectionStats& s);
QuicByteCount bytes_sent; // Includes retransmissions, fec.
QuicPacketCount packets_sent;
@@ -61,7 +62,7 @@ struct NET_EXPORT_PRIVATE QuicConnectionStats {
size_t rto_count; // Count of times the rto timer fired.
int64 min_rtt_us; // Minimum RTT in microseconds.
- int64 srtt_us; // Smoothed RTT in microseconds.
+ int64 srtt_us; // Smoothed RTT in microseconds.
QuicByteCount max_packet_size;
QuicByteCount max_received_packet_size;
QuicBandwidth estimated_bandwidth;
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
index ffe4f38..6354a1e 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -72,9 +72,7 @@ const IPEndPoint kSelfAddress = IPEndPoint(Loopback6(), /*port=*/443);
// TaggingEncrypter appends kTagSize bytes of |tag| to the end of each message.
class TaggingEncrypter : public QuicEncrypter {
public:
- explicit TaggingEncrypter(uint8 tag)
- : tag_(tag) {
- }
+ explicit TaggingEncrypter(uint8 tag) : tag_(tag) {}
~TaggingEncrypter() override {}
@@ -161,7 +159,7 @@ class TaggingDecrypter : public QuicDecrypter {
protected:
virtual uint8 GetTag(StringPiece ciphertext) {
- return ciphertext.data()[ciphertext.size()-1];
+ return ciphertext.data()[ciphertext.size() - 1];
}
private:
@@ -202,9 +200,7 @@ class TestConnectionHelper : public QuicConnectionHelperInterface {
public:
class TestAlarm : public QuicAlarm {
public:
- explicit TestAlarm(QuicAlarm::Delegate* delegate)
- : QuicAlarm(delegate) {
- }
+ explicit TestAlarm(QuicAlarm::Delegate* delegate) : QuicAlarm(delegate) {}
void SetImpl() override {}
void CancelImpl() override {}
@@ -212,8 +208,7 @@ class TestConnectionHelper : public QuicConnectionHelperInterface {
};
TestConnectionHelper(MockClock* clock, MockRandom* random_generator)
- : clock_(clock),
- random_generator_(random_generator) {
+ : clock_(clock), random_generator_(random_generator) {
clock_->AdvanceTime(QuicTime::Delta::FromSeconds(1));
}
@@ -341,9 +336,7 @@ class TestPacketWriter : public QuicPacketWriter {
return framer_.ping_frames();
}
- size_t last_packet_size() {
- return last_packet_size_;
- }
+ size_t last_packet_size() { return last_packet_size_; }
const QuicVersionNegotiationPacket* version_negotiation_packet() {
return framer_.version_negotiation_packet();
@@ -373,9 +366,7 @@ class TestPacketWriter : public QuicPacketWriter {
return final_bytes_of_previous_packet_;
}
- void use_tagging_decrypter() {
- use_tagging_decrypter_ = true;
- }
+ void use_tagging_decrypter() { use_tagging_decrypter_ = true; }
uint32 packets_write_attempts() { return packets_write_attempts_; }
@@ -401,7 +392,7 @@ class TestPacketWriter : public QuicPacketWriter {
uint32 final_bytes_of_previous_packet_;
bool use_tagging_decrypter_;
uint32 packets_write_attempts_;
- MockClock *clock_;
+ MockClock* clock_;
// If non-zero, the clock will pause during WritePacket for this amount of
// time.
QuicTime::Delta write_pause_time_delta_;
@@ -431,9 +422,7 @@ class TestConnection : public QuicConnection {
writer()->set_perspective(perspective);
}
- void SendAck() {
- QuicConnectionPeer::SendAck(this);
- }
+ void SendAck() { QuicConnectionPeer::SendAck(this); }
void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm) {
QuicConnectionPeer::SetSendAlgorithm(this, send_algorithm);
@@ -618,8 +607,7 @@ class TestConnection : public QuicConnection {
};
// Used for testing packets revived from FEC packets.
-class FecQuicConnectionDebugVisitor
- : public QuicConnectionDebugVisitor {
+class FecQuicConnectionDebugVisitor : public QuicConnectionDebugVisitor {
public:
void OnRevivedPacket(const QuicPacketHeader& header,
StringPiece data) override {
@@ -627,9 +615,7 @@ class FecQuicConnectionDebugVisitor
}
// Public accessor method.
- QuicPacketHeader revived_header() const {
- return revived_header_;
- }
+ QuicPacketHeader revived_header() const { return revived_header_; }
private:
QuicPacketHeader revived_header_;
@@ -764,9 +750,7 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> {
return writer_->stop_waiting_frames()[0].least_unacked;
}
- void use_tagging_decrypter() {
- writer_->use_tagging_decrypter();
- }
+ void use_tagging_decrypter() { writer_->use_tagging_decrypter(); }
void ProcessPacket(QuicPacketNumber number) {
EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
@@ -819,8 +803,8 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> {
QuicFecGroupNumber fec_group,
bool entropy_flag,
EncryptionLevel level) {
- scoped_ptr<QuicPacket> packet(ConstructDataPacket(number, fec_group,
- entropy_flag));
+ scoped_ptr<QuicPacket> packet(
+ ConstructDataPacket(number, fec_group, entropy_flag));
char buffer[kMaxPacketSize];
size_t encrypted_length =
framer_.EncryptPayload(level, number, *packet, buffer, kMaxPacketSize);
@@ -1032,9 +1016,8 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> {
const QuicAckFrame InitAckFrame(QuicPacketNumber largest_observed) {
QuicAckFrame frame(MakeAckFrame(largest_observed));
if (largest_observed > 0) {
- frame.entropy_hash =
- QuicConnectionPeer::GetSentEntropyHash(&connection_,
- largest_observed);
+ frame.entropy_hash = QuicConnectionPeer::GetSentEntropyHash(
+ &connection_, largest_observed);
}
return frame;
}
@@ -1082,15 +1065,13 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> {
}
void CongestionBlockWrites() {
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillRepeatedly(
- testing::Return(QuicTime::Delta::FromSeconds(1)));
+ EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
+ .WillRepeatedly(testing::Return(QuicTime::Delta::FromSeconds(1)));
}
void CongestionUnblockWrites() {
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillRepeatedly(
- testing::Return(QuicTime::Delta::Zero()));
+ EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
+ .WillRepeatedly(testing::Return(QuicTime::Delta::Zero()));
}
QuicConnectionId connection_id_;
@@ -1308,8 +1289,7 @@ TEST_P(QuicConnectionTest, PacketsOutOfOrderWithAdditionsAndLeastAwaiting) {
}
TEST_P(QuicConnectionTest, RejectPacketTooFarOut) {
- EXPECT_CALL(visitor_,
- OnConnectionClosed(QUIC_INVALID_PACKET_HEADER, false));
+ EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_INVALID_PACKET_HEADER, false));
// Call ProcessDataPacket rather than ProcessPacket, as we should not get a
// packet call to the visitor.
ProcessDataPacket(6000, 0, !kEntropyFlag);
@@ -1321,8 +1301,8 @@ TEST_P(QuicConnectionTest, RejectUnencryptedStreamData) {
// Process an unencrypted packet from the non-crypto stream.
frame1_.stream_id = 3;
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_UNENCRYPTED_STREAM_DATA,
- false));
+ EXPECT_CALL(visitor_,
+ OnConnectionClosed(QUIC_UNENCRYPTED_STREAM_DATA, false));
ProcessDataPacket(1, 0, !kEntropyFlag);
EXPECT_FALSE(QuicConnectionPeer::GetConnectionClosePacket(&connection_) ==
nullptr);
@@ -1391,9 +1371,8 @@ TEST_P(QuicConnectionTest, AckReceiptCausesAckSendBadEntropy) {
// Process an ack with a least unacked of the received ack.
// This causes an ack to be sent when TimeUntilSend returns 0.
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillRepeatedly(
- testing::Return(QuicTime::Delta::Zero()));
+ EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
+ .WillRepeatedly(testing::Return(QuicTime::Delta::Zero()));
// Skip a packet and then record an ack.
QuicAckFrame frame = InitAckFrame(0);
ProcessAckPacket(3, &frame);
@@ -1444,8 +1423,8 @@ TEST_P(QuicConnectionTest, AckReceiptCausesAckSend) {
QuicPacketNumber original;
QuicByteCount packet_size;
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
- .WillOnce(DoAll(SaveArg<2>(&original), SaveArg<3>(&packet_size),
- Return(true)));
+ .WillOnce(
+ DoAll(SaveArg<2>(&original), SaveArg<3>(&packet_size), Return(true)));
connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr);
QuicAckFrame frame = InitAckFrame(original);
NackPacket(original, &frame);
@@ -1483,8 +1462,8 @@ TEST_P(QuicConnectionTest, AckReceiptCausesAckSend) {
// Now if the peer sends an ack which still reports the retransmitted packet
// as missing, that will bundle an ack with data after two acks in a row
// indicate the high water mark needs to be raised.
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _,
- HAS_RETRANSMITTABLE_DATA));
+ EXPECT_CALL(*send_algorithm_,
+ OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA));
connection_.SendStreamDataWithString(3, "foo", 3, !kFin, nullptr);
// No ack sent.
EXPECT_EQ(1u, writer_->frame_count());
@@ -1498,8 +1477,8 @@ TEST_P(QuicConnectionTest, AckReceiptCausesAckSend) {
.WillRepeatedly(Return(PacketNumberSet()));
}
ProcessAckPacket(&frame2);
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _,
- HAS_RETRANSMITTABLE_DATA));
+ EXPECT_CALL(*send_algorithm_,
+ OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA));
connection_.SendStreamDataWithString(3, "foo", 3, !kFin, nullptr);
// Ack bundled.
EXPECT_EQ(3u, writer_->frame_count());
@@ -1644,8 +1623,8 @@ TEST_P(QuicConnectionTest, SendingDifferentSequenceNumberLengthsBandwidth) {
EXPECT_EQ(PACKET_1BYTE_PACKET_NUMBER,
writer_->header().public_header.packet_number_length);
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow()).WillRepeatedly(
- Return(kMaxPacketSize * 256));
+ EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
+ .WillRepeatedly(Return(kMaxPacketSize * 256));
SendStreamDataToPeer(1, "bar", 3, !kFin, &last_packet);
EXPECT_EQ(2u, last_packet);
@@ -1656,8 +1635,8 @@ TEST_P(QuicConnectionTest, SendingDifferentSequenceNumberLengthsBandwidth) {
EXPECT_EQ(PACKET_1BYTE_PACKET_NUMBER,
writer_->header().public_header.packet_number_length);
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow()).WillRepeatedly(
- Return(kMaxPacketSize * 256 * 256));
+ EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
+ .WillRepeatedly(Return(kMaxPacketSize * 256 * 256));
SendStreamDataToPeer(1, "foo", 6, !kFin, &last_packet);
EXPECT_EQ(3u, last_packet);
@@ -1666,8 +1645,8 @@ TEST_P(QuicConnectionTest, SendingDifferentSequenceNumberLengthsBandwidth) {
EXPECT_EQ(PACKET_2BYTE_PACKET_NUMBER,
writer_->header().public_header.packet_number_length);
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow()).WillRepeatedly(
- Return(kMaxPacketSize * 256 * 256 * 256));
+ EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
+ .WillRepeatedly(Return(kMaxPacketSize * 256 * 256 * 256));
SendStreamDataToPeer(1, "bar", 9, !kFin, &last_packet);
EXPECT_EQ(4u, last_packet);
@@ -1676,8 +1655,8 @@ TEST_P(QuicConnectionTest, SendingDifferentSequenceNumberLengthsBandwidth) {
EXPECT_EQ(PACKET_4BYTE_PACKET_NUMBER,
writer_->header().public_header.packet_number_length);
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow()).WillRepeatedly(
- Return(kMaxPacketSize * 256 * 256 * 256 * 256));
+ EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
+ .WillRepeatedly(Return(kMaxPacketSize * 256 * 256 * 256 * 256));
SendStreamDataToPeer(1, "foo", 12, !kFin, &last_packet);
EXPECT_EQ(5u, last_packet);
@@ -1834,11 +1813,13 @@ TEST_P(QuicConnectionTest, FECSending) {
if (generator_->fec_send_policy() == FEC_ALARM_TRIGGER) {
// Send 4 protected data packets. FEC packet is not sent.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA)).Times(4);
+ OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(4);
} else {
// Send 4 protected data packets, which should also trigger 1 FEC packet.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA)).Times(5);
+ OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(5);
}
// The first stream frame will have 2 fewer overhead bytes than the other 3.
const string payload(payload_length * 4 + 2, 'a');
@@ -1881,7 +1862,8 @@ TEST_P(QuicConnectionTest, FECAlarmStoppedWhenFECPacketSent) {
// 1 Data packet. FEC alarm should be set.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, 1u, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, 1u, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
connection_.SendStreamDataWithStringWithFec(3, "foo", 0, true, nullptr);
EXPECT_TRUE(connection_.GetFecAlarm()->IsSet());
@@ -1889,11 +1871,13 @@ TEST_P(QuicConnectionTest, FECAlarmStoppedWhenFECPacketSent) {
// If FEC send policy is FEC_ALARM_TRIGGER, FEC packet is not sent.
// FEC alarm should not be set.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
} else {
// Second data packet triggers FEC packet out. FEC alarm should not be set.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA)).Times(2);
+ OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(2);
}
connection_.SendStreamDataWithStringWithFec(5, "foo", 0, true, nullptr);
if (generator_->fec_send_policy() == FEC_ANY_TRIGGER) {
@@ -1910,7 +1894,8 @@ TEST_P(QuicConnectionTest, FECAlarmStoppedOnConnectionClose) {
// 1 Data packet. FEC alarm should be set.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, 1u, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, 1u, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
connection_.SendStreamDataWithStringWithFec(3, "foo", 0, kFin, nullptr);
EXPECT_TRUE(connection_.GetFecAlarm()->IsSet());
@@ -1928,7 +1913,8 @@ TEST_P(QuicConnectionTest, RemoveFECFromInflightOnRetransmissionTimeout) {
// 1 Data packet. FEC alarm should be set.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, 1u, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, 1u, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
connection_.SendStreamDataWithStringWithFec(3, "foo", 0, !kFin, nullptr);
EXPECT_TRUE(connection_.GetFecAlarm()->IsSet());
size_t protected_packet =
@@ -1936,7 +1922,8 @@ TEST_P(QuicConnectionTest, RemoveFECFromInflightOnRetransmissionTimeout) {
// Force FEC timeout to send FEC packet out.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, 2u, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, 2u, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
connection_.GetFecAlarm()->Fire();
EXPECT_TRUE(writer_->header().fec_flag);
@@ -1989,7 +1976,8 @@ TEST_P(QuicConnectionTest, RemoveFECFromInflightOnLossRetransmission) {
// 1 FEC-protected data packet. FEC alarm should be set.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
connection_.SendStreamDataWithStringWithFec(3, "foo", 0, kFin, nullptr);
EXPECT_TRUE(connection_.GetFecAlarm()->IsSet());
size_t protected_packet =
@@ -1997,7 +1985,8 @@ TEST_P(QuicConnectionTest, RemoveFECFromInflightOnLossRetransmission) {
// Force FEC timeout to send FEC packet out.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
connection_.GetFecAlarm()->Fire();
EXPECT_TRUE(writer_->header().fec_flag);
size_t fec_packet = protected_packet;
@@ -2007,7 +1996,8 @@ TEST_P(QuicConnectionTest, RemoveFECFromInflightOnLossRetransmission) {
// Send more data to trigger NACKs. Note that all data starts at stream offset
// 0 to ensure the same packet size, for ease of testing.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA)).Times(4);
+ OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(4);
connection_.SendStreamDataWithString(5, "foo", 0, kFin, nullptr);
connection_.SendStreamDataWithString(7, "foo", 0, kFin, nullptr);
connection_.SendStreamDataWithString(9, "foo", 0, kFin, nullptr);
@@ -2042,7 +2032,8 @@ TEST_P(QuicConnectionTest, RemoveFECFromInflightOnLossRetransmission) {
}
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
ProcessAckPacket(&ack);
// On receiving this ack from the server, the client will no longer send
@@ -2078,7 +2069,8 @@ TEST_P(QuicConnectionTest, FECRemainsInflightOnTLPOfEarlierData) {
// 1 Data packet. FEC alarm should be set.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, 1u, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, 1u, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
connection_.SendStreamDataWithStringWithFec(3, "foo", 0, kFin, nullptr);
EXPECT_TRUE(connection_.GetFecAlarm()->IsSet());
size_t protected_packet =
@@ -2087,7 +2079,8 @@ TEST_P(QuicConnectionTest, FECRemainsInflightOnTLPOfEarlierData) {
// Force FEC timeout to send FEC packet out.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, 2u, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, 2u, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
connection_.GetFecAlarm()->Fire();
EXPECT_TRUE(writer_->header().fec_flag);
size_t fec_packet = protected_packet;
@@ -2102,7 +2095,8 @@ TEST_P(QuicConnectionTest, FECRemainsInflightOnTLPOfEarlierData) {
// algorithm's OnRetransmissionTimeout is not called.
clock_.AdvanceTime(retransmission_time.Subtract(clock_.Now()));
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, 3u, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, 3u, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
connection_.GetRetransmissionAlarm()->Fire();
// The TLP retransmission of packet 1 will be 3 bytes smaller than packet 1,
// since packet 1 will have 1 byte for FEC group number and 2 bytes of stream
@@ -2124,7 +2118,8 @@ TEST_P(QuicConnectionTest, FECRemainsInflightOnTLPOfLaterData) {
// 1 Data packet. FEC alarm should be set.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, 1u, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, 1u, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
connection_.SendStreamDataWithStringWithFec(3, "foo", 0, kFin, nullptr);
EXPECT_TRUE(connection_.GetFecAlarm()->IsSet());
size_t protected_packet =
@@ -2133,7 +2128,8 @@ TEST_P(QuicConnectionTest, FECRemainsInflightOnTLPOfLaterData) {
// Force FEC timeout to send FEC packet out.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, 2u, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, 2u, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
connection_.GetFecAlarm()->Fire();
EXPECT_TRUE(writer_->header().fec_flag);
// Protected data packet and FEC packet oustanding.
@@ -2143,7 +2139,8 @@ TEST_P(QuicConnectionTest, FECRemainsInflightOnTLPOfLaterData) {
// Send 1 unprotected data packet. No FEC alarm should be set.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, 3u, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, 3u, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
connection_.SendStreamDataWithString(5, "foo", 0, kFin, nullptr);
EXPECT_FALSE(connection_.GetFecAlarm()->IsSet());
// Protected data packet, FEC packet, and unprotected data packet oustanding.
@@ -2172,7 +2169,8 @@ TEST_P(QuicConnectionTest, FECRemainsInflightOnTLPOfLaterData) {
// algorithm's OnRetransmissionTimeout is not called.
clock_.AdvanceTime(retransmission_time.Subtract(clock_.Now()));
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, 4u, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, 4u, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
connection_.GetRetransmissionAlarm()->Fire();
// Having received an ack from the server, the client will no longer send
@@ -2190,12 +2188,14 @@ TEST_P(QuicConnectionTest, NoTLPForFECPacket) {
// Send 1 FEC-protected data packet. FEC alarm should be set.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
connection_.SendStreamDataWithStringWithFec(3, "foo", 0, !kFin, nullptr);
EXPECT_TRUE(connection_.GetFecAlarm()->IsSet());
// Force FEC timeout to send FEC packet out.
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA)).Times(1);
+ OnPacketSent(_, _, _, _, HAS_RETRANSMITTABLE_DATA))
+ .Times(1);
connection_.GetFecAlarm()->Fire();
EXPECT_TRUE(writer_->header().fec_flag);
@@ -2308,11 +2308,11 @@ TEST_P(QuicConnectionTest, FramePackingAckResponse) {
EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
ProcessDataPacket(1, 1, kEntropyFlag);
- EXPECT_CALL(visitor_, OnCanWrite()).WillOnce(DoAll(
- IgnoreResult(InvokeWithoutArgs(&connection_,
- &TestConnection::SendStreamData3)),
- IgnoreResult(InvokeWithoutArgs(&connection_,
- &TestConnection::SendStreamData5))));
+ EXPECT_CALL(visitor_, OnCanWrite())
+ .WillOnce(DoAll(IgnoreResult(InvokeWithoutArgs(
+ &connection_, &TestConnection::SendStreamData3)),
+ IgnoreResult(InvokeWithoutArgs(
+ &connection_, &TestConnection::SendStreamData5))));
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
@@ -2405,15 +2405,14 @@ TEST_P(QuicConnectionTest, SendingZeroBytes) {
TEST_P(QuicConnectionTest, OnCanWrite) {
// Visitor's OnCanWrite will send data, but will have more pending writes.
- EXPECT_CALL(visitor_, OnCanWrite()).WillOnce(DoAll(
- IgnoreResult(InvokeWithoutArgs(&connection_,
- &TestConnection::SendStreamData3)),
- IgnoreResult(InvokeWithoutArgs(&connection_,
- &TestConnection::SendStreamData5))));
+ EXPECT_CALL(visitor_, OnCanWrite())
+ .WillOnce(DoAll(IgnoreResult(InvokeWithoutArgs(
+ &connection_, &TestConnection::SendStreamData3)),
+ IgnoreResult(InvokeWithoutArgs(
+ &connection_, &TestConnection::SendStreamData5))));
EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillOnce(Return(true));
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillRepeatedly(
- testing::Return(QuicTime::Delta::Zero()));
+ EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
+ .WillRepeatedly(testing::Return(QuicTime::Delta::Zero()));
connection_.OnCanWrite();
@@ -2431,7 +2430,7 @@ TEST_P(QuicConnectionTest, RetransmitOnNack) {
SendStreamDataToPeer(3, "foo", 0, !kFin, &last_packet); // Packet 1
second_packet_size =
SendStreamDataToPeer(3, "foos", 3, !kFin, &last_packet); // Packet 2
- SendStreamDataToPeer(3, "fooos", 7, !kFin, &last_packet); // Packet 3
+ SendStreamDataToPeer(3, "fooos", 7, !kFin, &last_packet); // Packet 3
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
@@ -2456,8 +2455,8 @@ TEST_P(QuicConnectionTest, RetransmitOnNack) {
}
EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, second_packet_size - kQuicVersionSize, _)).
- Times(1);
+ OnPacketSent(_, _, _, second_packet_size - kQuicVersionSize, _))
+ .Times(1);
ProcessAckPacket(&nack_two);
}
@@ -2693,8 +2692,8 @@ TEST_P(QuicConnectionTest, SendPendingRetransmissionForQuicRstStreamNoError) {
TEST_P(QuicConnectionTest, DiscardRetransmit) {
QuicPacketNumber last_packet;
- SendStreamDataToPeer(1, "foo", 0, !kFin, &last_packet); // Packet 1
- SendStreamDataToPeer(1, "foos", 3, !kFin, &last_packet); // Packet 2
+ SendStreamDataToPeer(1, "foo", 0, !kFin, &last_packet); // Packet 1
+ SendStreamDataToPeer(1, "foos", 3, !kFin, &last_packet); // Packet 2
SendStreamDataToPeer(1, "fooos", 7, !kFin, &last_packet); // Packet 3
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
@@ -2734,8 +2733,7 @@ TEST_P(QuicConnectionTest, DiscardRetransmit) {
// Unblock the socket and attempt to send the queued packets. However,
// since the previous transmission has been acked, we will not
// send the retransmission.
- EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, _, _)).Times(0);
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0);
writer_->SetWritable();
connection_.OnCanWrite();
@@ -2888,7 +2886,6 @@ TEST_P(QuicConnectionTest, NoLimitPacketsPerNack) {
if (FLAGS_quic_general_loss_algorithm) {
SendAlgorithmInterface::CongestionVector lost_packets;
for (int i = 1; i < 15; ++i) {
- ;
lost_packets.push_back(std::make_pair(i, kMaxPacketSize));
}
EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _))
@@ -2913,7 +2910,7 @@ TEST_P(QuicConnectionTest, MultipleAcks) {
EXPECT_EQ(1u, last_packet);
SendStreamDataToPeer(3, "foo", 0, !kFin, &last_packet); // Packet 2
EXPECT_EQ(2u, last_packet);
- SendAckPacketToPeer(); // Packet 3
+ SendAckPacketToPeer(); // Packet 3
SendStreamDataToPeer(5, "foo", 0, !kFin, &last_packet); // Packet 4
EXPECT_EQ(4u, last_packet);
SendStreamDataToPeer(1, "foo", 3, !kFin, &last_packet); // Packet 5
@@ -2938,7 +2935,7 @@ TEST_P(QuicConnectionTest, DontLatchUnackedPacket) {
SendStreamDataToPeer(1, "foo", 0, !kFin, nullptr); // Packet 1;
// From now on, we send acks, so the send algorithm won't mark them pending.
ON_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
- .WillByDefault(Return(false));
+ .WillByDefault(Return(false));
SendAckPacketToPeer(); // Packet 2
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
@@ -2971,18 +2968,18 @@ TEST_P(QuicConnectionTest, DontLatchUnackedPacket) {
ProcessAckPacket(&frame);
ON_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
- .WillByDefault(Return(true));
+ .WillByDefault(Return(true));
SendStreamDataToPeer(1, "bar", 3, false, nullptr); // Packet 4
EXPECT_EQ(4u, stop_waiting()->least_unacked);
ON_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
- .WillByDefault(Return(false));
+ .WillByDefault(Return(false));
SendAckPacketToPeer(); // Packet 5
EXPECT_EQ(4u, least_unacked());
// Send two data packets at the end, and ensure if the last one is acked,
// the least unacked is raised above the ack packets.
ON_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
- .WillByDefault(Return(true));
+ .WillByDefault(Return(true));
SendStreamDataToPeer(1, "bar", 6, false, nullptr); // Packet 6
SendStreamDataToPeer(1, "bar", 9, false, nullptr); // Packet 7
@@ -3042,10 +3039,9 @@ TEST_P(QuicConnectionTest, ReviveMissingPacketWithVaryingConnectionIdLengths) {
connection_.set_debug_visitor(fec_visitor.get());
QuicPacketNumber fec_packet = 0;
- QuicConnectionIdLength lengths[] = {PACKET_8BYTE_CONNECTION_ID,
- PACKET_4BYTE_CONNECTION_ID,
- PACKET_1BYTE_CONNECTION_ID,
- PACKET_0BYTE_CONNECTION_ID};
+ QuicConnectionIdLength lengths[] = {
+ PACKET_8BYTE_CONNECTION_ID, PACKET_4BYTE_CONNECTION_ID,
+ PACKET_1BYTE_CONNECTION_ID, PACKET_0BYTE_CONNECTION_ID};
// For each connection id length size, revive a packet and check connection
// id length in the revived packet.
for (size_t i = 0; i < arraysize(lengths); ++i) {
@@ -3129,8 +3125,8 @@ TEST_P(QuicConnectionTest, TLP) {
}
TEST_P(QuicConnectionTest, RTO) {
- QuicTime default_retransmission_time = clock_.ApproximateNow().Add(
- DefaultRetransmissionTime());
+ QuicTime default_retransmission_time =
+ clock_.ApproximateNow().Add(DefaultRetransmissionTime());
SendStreamDataToPeer(3, "foo", 0, !kFin, nullptr);
EXPECT_EQ(1u, stop_waiting()->least_unacked);
@@ -3147,8 +3143,8 @@ TEST_P(QuicConnectionTest, RTO) {
}
TEST_P(QuicConnectionTest, RTOWithSameEncryptionLevel) {
- QuicTime default_retransmission_time = clock_.ApproximateNow().Add(
- DefaultRetransmissionTime());
+ QuicTime default_retransmission_time =
+ clock_.ApproximateNow().Add(DefaultRetransmissionTime());
use_tagging_decrypter();
// A TaggingEncrypter puts kTagSize copies of the given byte (0x01 here) at
@@ -3188,9 +3184,8 @@ TEST_P(QuicConnectionTest, SendHandshakeMessages) {
connection_.SetEncrypter(ENCRYPTION_NONE, new TaggingEncrypter(0x01));
// Attempt to send a handshake message and have the socket block.
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillRepeatedly(
- testing::Return(QuicTime::Delta::Zero()));
+ EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
+ .WillRepeatedly(testing::Return(QuicTime::Delta::Zero()));
BlockOnNextWrite();
connection_.SendStreamDataWithString(1, "foo", 0, !kFin, nullptr);
// The packet should be serialized, but not queued.
@@ -3228,8 +3223,7 @@ TEST_P(QuicConnectionTest,
connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
connection_.NeuterUnencryptedPackets();
- EXPECT_EQ(QuicTime::Zero(),
- connection_.GetRetransmissionAlarm()->deadline());
+ EXPECT_EQ(QuicTime::Zero(), connection_.GetRetransmissionAlarm()->deadline());
// Unblock the socket and ensure that no packets are sent.
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0);
writer_->SetWritable();
@@ -3278,8 +3272,8 @@ TEST_P(QuicConnectionTest, DelayForwardSecureEncryptionUntilClientIsReady) {
TEST_P(QuicConnectionTest, DelayForwardSecureEncryptionUntilManyPacketSent) {
// Set a congestion window of 10 packets.
QuicPacketCount congestion_window = 10;
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow()).WillRepeatedly(
- Return(congestion_window * kDefaultMaxPacketSize));
+ EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
+ .WillRepeatedly(Return(congestion_window * kDefaultMaxPacketSize));
// A TaggingEncrypter puts kTagSize copies of the given byte (0x02 here) at
// the end of the packet. We can test this to check which encrypter was used.
@@ -3405,23 +3399,21 @@ TEST_P(QuicConnectionTest, Buffer100NonDecryptablePackets) {
TEST_P(QuicConnectionTest, TestRetransmitOrder) {
QuicByteCount first_packet_size;
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).WillOnce(
- DoAll(SaveArg<3>(&first_packet_size), Return(true)));
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
+ .WillOnce(DoAll(SaveArg<3>(&first_packet_size), Return(true)));
connection_.SendStreamDataWithString(3, "first_packet", 0, !kFin, nullptr);
QuicByteCount second_packet_size;
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).WillOnce(
- DoAll(SaveArg<3>(&second_packet_size), Return(true)));
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
+ .WillOnce(DoAll(SaveArg<3>(&second_packet_size), Return(true)));
connection_.SendStreamDataWithString(3, "second_packet", 12, !kFin, nullptr);
EXPECT_NE(first_packet_size, second_packet_size);
// Advance the clock by huge time to make sure packets will be retransmitted.
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(10));
{
InSequence s;
- EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, first_packet_size, _));
- EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, second_packet_size, _));
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, first_packet_size, _));
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, second_packet_size, _));
}
connection_.GetRetransmissionAlarm()->Fire();
@@ -3429,10 +3421,8 @@ TEST_P(QuicConnectionTest, TestRetransmitOrder) {
clock_.AdvanceTime(QuicTime::Delta::FromSeconds(20));
{
InSequence s;
- EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, first_packet_size, _));
- EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, second_packet_size, _));
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, first_packet_size, _));
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, second_packet_size, _));
}
connection_.GetRetransmissionAlarm()->Fire();
}
@@ -3451,8 +3441,7 @@ TEST_P(QuicConnectionTest, SetRTOAfterWritingToSocket) {
TEST_P(QuicConnectionTest, DelayRTOWithAckReceipt) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
- .Times(2);
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
connection_.SendStreamDataWithString(2, "foo", 0, !kFin, nullptr);
connection_.SendStreamDataWithString(3, "bar", 0, !kFin, nullptr);
QuicAlarm* retransmission_alarm = connection_.GetRetransmissionAlarm();
@@ -3531,8 +3520,7 @@ TEST_P(QuicConnectionTest, InitialTimeout) {
EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_CONNECTION_TIMED_OUT, false));
// Simulate the timeout alarm firing.
- clock_.AdvanceTime(
- QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs - 1));
+ clock_.AdvanceTime(QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs - 1));
connection_.GetTimeoutAlarm()->Fire();
EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet());
@@ -3614,7 +3602,8 @@ TEST_P(QuicConnectionTest, PingAfterSend) {
EXPECT_TRUE(connection_.GetPingAlarm()->IsSet());
// The ping timer is set slightly less than 15 seconds in the future, because
// of the 1s ping timer alarm granularity.
- EXPECT_EQ(clock_.ApproximateNow().Add(QuicTime::Delta::FromSeconds(15))
+ EXPECT_EQ(clock_.ApproximateNow()
+ .Add(QuicTime::Delta::FromSeconds(15))
.Subtract(QuicTime::Delta::FromMilliseconds(5)),
connection_.GetPingAlarm()->deadline());
@@ -4214,12 +4203,12 @@ TEST_P(QuicConnectionTest, TestQueueLimitsOnSendStreamData) {
connection_.SetMaxPacketLength(length);
// Queue the first packet.
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillOnce(
- testing::Return(QuicTime::Delta::FromMicroseconds(10)));
+ EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
+ .WillOnce(testing::Return(QuicTime::Delta::FromMicroseconds(10)));
const string payload(payload_length, 'a');
- EXPECT_EQ(0u, connection_.SendStreamDataWithString(3, payload, 0, !kFin,
- nullptr).bytes_consumed);
+ EXPECT_EQ(0u,
+ connection_.SendStreamDataWithString(3, payload, 0, !kFin, nullptr)
+ .bytes_consumed);
EXPECT_EQ(0u, connection_.NumQueuedPackets());
}
@@ -4255,8 +4244,8 @@ TEST_P(QuicConnectionTest, LoopThroughSendingPacketsWithTruncation) {
// Now send some packets with no truncation.
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
EXPECT_EQ(payload.size(),
- connection_.SendStreamDataWithString(
- 3, payload, 0, !kFin, nullptr).bytes_consumed);
+ connection_.SendStreamDataWithString(3, payload, 0, !kFin, nullptr)
+ .bytes_consumed);
// Track the size of the second packet here. The overhead will be the largest
// we see in this test, due to the non-truncated connection id.
size_t non_truncated_packet_size = writer_->last_packet_size();
@@ -4267,8 +4256,8 @@ TEST_P(QuicConnectionTest, LoopThroughSendingPacketsWithTruncation) {
connection_.SetFromConfig(config);
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
EXPECT_EQ(payload.size(),
- connection_.SendStreamDataWithString(
- 3, payload, 0, !kFin, nullptr).bytes_consumed);
+ connection_.SendStreamDataWithString(3, payload, 0, !kFin, nullptr)
+ .bytes_consumed);
// Verify that we have 8 fewer bytes than in the non-truncated case. The
// first packet got 4 bytes of extra payload due to the truncation, and the
// headers here are also 4 byte smaller.
@@ -4279,8 +4268,8 @@ TEST_P(QuicConnectionTest, LoopThroughSendingPacketsWithTruncation) {
connection_.SetFromConfig(config);
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
EXPECT_EQ(payload.size(),
- connection_.SendStreamDataWithString(
- 3, payload, 0, !kFin, nullptr).bytes_consumed);
+ connection_.SendStreamDataWithString(3, payload, 0, !kFin, nullptr)
+ .bytes_consumed);
// Just like above, we save 7 bytes on payload, and 7 on truncation.
EXPECT_EQ(non_truncated_packet_size, writer_->last_packet_size() + 7 * 2);
@@ -4289,8 +4278,8 @@ TEST_P(QuicConnectionTest, LoopThroughSendingPacketsWithTruncation) {
connection_.SetFromConfig(config);
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2);
EXPECT_EQ(payload.size(),
- connection_.SendStreamDataWithString(
- 3, payload, 0, !kFin, nullptr).bytes_consumed);
+ connection_.SendStreamDataWithString(3, payload, 0, !kFin, nullptr)
+ .bytes_consumed);
// Just like above, we save 8 bytes on payload, and 8 on truncation.
EXPECT_EQ(non_truncated_packet_size, writer_->last_packet_size() + 8 * 2);
}
@@ -4472,9 +4461,9 @@ TEST_P(QuicConnectionTest, BlockAndBufferOnFirstCHLOPacketOfTwo) {
TEST_P(QuicConnectionTest, BundleAckForSecondCHLO) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
EXPECT_FALSE(connection_.GetAckAlarm()->IsSet());
- EXPECT_CALL(visitor_, OnCanWrite()).WillOnce(
- IgnoreResult(InvokeWithoutArgs(&connection_,
- &TestConnection::SendCryptoStreamData)));
+ EXPECT_CALL(visitor_, OnCanWrite())
+ .WillOnce(IgnoreResult(InvokeWithoutArgs(
+ &connection_, &TestConnection::SendCryptoStreamData)));
// Process a packet from the crypto stream, which is frame1_'s default.
// Receiving the CHLO as packet 2 first will cause the connection to
// immediately send an ack, due to the packet gap.
@@ -4540,10 +4529,9 @@ TEST_P(QuicConnectionTest, BundleAckWithDataOnIncomingAck) {
EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _))
.WillOnce(Return(PacketNumberSet()));
}
- EXPECT_CALL(visitor_, OnCanWrite()).WillOnce(
- IgnoreResult(InvokeWithoutArgs(
- &connection_,
- &TestConnection::EnsureWritableAndSendStreamData5)));
+ EXPECT_CALL(visitor_, OnCanWrite())
+ .WillOnce(IgnoreResult(InvokeWithoutArgs(
+ &connection_, &TestConnection::EnsureWritableAndSendStreamData5)));
ProcessAckPacket(&ack);
// Check that ack is bundled with outgoing data and the delayed ack
@@ -4716,8 +4704,8 @@ TEST_P(QuicConnectionTest, EntropyCalculationForTruncatedAck) {
ProcessDataPacket(i, 1, entropy_flag);
}
for (int i = 1; i < 50; ++i) {
- EXPECT_EQ(entropy[i], QuicConnectionPeer::ReceivedEntropyHash(
- &connection_, i));
+ EXPECT_EQ(entropy[i],
+ QuicConnectionPeer::ReceivedEntropyHash(&connection_, i));
}
}
@@ -4827,8 +4815,8 @@ TEST_P(QuicConnectionTest,
TEST_P(QuicConnectionTest, ClientHandlesVersionNegotiation) {
// Start out with some unsupported version.
- QuicConnectionPeer::GetFramer(&connection_)->set_version_for_tests(
- QUIC_VERSION_UNSUPPORTED);
+ QuicConnectionPeer::GetFramer(&connection_)
+ ->set_version_for_tests(QUIC_VERSION_UNSUPPORTED);
// Send a version negotiation packet.
scoped_ptr<QuicEncryptedPacket> encrypted(
@@ -4861,9 +4849,8 @@ TEST_P(QuicConnectionTest, ClientHandlesVersionNegotiation) {
TEST_P(QuicConnectionTest, BadVersionNegotiation) {
// Send a version negotiation packet with the version the client started with.
// It should be rejected.
- EXPECT_CALL(visitor_,
- OnConnectionClosed(QUIC_INVALID_VERSION_NEGOTIATION_PACKET,
- false));
+ EXPECT_CALL(visitor_, OnConnectionClosed(
+ QUIC_INVALID_VERSION_NEGOTIATION_PACKET, false));
scoped_ptr<QuicEncryptedPacket> encrypted(
framer_.BuildVersionNegotiationPacket(connection_id_,
QuicSupportedVersions()));
@@ -4909,8 +4896,8 @@ TEST_P(QuicConnectionTest, CheckSendStats) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
ProcessAckPacket(&nack_three);
- EXPECT_CALL(*send_algorithm_, BandwidthEstimate()).WillOnce(
- Return(QuicBandwidth::Zero()));
+ EXPECT_CALL(*send_algorithm_, BandwidthEstimate())
+ .WillOnce(Return(QuicBandwidth::Zero()));
const QuicConnectionStats& stats = connection_.GetStats();
EXPECT_EQ(3 * first_packet_size + 2 * second_packet_size - kQuicVersionSize,
@@ -4933,8 +4920,8 @@ TEST_P(QuicConnectionTest, CheckReceiveStats) {
received_bytes += ProcessDataPacket(3, 1, !kEntropyFlag);
received_bytes += ProcessFecPacket(4, 1, true, !kEntropyFlag, nullptr);
- EXPECT_CALL(*send_algorithm_, BandwidthEstimate()).WillOnce(
- Return(QuicBandwidth::Zero()));
+ EXPECT_CALL(*send_algorithm_, BandwidthEstimate())
+ .WillOnce(Return(QuicBandwidth::Zero()));
const QuicConnectionStats& stats = connection_.GetStats();
EXPECT_EQ(received_bytes, stats.bytes_received);
@@ -5155,8 +5142,8 @@ TEST_P(QuicConnectionTest, AckNotifierCallbackForAckAfterRTO) {
// Create a listener which we expect to be called.
scoped_refptr<MockAckListener> listener(new StrictMock<MockAckListener>);
- QuicTime default_retransmission_time = clock_.ApproximateNow().Add(
- DefaultRetransmissionTime());
+ QuicTime default_retransmission_time =
+ clock_.ApproximateNow().Add(DefaultRetransmissionTime());
connection_.SendStreamDataWithString(3, "foo", 0, !kFin, listener.get());
EXPECT_EQ(1u, stop_waiting()->least_unacked);
@@ -5312,8 +5299,8 @@ TEST_P(QuicConnectionTest, NetworkChangeVisitorCwndCallbackChangesFecState) {
EXPECT_TRUE(visitor);
// Increase FEC group size by increasing congestion window to a large number.
- EXPECT_CALL(*send_algorithm_, GetCongestionWindow()).WillRepeatedly(
- Return(1000 * kDefaultTCPMSS));
+ EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
+ .WillRepeatedly(Return(1000 * kDefaultTCPMSS));
visitor->OnCongestionWindowChange();
EXPECT_LT(max_packets_per_fec_group, creator_->max_packets_per_fec_group());
}
diff --git a/net/quic/quic_crypto_client_stream.cc b/net/quic/quic_crypto_client_stream.cc
index ce32893..828d9c9 100644
--- a/net/quic/quic_crypto_client_stream.cc
+++ b/net/quic/quic_crypto_client_stream.cc
@@ -46,11 +46,11 @@ QuicCryptoClientStreamBase::QuicCryptoClientStreamBase(
: QuicCryptoStream(session) {}
QuicCryptoClientStream::ChannelIDSourceCallbackImpl::
-ChannelIDSourceCallbackImpl(QuicCryptoClientStream* stream)
+ ChannelIDSourceCallbackImpl(QuicCryptoClientStream* stream)
: stream_(stream) {}
QuicCryptoClientStream::ChannelIDSourceCallbackImpl::
-~ChannelIDSourceCallbackImpl() {}
+ ~ChannelIDSourceCallbackImpl() {}
void QuicCryptoClientStream::ChannelIDSourceCallbackImpl::Run(
scoped_ptr<ChannelIDKey>* channel_id_key) {
@@ -76,7 +76,7 @@ QuicCryptoClientStream::ProofVerifierCallbackImpl::ProofVerifierCallbackImpl(
: stream_(stream) {}
QuicCryptoClientStream::ProofVerifierCallbackImpl::
-~ProofVerifierCallbackImpl() {}
+ ~ProofVerifierCallbackImpl() {}
void QuicCryptoClientStream::ProofVerifierCallbackImpl::Run(
bool ok,
@@ -197,8 +197,7 @@ void QuicCryptoClientStream::HandleServerConfigUpdateMessage(
DoHandshakeLoop(nullptr);
}
-void QuicCryptoClientStream::DoHandshakeLoop(
- const CryptoHandshakeMessage* in) {
+void QuicCryptoClientStream::DoHandshakeLoop(const CryptoHandshakeMessage* in) {
QuicCryptoClientConfig::CachedState* cached =
crypto_config_->LookupOrCreate(server_id_);
@@ -300,8 +299,7 @@ void QuicCryptoClientStream::DoSendCHLO(
if (!cached->IsComplete(session()->connection()->clock()->WallNow())) {
crypto_config_->FillInchoateClientHello(
- server_id_,
- session()->connection()->supported_versions().front(),
+ server_id_, session()->connection()->supported_versions().front(),
cached, &crypto_negotiated_params_, &out);
// Pad the inchoate client hello to fill up a packet.
const QuicByteCount kFramingOverhead = 50; // A rough estimate.
@@ -336,16 +334,11 @@ void QuicCryptoClientStream::DoSendCHLO(
string error_details;
QuicErrorCode error = crypto_config_->FillClientHello(
- server_id_,
- session()->connection()->connection_id(),
- session()->connection()->supported_versions().front(),
- cached,
+ server_id_, session()->connection()->connection_id(),
+ session()->connection()->supported_versions().front(), cached,
session()->connection()->clock()->WallNow(),
- session()->connection()->random_generator(),
- channel_id_key_.get(),
- &crypto_negotiated_params_,
- &out,
- &error_details);
+ session()->connection()->random_generator(), channel_id_key_.get(),
+ &crypto_negotiated_params_, &out, &error_details);
if (error != QUIC_NO_ERROR) {
// Flush the cached config so that, if it's bad, the server has a
@@ -371,15 +364,13 @@ void QuicCryptoClientStream::DoSendCHLO(
session()->connection()->SetEncrypter(
ENCRYPTION_INITIAL,
crypto_negotiated_params_.initial_crypters.encrypter.release());
- session()->connection()->SetDefaultEncryptionLevel(
- ENCRYPTION_INITIAL);
+ session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_INITIAL);
if (!encryption_established_) {
encryption_established_ = true;
session()->OnCryptoHandshakeEvent(
QuicSession::ENCRYPTION_FIRST_ESTABLISHED);
} else {
- session()->OnCryptoHandshakeEvent(
- QuicSession::ENCRYPTION_REESTABLISHED);
+ session()->OnCryptoHandshakeEvent(QuicSession::ENCRYPTION_REESTABLISHED);
}
}
@@ -494,8 +485,8 @@ void QuicCryptoClientStream::DoVerifyProofComplete(
next_state_ = STATE_NONE;
UMA_HISTOGRAM_BOOLEAN("Net.QuicVerifyProofFailed.HandshakeConfirmed",
handshake_confirmed());
- CloseConnectionWithDetails(
- QUIC_PROOF_INVALID, "Proof invalid: " + verify_error_details_);
+ CloseConnectionWithDetails(QUIC_PROOF_INVALID,
+ "Proof invalid: " + verify_error_details_);
return;
}
@@ -525,10 +516,8 @@ QuicAsyncStatus QuicCryptoClientStream::DoGetChannelID(
ChannelIDSourceCallbackImpl* channel_id_source_callback =
new ChannelIDSourceCallbackImpl(this);
- QuicAsyncStatus status =
- crypto_config_->channel_id_source()->GetChannelIDKey(
- server_id_.host(), &channel_id_key_,
- channel_id_source_callback);
+ QuicAsyncStatus status = crypto_config_->channel_id_source()->GetChannelIDKey(
+ server_id_.host(), &channel_id_key_, channel_id_source_callback);
switch (status) {
case QUIC_PENDING:
@@ -622,10 +611,9 @@ void QuicCryptoClientStream::DoReceiveSHLO(
session()->connection()->SetAlternativeDecrypter(
ENCRYPTION_FORWARD_SECURE, crypters->decrypter.release(),
false /* don't latch */);
- session()->connection()->SetEncrypter(
- ENCRYPTION_FORWARD_SECURE, crypters->encrypter.release());
- session()->connection()->SetDefaultEncryptionLevel(
- ENCRYPTION_FORWARD_SECURE);
+ session()->connection()->SetEncrypter(ENCRYPTION_FORWARD_SECURE,
+ crypters->encrypter.release());
+ session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
handshake_confirmed_ = true;
session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED);
@@ -665,8 +653,8 @@ bool QuicCryptoClientStream::RequiresChannelID(
}
const QuicTag* their_proof_demands;
size_t num_their_proof_demands;
- if (scfg->GetTaglist(kPDMD, &their_proof_demands,
- &num_their_proof_demands) != QUIC_NO_ERROR) {
+ if (scfg->GetTaglist(kPDMD, &their_proof_demands, &num_their_proof_demands) !=
+ QUIC_NO_ERROR) {
return false;
}
for (size_t i = 0; i < num_their_proof_demands; i++) {
diff --git a/net/quic/quic_crypto_client_stream_test.cc b/net/quic/quic_crypto_client_stream_test.cc
index 0126116..7addbe1 100644
--- a/net/quic/quic_crypto_client_stream_test.cc
+++ b/net/quic/quic_crypto_client_stream_test.cc
@@ -83,7 +83,7 @@ TEST_F(QuicCryptoClientStreamTest, MessageAfterHandshake) {
CompleteCryptoHandshake();
EXPECT_CALL(*connection_, SendConnectionClose(
- QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE));
+ QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE));
message_.set_tag(kCHLO);
ConstructHandshakeMessage();
stream()->OnStreamFrame(QuicStreamFrame(kCryptoStreamId, /*fin=*/false,
@@ -97,8 +97,9 @@ TEST_F(QuicCryptoClientStreamTest, BadMessageType) {
message_.set_tag(kCHLO);
ConstructHandshakeMessage();
- EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(
- QUIC_INVALID_CRYPTO_MESSAGE_TYPE, "Expected REJ"));
+ EXPECT_CALL(*connection_,
+ SendConnectionCloseWithDetails(QUIC_INVALID_CRYPTO_MESSAGE_TYPE,
+ "Expected REJ"));
stream()->OnStreamFrame(QuicStreamFrame(kCryptoStreamId, /*fin=*/false,
/*offset=*/0,
message_data_->AsStringPiece()));
@@ -110,8 +111,7 @@ TEST_F(QuicCryptoClientStreamTest, NegotiatedParameters) {
const QuicConfig* config = session_->config();
EXPECT_EQ(kMaximumIdleTimeoutSecs,
config->IdleConnectionStateLifetime().ToSeconds());
- EXPECT_EQ(kDefaultMaxStreamsPerConnection,
- config->MaxStreamsPerConnection());
+ EXPECT_EQ(kDefaultMaxStreamsPerConnection, config->MaxStreamsPerConnection());
const QuicCryptoNegotiatedParameters& crypto_params(
stream()->crypto_negotiated_params());
@@ -169,24 +169,21 @@ TEST_F(QuicCryptoClientStreamTest, ServerConfigUpdate) {
// Initialize using {...} syntax to avoid trailing \0 if converting from
// string.
- unsigned char stk[] = { 'x', 's', 't', 'k' };
+ unsigned char stk[] = {'x', 's', 't', 'k'};
// Minimum SCFG that passes config validation checks.
- unsigned char scfg[] = {
- // SCFG
- 0x53, 0x43, 0x46, 0x47,
- // num entries
- 0x01, 0x00,
- // padding
- 0x00, 0x00,
- // EXPY
- 0x45, 0x58, 0x50, 0x59,
- // EXPY end offset
- 0x08, 0x00, 0x00, 0x00,
- // Value
- '1', '2', '3', '4',
- '5', '6', '7', '8'
- };
+ unsigned char scfg[] = {// SCFG
+ 0x53, 0x43, 0x46, 0x47,
+ // num entries
+ 0x01, 0x00,
+ // padding
+ 0x00, 0x00,
+ // EXPY
+ 0x45, 0x58, 0x50, 0x59,
+ // EXPY end offset
+ 0x08, 0x00, 0x00, 0x00,
+ // Value
+ '1', '2', '3', '4', '5', '6', '7', '8'};
CryptoHandshakeMessage server_config_update;
server_config_update.set_tag(kSCUP);
@@ -209,7 +206,7 @@ TEST_F(QuicCryptoClientStreamTest, ServerConfigUpdate) {
TEST_F(QuicCryptoClientStreamTest, ServerConfigUpdateBeforeHandshake) {
EXPECT_CALL(*connection_, SendConnectionClose(
- QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE));
+ QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE));
CryptoHandshakeMessage server_config_update;
server_config_update.set_tag(kSCUP);
scoped_ptr<QuicData> data(
diff --git a/net/quic/quic_crypto_server_stream.cc b/net/quic/quic_crypto_server_stream.cc
index ea4b35d..c11f1bb 100644
--- a/net/quic/quic_crypto_server_stream.cc
+++ b/net/quic/quic_crypto_server_stream.cc
@@ -289,8 +289,8 @@ bool QuicCryptoServerStream::GetBase64SHA256ClientChannelID(
uint8 digest[32];
hash->Finish(digest, sizeof(digest));
- base::Base64Encode(string(
- reinterpret_cast<const char*>(digest), sizeof(digest)), output);
+ base::Base64Encode(
+ string(reinterpret_cast<const char*>(digest), sizeof(digest)), output);
// Remove padding.
size_t len = output->size();
if (len >= 2) {
@@ -336,14 +336,15 @@ QuicErrorCode QuicCryptoServerStream::ProcessClientHello(
&crypto_negotiated_params_, &crypto_proof_, reply, error_details);
}
-void QuicCryptoServerStream::OverrideQuicConfigDefaults(QuicConfig* config) {
-}
+void QuicCryptoServerStream::OverrideQuicConfigDefaults(QuicConfig* config) {}
QuicCryptoServerStream::ValidateCallback::ValidateCallback(
- QuicCryptoServerStream* parent) : parent_(parent) {
-}
+ QuicCryptoServerStream* parent)
+ : parent_(parent) {}
-void QuicCryptoServerStream::ValidateCallback::Cancel() { parent_ = nullptr; }
+void QuicCryptoServerStream::ValidateCallback::Cancel() {
+ parent_ = nullptr;
+}
void QuicCryptoServerStream::ValidateCallback::RunImpl(
const CryptoHandshakeMessage& client_hello,
diff --git a/net/quic/quic_crypto_stream.cc b/net/quic/quic_crypto_stream.cc
index 84bdf8c..d16ee27 100644
--- a/net/quic/quic_crypto_stream.cc
+++ b/net/quic/quic_crypto_stream.cc
@@ -78,21 +78,17 @@ void QuicCryptoStream::SendHandshakeMessage(
WriteOrBufferData(string(data.data(), data.length()), false, listener);
}
-bool QuicCryptoStream::ExportKeyingMaterial(
- StringPiece label,
- StringPiece context,
- size_t result_len,
- string* result) const {
+bool QuicCryptoStream::ExportKeyingMaterial(StringPiece label,
+ StringPiece context,
+ size_t result_len,
+ string* result) const {
if (!handshake_confirmed()) {
DLOG(ERROR) << "ExportKeyingMaterial was called before forward-secure"
<< "encryption was established.";
return false;
}
return CryptoUtils::ExportKeyingMaterial(
- crypto_negotiated_params_.subkey_secret,
- label,
- context,
- result_len,
+ crypto_negotiated_params_.subkey_secret, label, context, result_len,
result);
}
diff --git a/net/quic/quic_crypto_stream_test.cc b/net/quic/quic_crypto_stream_test.cc
index a6ffdbe..afc83c4 100644
--- a/net/quic/quic_crypto_stream_test.cc
+++ b/net/quic/quic_crypto_stream_test.cc
@@ -26,16 +26,13 @@ namespace {
class MockQuicCryptoStream : public QuicCryptoStream {
public:
explicit MockQuicCryptoStream(QuicSession* session)
- : QuicCryptoStream(session) {
- }
+ : QuicCryptoStream(session) {}
void OnHandshakeMessage(const CryptoHandshakeMessage& message) override {
messages_.push_back(message);
}
- vector<CryptoHandshakeMessage>* messages() {
- return &messages_;
- }
+ vector<CryptoHandshakeMessage>* messages() { return &messages_; }
private:
vector<CryptoHandshakeMessage> messages_;
@@ -97,8 +94,7 @@ TEST_F(QuicCryptoStreamTest, ProcessBadData) {
EXPECT_EQ(1, bad[kFirstTagIndex]);
bad[kFirstTagIndex] = 0x7F; // out of order tag
- EXPECT_CALL(*connection_,
- SendConnectionClose(QUIC_CRYPTO_TAGS_OUT_OF_ORDER));
+ EXPECT_CALL(*connection_, SendConnectionClose(QUIC_CRYPTO_TAGS_OUT_OF_ORDER));
stream_.OnStreamFrame(
QuicStreamFrame(kCryptoStreamId, /*fin=*/false, /*offset=*/0, bad));
}
diff --git a/net/quic/quic_data_reader.cc b/net/quic/quic_data_reader.cc
index 7542c83..5433283 100644
--- a/net/quic/quic_data_reader.cc
+++ b/net/quic/quic_data_reader.cc
@@ -12,10 +12,7 @@ using base::StringPiece;
namespace net {
QuicDataReader::QuicDataReader(const char* data, const size_t len)
- : data_(data),
- len_(len),
- pos_(0) {
-}
+ : data_(data), len_(len), pos_(0) {}
bool QuicDataReader::ReadUInt16(uint16* result) {
return ReadBytes(result, sizeof(*result));
diff --git a/net/quic/quic_data_writer.cc b/net/quic/quic_data_writer.cc
index 4925782..96ae213 100644
--- a/net/quic/quic_data_writer.cc
+++ b/net/quic/quic_data_writer.cc
@@ -14,11 +14,9 @@ using std::numeric_limits;
namespace net {
QuicDataWriter::QuicDataWriter(size_t size, char* buffer)
- : buffer_(buffer), capacity_(size), length_(0) {
-}
+ : buffer_(buffer), capacity_(size), length_(0) {}
-QuicDataWriter::~QuicDataWriter() {
-}
+QuicDataWriter::~QuicDataWriter() {}
char* QuicDataWriter::data() {
return buffer_;
@@ -144,5 +142,4 @@ void QuicDataWriter::WritePadding() {
length_ = capacity_;
}
-
} // namespace net
diff --git a/net/quic/quic_data_writer.h b/net/quic/quic_data_writer.h
index 0f1df20..b6e1667 100644
--- a/net/quic/quic_data_writer.h
+++ b/net/quic/quic_data_writer.h
@@ -53,9 +53,7 @@ class NET_EXPORT_PRIVATE QuicDataWriter {
// Fills the remaining buffer with null characters.
void WritePadding();
- size_t capacity() const {
- return capacity_;
- }
+ size_t capacity() const { return capacity_; }
private:
// Returns the location that the data should be written at, or nullptr if
diff --git a/net/quic/quic_data_writer_test.cc b/net/quic/quic_data_writer_test.cc
index d34e5ce..f4be7a7 100644
--- a/net/quic/quic_data_writer_test.cc
+++ b/net/quic/quic_data_writer_test.cc
@@ -30,30 +30,67 @@ TEST(QuicDataWriterTest, WriteUFloat16) {
uint16 encoded;
};
TestCase test_cases[] = {
- // Small numbers represent themselves.
- { 0, 0 }, { 1, 1 }, { 2, 2 }, { 3, 3 }, { 4, 4 }, { 5, 5 }, { 6, 6 },
- { 7, 7 }, { 15, 15 }, { 31, 31 }, { 42, 42 }, { 123, 123 }, { 1234, 1234 },
- // Check transition through 2^11.
- { 2046, 2046 }, { 2047, 2047 }, { 2048, 2048 }, { 2049, 2049 },
- // Running out of mantissa at 2^12.
- { 4094, 4094 }, { 4095, 4095 }, { 4096, 4096 }, { 4097, 4096 },
- { 4098, 4097 }, { 4099, 4097 }, { 4100, 4098 }, { 4101, 4098 },
- // Check transition through 2^13.
- { 8190, 6143 }, { 8191, 6143 }, { 8192, 6144 }, { 8193, 6144 },
- { 8194, 6144 }, { 8195, 6144 }, { 8196, 6145 }, { 8197, 6145 },
- // Half-way through the exponents.
- { 0x7FF8000, 0x87FF }, { 0x7FFFFFF, 0x87FF }, { 0x8000000, 0x8800 },
- { 0xFFF0000, 0x8FFF }, { 0xFFFFFFF, 0x8FFF }, { 0x10000000, 0x9000 },
- // Transition into the largest exponent.
- { 0x1FFFFFFFFFE, 0xF7FF}, { 0x1FFFFFFFFFF, 0xF7FF},
- { 0x20000000000, 0xF800}, { 0x20000000001, 0xF800},
- { 0x2003FFFFFFE, 0xF800}, { 0x2003FFFFFFF, 0xF800},
- { 0x20040000000, 0xF801}, { 0x20040000001, 0xF801},
- // Transition into the max value and clamping.
- { 0x3FF80000000, 0xFFFE}, { 0x3FFBFFFFFFF, 0xFFFE},
- { 0x3FFC0000000, 0xFFFF}, { 0x3FFC0000001, 0xFFFF},
- { 0x3FFFFFFFFFF, 0xFFFF}, { 0x40000000000, 0xFFFF},
- { 0xFFFFFFFFFFFFFFFF, 0xFFFF},
+ // Small numbers represent themselves.
+ {0, 0},
+ {1, 1},
+ {2, 2},
+ {3, 3},
+ {4, 4},
+ {5, 5},
+ {6, 6},
+ {7, 7},
+ {15, 15},
+ {31, 31},
+ {42, 42},
+ {123, 123},
+ {1234, 1234},
+ // Check transition through 2^11.
+ {2046, 2046},
+ {2047, 2047},
+ {2048, 2048},
+ {2049, 2049},
+ // Running out of mantissa at 2^12.
+ {4094, 4094},
+ {4095, 4095},
+ {4096, 4096},
+ {4097, 4096},
+ {4098, 4097},
+ {4099, 4097},
+ {4100, 4098},
+ {4101, 4098},
+ // Check transition through 2^13.
+ {8190, 6143},
+ {8191, 6143},
+ {8192, 6144},
+ {8193, 6144},
+ {8194, 6144},
+ {8195, 6144},
+ {8196, 6145},
+ {8197, 6145},
+ // Half-way through the exponents.
+ {0x7FF8000, 0x87FF},
+ {0x7FFFFFF, 0x87FF},
+ {0x8000000, 0x8800},
+ {0xFFF0000, 0x8FFF},
+ {0xFFFFFFF, 0x8FFF},
+ {0x10000000, 0x9000},
+ // Transition into the largest exponent.
+ {0x1FFFFFFFFFE, 0xF7FF},
+ {0x1FFFFFFFFFF, 0xF7FF},
+ {0x20000000000, 0xF800},
+ {0x20000000001, 0xF800},
+ {0x2003FFFFFFE, 0xF800},
+ {0x2003FFFFFFF, 0xF800},
+ {0x20040000000, 0xF801},
+ {0x20040000001, 0xF801},
+ // Transition into the max value and clamping.
+ {0x3FF80000000, 0xFFFE},
+ {0x3FFBFFFFFFF, 0xFFFE},
+ {0x3FFC0000000, 0xFFFF},
+ {0x3FFC0000001, 0xFFFF},
+ {0x3FFFFFFFFFF, 0xFFFF},
+ {0x40000000000, 0xFFFF},
+ {0xFFFFFFFFFFFFFFFF, 0xFFFF},
};
int num_test_cases = sizeof(test_cases) / sizeof(test_cases[0]);
@@ -71,26 +108,49 @@ TEST(QuicDataWriterTest, ReadUFloat16) {
uint16 encoded;
};
TestCase test_cases[] = {
- // There are fewer decoding test cases because encoding truncates, and
- // decoding returns the smallest expansion.
- // Small numbers represent themselves.
- { 0, 0 }, { 1, 1 }, { 2, 2 }, { 3, 3 }, { 4, 4 }, { 5, 5 }, { 6, 6 },
- { 7, 7 }, { 15, 15 }, { 31, 31 }, { 42, 42 }, { 123, 123 }, { 1234, 1234 },
- // Check transition through 2^11.
- { 2046, 2046 }, { 2047, 2047 }, { 2048, 2048 }, { 2049, 2049 },
- // Running out of mantissa at 2^12.
- { 4094, 4094 }, { 4095, 4095 }, { 4096, 4096 },
- { 4098, 4097 }, { 4100, 4098 },
- // Check transition through 2^13.
- { 8190, 6143 }, { 8192, 6144 }, { 8196, 6145 },
- // Half-way through the exponents.
- { 0x7FF8000, 0x87FF }, { 0x8000000, 0x8800 },
- { 0xFFF0000, 0x8FFF }, { 0x10000000, 0x9000 },
- // Transition into the largest exponent.
- { 0x1FFE0000000, 0xF7FF}, { 0x20000000000, 0xF800},
- { 0x20040000000, 0xF801},
- // Transition into the max value.
- { 0x3FF80000000, 0xFFFE}, { 0x3FFC0000000, 0xFFFF},
+ // There are fewer decoding test cases because encoding truncates, and
+ // decoding returns the smallest expansion.
+ // Small numbers represent themselves.
+ {0, 0},
+ {1, 1},
+ {2, 2},
+ {3, 3},
+ {4, 4},
+ {5, 5},
+ {6, 6},
+ {7, 7},
+ {15, 15},
+ {31, 31},
+ {42, 42},
+ {123, 123},
+ {1234, 1234},
+ // Check transition through 2^11.
+ {2046, 2046},
+ {2047, 2047},
+ {2048, 2048},
+ {2049, 2049},
+ // Running out of mantissa at 2^12.
+ {4094, 4094},
+ {4095, 4095},
+ {4096, 4096},
+ {4098, 4097},
+ {4100, 4098},
+ // Check transition through 2^13.
+ {8190, 6143},
+ {8192, 6144},
+ {8196, 6145},
+ // Half-way through the exponents.
+ {0x7FF8000, 0x87FF},
+ {0x8000000, 0x8800},
+ {0xFFF0000, 0x8FFF},
+ {0x10000000, 0x9000},
+ // Transition into the largest exponent.
+ {0x1FFE0000000, 0xF7FF},
+ {0x20000000000, 0xF800},
+ {0x20040000000, 0xF801},
+ // Transition into the max value.
+ {0x3FF80000000, 0xFFFE},
+ {0x3FFC0000000, 0xFFFF},
};
int num_test_cases = sizeof(test_cases) / sizeof(test_cases[0]);
diff --git a/net/quic/quic_default_packet_writer.cc b/net/quic/quic_default_packet_writer.cc
index f81a227..a8baf1b 100644
--- a/net/quic/quic_default_packet_writer.cc
+++ b/net/quic/quic_default_packet_writer.cc
@@ -13,8 +13,7 @@
namespace net {
-QuicDefaultPacketWriter::QuicDefaultPacketWriter() : weak_factory_(this) {
-}
+QuicDefaultPacketWriter::QuicDefaultPacketWriter() : weak_factory_(this) {}
QuicDefaultPacketWriter::QuicDefaultPacketWriter(Socket* socket)
: socket_(socket), write_blocked_(false), weak_factory_(this) {}
@@ -30,8 +29,7 @@ WriteResult QuicDefaultPacketWriter::WritePacket(
new StringIOBuffer(std::string(buffer, buf_len)));
DCHECK(!IsWriteBlocked());
base::TimeTicks now = base::TimeTicks::Now();
- int rv = socket_->Write(buf.get(),
- buf_len,
+ int rv = socket_->Write(buf.get(), buf_len,
base::Bind(&QuicDefaultPacketWriter::OnWriteComplete,
weak_factory_.GetWeakPtr()));
WriteStatus status = WRITE_STATUS_OK;
diff --git a/net/quic/quic_default_packet_writer.h b/net/quic/quic_default_packet_writer.h
index a045ebd..2b58ade 100644
--- a/net/quic/quic_default_packet_writer.h
+++ b/net/quic/quic_default_packet_writer.h
@@ -35,14 +35,10 @@ class NET_EXPORT_PRIVATE QuicDefaultPacketWriter : public QuicPacketWriter {
QuicByteCount GetMaxPacketSize(const IPEndPoint& peer_address) const override;
void OnWriteComplete(int rv);
- void SetConnection(QuicConnection* connection) {
- connection_ = connection;
- }
+ void SetConnection(QuicConnection* connection) { connection_ = connection; }
protected:
- void set_write_blocked(bool is_blocked) {
- write_blocked_ = is_blocked;
- }
+ void set_write_blocked(bool is_blocked) { write_blocked_ = is_blocked; }
private:
Socket* socket_;
diff --git a/net/quic/quic_end_to_end_unittest.cc b/net/quic/quic_end_to_end_unittest.cc
index f1bf367..e7145c6 100644
--- a/net/quic/quic_end_to_end_unittest.cc
+++ b/net/quic/quic_end_to_end_unittest.cc
@@ -162,8 +162,8 @@ class QuicEndToEndTest : public PlatformTest {
server_thread_.reset(new ServerThread(server, server_address_,
strike_register_no_startup_period_));
server_thread_->Initialize();
- server_address_ = IPEndPoint(server_address_.address(),
- server_thread_->GetPort());
+ server_address_ =
+ IPEndPoint(server_address_.address(), server_thread_->GetPort());
server_thread_->Start();
server_started_ = true;
}
@@ -218,8 +218,7 @@ class QuicEndToEndTest : public PlatformTest {
const std::string& body) {
ASSERT_TRUE(consumer.is_done());
ASSERT_EQ(OK, consumer.error());
- EXPECT_EQ(status_line,
- consumer.response_info()->headers->GetStatusLine());
+ EXPECT_EQ(status_line, consumer.response_info()->headers->GetStatusLine());
EXPECT_EQ(body, consumer.content());
}
@@ -307,11 +306,10 @@ TEST_F(QuicEndToEndTest, MAYBE_UberTest) {
std::vector<TestTransactionConsumer*> consumers;
size_t num_requests = 100;
for (size_t i = 0; i < num_requests; ++i) {
- TestTransactionConsumer* consumer =
- new TestTransactionConsumer(DEFAULT_PRIORITY,
- transaction_factory_.get());
- consumers.push_back(consumer);
- consumer->Start(&request_, BoundNetLog());
+ TestTransactionConsumer* consumer = new TestTransactionConsumer(
+ DEFAULT_PRIORITY, transaction_factory_.get());
+ consumers.push_back(consumer);
+ consumer->Start(&request_, BoundNetLog());
}
// Will terminate when the last consumer completes.
diff --git a/net/quic/quic_fec_group_test.cc b/net/quic/quic_fec_group_test.cc
index 0598da0..9778302 100644
--- a/net/quic/quic_fec_group_test.cc
+++ b/net/quic/quic_fec_group_test.cc
@@ -26,11 +26,7 @@ const char* kData[] = {
"", // dummy
// kData[1] must be at least as long as every element of kData[], because
// it is used to calculate kDataMaxLen.
- "abc12345678",
- "987defg",
- "ghi12345",
- "987jlkmno",
- "mno4567890",
+ "abc12345678", "987defg", "ghi12345", "987jlkmno", "mno4567890",
"789pqrstuvw",
};
// The maximum length of an element of kData.
@@ -40,12 +36,7 @@ const char* kDataSingle = kData[1];
const bool kEntropyFlag[] = {
false, // dummy
- false,
- true,
- true,
- false,
- true,
- true,
+ false, true, true, false, true, true,
};
} // namespace
@@ -87,8 +78,8 @@ class QuicFecGroupTest : public ::testing::Test {
QuicPacketHeader header;
header.packet_number = packet;
header.fec_group = 1;
- ASSERT_TRUE(group.Update(ENCRYPTION_FORWARD_SECURE, header,
- kData[packet]));
+ ASSERT_TRUE(
+ group.Update(ENCRYPTION_FORWARD_SECURE, header, kData[packet]));
}
ASSERT_TRUE(group.CanRevive() == (packet == num_packets));
}
@@ -103,8 +94,8 @@ class QuicFecGroupTest : public ::testing::Test {
header.packet_number = packet;
header.fec_group = 1;
header.entropy_flag = kEntropyFlag[packet];
- ASSERT_TRUE(group.Update(ENCRYPTION_FORWARD_SECURE, header,
- kData[packet]));
+ ASSERT_TRUE(
+ group.Update(ENCRYPTION_FORWARD_SECURE, header, kData[packet]));
ASSERT_FALSE(group.CanRevive());
}
@@ -120,9 +111,8 @@ class QuicFecGroupTest : public ::testing::Test {
char recovered[kMaxPacketSize];
ASSERT_TRUE(group.CanRevive());
size_t len = group.Revive(&header, recovered, arraysize(recovered));
- ASSERT_NE(0u, len)
- << "Failed to revive packet " << lost_packet << " out of "
- << num_packets;
+ ASSERT_NE(0u, len) << "Failed to revive packet " << lost_packet
+ << " out of " << num_packets;
EXPECT_EQ(lost_packet, header.packet_number) << "Failed to revive packet "
<< lost_packet << " out of "
<< num_packets;
diff --git a/net/quic/quic_flow_controller.cc b/net/quic/quic_flow_controller.cc
index 177f0a4..795f2ce 100644
--- a/net/quic/quic_flow_controller.cc
+++ b/net/quic/quic_flow_controller.cc
@@ -83,9 +83,8 @@ void QuicFlowController::AddBytesSent(QuicByteCount bytes_sent) {
bool QuicFlowController::FlowControlViolation() {
if (highest_received_byte_offset_ > receive_window_offset_) {
- LOG(ERROR) << ENDPOINT << "Flow control violation on stream "
- << id_ << ", receive window offset: "
- << receive_window_offset_
+ LOG(ERROR) << ENDPOINT << "Flow control violation on stream " << id_
+ << ", receive window offset: " << receive_window_offset_
<< ", highest received byte offset: "
<< highest_received_byte_offset_;
return true;
diff --git a/net/quic/quic_flow_controller.h b/net/quic/quic_flow_controller.h
index dad5b66..6a640df 100644
--- a/net/quic/quic_flow_controller.h
+++ b/net/quic/quic_flow_controller.h
@@ -139,7 +139,6 @@ class NET_EXPORT_PRIVATE QuicFlowController {
// highest offset in a data frame, or a final value in a RST.
QuicStreamOffset highest_received_byte_offset_;
-
// The absolute offset in the incoming byte stream. The peer should never send
// us bytes which are beyond this offset.
QuicStreamOffset receive_window_offset_;
diff --git a/net/quic/quic_flow_controller_test.cc b/net/quic/quic_flow_controller_test.cc
index 64705765..71bfa1b 100644
--- a/net/quic/quic_flow_controller_test.cc
+++ b/net/quic/quic_flow_controller_test.cc
@@ -77,10 +77,9 @@ TEST_F(QuicFlowControllerTest, SendingBytes) {
// Try to send more bytes, violating flow control.
EXPECT_CALL(connection_,
SendConnectionClose(QUIC_FLOW_CONTROL_SENT_TOO_MUCH_DATA));
- EXPECT_DFATAL(
- flow_controller_->AddBytesSent(send_window_ * 10),
- base::StringPrintf("Trying to send an extra %" PRIu64 " bytes",
- send_window_ * 10));
+ EXPECT_DFATAL(flow_controller_->AddBytesSent(send_window_ * 10),
+ base::StringPrintf("Trying to send an extra %" PRIu64 " bytes",
+ send_window_ * 10));
EXPECT_TRUE(flow_controller_->IsBlocked());
EXPECT_EQ(0u, flow_controller_->SendWindowSize());
}
diff --git a/net/quic/quic_framer_test.cc b/net/quic/quic_framer_test.cc
index 7fcef7a..219554d 100644
--- a/net/quic/quic_framer_test.cc
+++ b/net/quic/quic_framer_test.cc
@@ -2868,8 +2868,8 @@ TEST_P(QuicFramerTest, PublicResetPacketWithClientAddress) {
EXPECT_EQ(kPacketNumber,
visitor_.public_reset_packet_->rejected_packet_number);
EXPECT_EQ("4.31.198.44",
- IPAddressToString(visitor_.public_reset_packet_->
- client_address.address()));
+ IPAddressToString(
+ visitor_.public_reset_packet_->client_address.address()));
EXPECT_EQ(443, visitor_.public_reset_packet_->client_address.port());
// Now test framing boundaries.
diff --git a/net/quic/quic_headers_stream.cc b/net/quic/quic_headers_stream.cc
index 7d27580..e678a13 100644
--- a/net/quic/quic_headers_stream.cc
+++ b/net/quic/quic_headers_stream.cc
@@ -145,8 +145,7 @@ class QuicHeadersStream::SpdyFramerVisitor
CloseConnection("SPDY PUSH_PROMISE frame received.");
}
- void OnContinuation(SpdyStreamId stream_id, bool end) override {
- }
+ void OnContinuation(SpdyStreamId stream_id, bool end) override {}
bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override {
CloseConnection("Unknown frame type received.");
@@ -170,8 +169,8 @@ class QuicHeadersStream::SpdyFramerVisitor
private:
void CloseConnection(const string& details) {
if (stream_->IsConnected()) {
- stream_->CloseConnectionWithDetails(
- QUIC_INVALID_HEADERS_STREAM_DATA, details);
+ stream_->CloseConnectionWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA,
+ details);
}
}
diff --git a/net/quic/quic_headers_stream_test.cc b/net/quic/quic_headers_stream_test.cc
index 680bdf2..7e8e118 100644
--- a/net/quic/quic_headers_stream_test.cc
+++ b/net/quic/quic_headers_stream_test.cc
@@ -37,35 +37,36 @@ const bool kFins[] = {false, true};
class MockVisitor : public SpdyFramerVisitorInterface {
public:
MOCK_METHOD1(OnError, void(SpdyFramer* framer));
- MOCK_METHOD3(OnDataFrameHeader, void(SpdyStreamId stream_id,
- size_t length,
- bool fin));
- MOCK_METHOD4(OnStreamFrameData, void(SpdyStreamId stream_id,
- const char* data,
- size_t len,
- bool fin));
+ MOCK_METHOD3(OnDataFrameHeader,
+ void(SpdyStreamId stream_id, size_t length, bool fin));
+ MOCK_METHOD4(
+ OnStreamFrameData,
+ void(SpdyStreamId stream_id, const char* data, size_t len, bool fin));
MOCK_METHOD2(OnStreamPadding, void(SpdyStreamId stream_id, size_t len));
MOCK_METHOD1(OnHeaderFrameStart,
SpdyHeadersHandlerInterface*(SpdyStreamId stream_id));
MOCK_METHOD2(OnHeaderFrameEnd, void(SpdyStreamId stream_id, bool end));
- MOCK_METHOD3(OnControlFrameHeaderData, bool(SpdyStreamId stream_id,
- const char* header_data,
- size_t len));
- MOCK_METHOD5(OnSynStream, void(SpdyStreamId stream_id,
- SpdyStreamId associated_stream_id,
- SpdyPriority priority,
- bool fin,
- bool unidirectional));
+ MOCK_METHOD3(OnControlFrameHeaderData,
+ bool(SpdyStreamId stream_id,
+ const char* header_data,
+ size_t len));
+ MOCK_METHOD5(OnSynStream,
+ void(SpdyStreamId stream_id,
+ SpdyStreamId associated_stream_id,
+ SpdyPriority priority,
+ bool fin,
+ bool unidirectional));
MOCK_METHOD2(OnSynReply, void(SpdyStreamId stream_id, bool fin));
- MOCK_METHOD2(OnRstStream, void(SpdyStreamId stream_id,
- SpdyRstStreamStatus status));
+ MOCK_METHOD2(OnRstStream,
+ void(SpdyStreamId stream_id, SpdyRstStreamStatus status));
MOCK_METHOD1(OnSettings, void(bool clear_persisted));
MOCK_METHOD3(OnSetting, void(SpdySettingsIds id, uint8 flags, uint32 value));
MOCK_METHOD0(OnSettingsAck, void());
MOCK_METHOD0(OnSettingsEnd, void());
MOCK_METHOD2(OnPing, void(SpdyPingId unique_id, bool is_ack));
- MOCK_METHOD2(OnGoAway, void(SpdyStreamId last_accepted_stream_id,
- SpdyGoAwayStatus status));
+ MOCK_METHOD2(OnGoAway,
+ void(SpdyStreamId last_accepted_stream_id,
+ SpdyGoAwayStatus status));
MOCK_METHOD7(OnHeaders,
void(SpdyStreamId stream_id,
bool has_priority,
@@ -77,9 +78,10 @@ class MockVisitor : public SpdyFramerVisitorInterface {
MOCK_METHOD2(OnWindowUpdate,
void(SpdyStreamId stream_id, int delta_window_size));
MOCK_METHOD1(OnBlocked, void(SpdyStreamId stream_id));
- MOCK_METHOD3(OnPushPromise, void(SpdyStreamId stream_id,
- SpdyStreamId promised_stream_id,
- bool end));
+ MOCK_METHOD3(OnPushPromise,
+ void(SpdyStreamId stream_id,
+ SpdyStreamId promised_stream_id,
+ bool end));
MOCK_METHOD2(OnContinuation, void(SpdyStreamId stream_id, bool end));
MOCK_METHOD3(OnAltSvc,
void(SpdyStreamId stream_id,
@@ -127,7 +129,7 @@ class QuicHeadersStreamTest : public ::testing::TestWithParam<TestParams> {
framer_(HTTP2),
stream_frame_(kHeadersStreamId, /*fin=*/false, /*offset=*/0, ""),
next_promised_stream_id_(2) {
- headers_[":version"] = "HTTP/1.1";
+ headers_[":version"] = "HTTP/1.1";
headers_[":status"] = "200 Ok";
headers_["content-length"] = "11";
framer_.set_visitor(&visitor_);
@@ -140,7 +142,7 @@ class QuicHeadersStreamTest : public ::testing::TestWithParam<TestParams> {
QuicConsumedData SaveIov(const QuicIOVector& data) {
const iovec* iov = data.iov;
int count = data.iov_count;
- for (int i = 0 ; i < count; ++i) {
+ for (int i = 0; i < count; ++i) {
saved_data_.append(static_cast<char*>(iov[i].iov_base), iov[i].iov_len);
}
return QuicConsumedData(saved_data_.length(), false);
@@ -161,8 +163,7 @@ class QuicHeadersStreamTest : public ::testing::TestWithParam<TestParams> {
WriteHeadersAndCheckData(stream_id, fin, priority, SYN_STREAM);
}
- void WriteHeadersAndExpectSynReply(QuicStreamId stream_id,
- bool fin) {
+ void WriteHeadersAndExpectSynReply(QuicStreamId stream_id, bool fin) {
WriteHeadersAndCheckData(stream_id, fin, 0, SYN_REPLY);
}
@@ -177,10 +178,10 @@ class QuicHeadersStreamTest : public ::testing::TestWithParam<TestParams> {
// Parse the outgoing data and check that it matches was was written.
if (type == SYN_STREAM) {
- EXPECT_CALL(visitor_, OnHeaders(stream_id, kHasPriority, priority,
- /*parent_stream_id=*/0,
- /*exclusive=*/false,
- fin, kFrameComplete));
+ EXPECT_CALL(visitor_,
+ OnHeaders(stream_id, kHasPriority, priority,
+ /*parent_stream_id=*/0,
+ /*exclusive=*/false, fin, kFrameComplete));
} else {
EXPECT_CALL(visitor_,
OnHeaders(stream_id, !kHasPriority,
@@ -220,9 +221,7 @@ class QuicHeadersStreamTest : public ::testing::TestWithParam<TestParams> {
return versions;
}
- void CloseConnection() {
- QuicConnectionPeer::CloseConnection(connection_);
- }
+ void CloseConnection() { QuicConnectionPeer::CloseConnection(connection_); }
QuicStreamId NextPromisedStreamId() { return next_promised_stream_id_++; }
@@ -323,9 +322,8 @@ TEST_P(QuicHeadersStreamTest, ProcessRawData) {
frame.reset(framer_.SerializeFrame(headers_frame));
}
EXPECT_CALL(session_, OnStreamHeaders(stream_id, _))
- .WillRepeatedly(WithArgs<1>(
- Invoke(this,
- &QuicHeadersStreamTest::SaveHeaderDataStringPiece)));
+ .WillRepeatedly(WithArgs<1>(Invoke(
+ this, &QuicHeadersStreamTest::SaveHeaderDataStringPiece)));
EXPECT_CALL(session_,
OnStreamHeadersComplete(stream_id, fin, frame->size()));
stream_frame_.frame_buffer = frame->data();
@@ -474,8 +472,8 @@ TEST_P(QuicHeadersStreamTest, ProcessSpdyDataFrame) {
EXPECT_CALL(*connection_,
SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA,
"SPDY DATA frame received."))
- .WillOnce(InvokeWithoutArgs(this,
- &QuicHeadersStreamTest::CloseConnection));
+ .WillOnce(
+ InvokeWithoutArgs(this, &QuicHeadersStreamTest::CloseConnection));
stream_frame_.frame_buffer = frame->data();
stream_frame_.frame_length = frame->size();
headers_stream_->OnStreamFrame(stream_frame_);
@@ -485,11 +483,10 @@ TEST_P(QuicHeadersStreamTest, ProcessSpdyRstStreamFrame) {
SpdyRstStreamIR data(2, RST_STREAM_PROTOCOL_ERROR);
scoped_ptr<SpdySerializedFrame> frame(framer_.SerializeFrame(data));
EXPECT_CALL(*connection_,
- SendConnectionCloseWithDetails(
- QUIC_INVALID_HEADERS_STREAM_DATA,
- "SPDY RST_STREAM frame received."))
- .WillOnce(InvokeWithoutArgs(this,
- &QuicHeadersStreamTest::CloseConnection));
+ SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA,
+ "SPDY RST_STREAM frame received."))
+ .WillOnce(
+ InvokeWithoutArgs(this, &QuicHeadersStreamTest::CloseConnection));
stream_frame_.frame_buffer = frame->data();
stream_frame_.frame_length = frame->size();
headers_stream_->OnStreamFrame(stream_frame_);
@@ -500,11 +497,10 @@ TEST_P(QuicHeadersStreamTest, ProcessSpdySettingsFrame) {
data.AddSetting(SETTINGS_HEADER_TABLE_SIZE, true, true, 0);
scoped_ptr<SpdySerializedFrame> frame(framer_.SerializeFrame(data));
EXPECT_CALL(*connection_,
- SendConnectionCloseWithDetails(
- QUIC_INVALID_HEADERS_STREAM_DATA,
- "SPDY SETTINGS frame received."))
- .WillOnce(InvokeWithoutArgs(this,
- &QuicHeadersStreamTest::CloseConnection));
+ SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA,
+ "SPDY SETTINGS frame received."))
+ .WillOnce(
+ InvokeWithoutArgs(this, &QuicHeadersStreamTest::CloseConnection));
stream_frame_.frame_buffer = frame->data();
stream_frame_.frame_length = frame->size();
headers_stream_->OnStreamFrame(stream_frame_);
@@ -516,8 +512,8 @@ TEST_P(QuicHeadersStreamTest, ProcessSpdyPingFrame) {
EXPECT_CALL(*connection_,
SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA,
"SPDY PING frame received."))
- .WillOnce(InvokeWithoutArgs(this,
- &QuicHeadersStreamTest::CloseConnection));
+ .WillOnce(
+ InvokeWithoutArgs(this, &QuicHeadersStreamTest::CloseConnection));
stream_frame_.frame_buffer = frame->data();
stream_frame_.frame_length = frame->size();
headers_stream_->OnStreamFrame(stream_frame_);
@@ -529,8 +525,8 @@ TEST_P(QuicHeadersStreamTest, ProcessSpdyGoAwayFrame) {
EXPECT_CALL(*connection_,
SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA,
"SPDY GOAWAY frame received."))
- .WillOnce(InvokeWithoutArgs(this,
- &QuicHeadersStreamTest::CloseConnection));
+ .WillOnce(
+ InvokeWithoutArgs(this, &QuicHeadersStreamTest::CloseConnection));
stream_frame_.frame_buffer = frame->data();
stream_frame_.frame_length = frame->size();
headers_stream_->OnStreamFrame(stream_frame_);
@@ -539,12 +535,11 @@ TEST_P(QuicHeadersStreamTest, ProcessSpdyGoAwayFrame) {
TEST_P(QuicHeadersStreamTest, ProcessSpdyWindowUpdateFrame) {
SpdyWindowUpdateIR data(1, 1);
scoped_ptr<SpdySerializedFrame> frame(framer_.SerializeFrame(data));
- EXPECT_CALL(*connection_,
- SendConnectionCloseWithDetails(
- QUIC_INVALID_HEADERS_STREAM_DATA,
- "SPDY WINDOW_UPDATE frame received."))
- .WillOnce(InvokeWithoutArgs(this,
- &QuicHeadersStreamTest::CloseConnection));
+ EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(
+ QUIC_INVALID_HEADERS_STREAM_DATA,
+ "SPDY WINDOW_UPDATE frame received."))
+ .WillOnce(
+ InvokeWithoutArgs(this, &QuicHeadersStreamTest::CloseConnection));
stream_frame_.frame_buffer = frame->data();
stream_frame_.frame_length = frame->size();
headers_stream_->OnStreamFrame(stream_frame_);
diff --git a/net/quic/quic_http_stream.cc b/net/quic/quic_http_stream.cc
index eff3a69..11dc26c 100644
--- a/net/quic/quic_http_stream.cc
+++ b/net/quic/quic_http_stream.cc
@@ -60,8 +60,8 @@ int QuicHttpStream::InitializeStream(const HttpRequestInfo* request_info,
const CompletionCallback& callback) {
DCHECK(!stream_);
if (!session_)
- return was_handshake_confirmed_ ? ERR_CONNECTION_CLOSED :
- ERR_QUIC_HANDSHAKE_FAILED;
+ return was_handshake_confirmed_ ? ERR_CONNECTION_CLOSED
+ : ERR_QUIC_HANDSHAKE_FAILED;
stream_net_log.AddEvent(
NetLog::TYPE_HTTP_STREAM_REQUEST_BOUND_TO_QUIC_SESSION,
@@ -73,8 +73,8 @@ int QuicHttpStream::InitializeStream(const HttpRequestInfo* request_info,
priority_ = priority;
int rv = stream_request_.StartRequest(
- session_, &stream_, base::Bind(&QuicHttpStream::OnStreamReady,
- weak_factory_.GetWeakPtr()));
+ session_, &stream_,
+ base::Bind(&QuicHttpStream::OnStreamReady, weak_factory_.GetWeakPtr()));
if (rv == ERR_IO_PENDING) {
callback_ = callback;
} else if (rv == OK) {
@@ -178,8 +178,9 @@ int QuicHttpStream::ReadResponseHeaders(const CompletionCallback& callback) {
return ERR_IO_PENDING;
}
-int QuicHttpStream::ReadResponseBody(
- IOBuffer* buf, int buf_len, const CompletionCallback& callback) {
+int QuicHttpStream::ReadResponseBody(IOBuffer* buf,
+ int buf_len,
+ const CompletionCallback& callback) {
if (!stream_) {
// If the stream is already closed, there is no body to read.
return response_status_;
@@ -205,8 +206,8 @@ void QuicHttpStream::Close(bool not_reusable) {
stream_->SetDelegate(nullptr);
stream_->Reset(QUIC_STREAM_CANCELLED);
ResetStream();
- response_status_ = was_handshake_confirmed_ ?
- ERR_CONNECTION_CLOSED : ERR_QUIC_HANDSHAKE_FAILED;
+ response_status_ = was_handshake_confirmed_ ? ERR_CONNECTION_CLOSED
+ : ERR_QUIC_HANDSHAKE_FAILED;
}
}
@@ -327,8 +328,8 @@ void QuicHttpStream::OnDataAvailable() {
void QuicHttpStream::OnClose(QuicErrorCode error) {
if (error != QUIC_NO_ERROR) {
- response_status_ = was_handshake_confirmed_ ?
- ERR_QUIC_PROTOCOL_ERROR : ERR_QUIC_HANDSHAKE_FAILED;
+ response_status_ = was_handshake_confirmed_ ? ERR_QUIC_PROTOCOL_ERROR
+ : ERR_QUIC_HANDSHAKE_FAILED;
} else if (!response_headers_received_) {
response_status_ = ERR_ABORTED;
}
@@ -342,8 +343,8 @@ void QuicHttpStream::OnClose(QuicErrorCode error) {
void QuicHttpStream::OnError(int error) {
ResetStream();
- response_status_ = was_handshake_confirmed_ ?
- error : ERR_QUIC_HANDSHAKE_FAILED;
+ response_status_ =
+ was_handshake_confirmed_ ? error : ERR_QUIC_HANDSHAKE_FAILED;
if (!callback_.is_null())
DoCallback(response_status_);
}
@@ -448,8 +449,7 @@ int QuicHttpStream::DoSendHeadersComplete(int rv) {
if (rv < 0)
return rv;
- next_state_ = request_body_stream_ ?
- STATE_READ_REQUEST_BODY : STATE_OPEN;
+ next_state_ = request_body_stream_ ? STATE_READ_REQUEST_BODY : STATE_OPEN;
return OK;
}
@@ -457,8 +457,7 @@ int QuicHttpStream::DoSendHeadersComplete(int rv) {
int QuicHttpStream::DoReadRequestBody() {
next_state_ = STATE_READ_REQUEST_BODY_COMPLETE;
return request_body_stream_->Read(
- raw_request_body_buf_.get(),
- raw_request_body_buf_->size(),
+ raw_request_body_buf_.get(), raw_request_body_buf_->size(),
base::Bind(&QuicHttpStream::OnIOComplete, weak_factory_.GetWeakPtr()));
}
@@ -528,8 +527,8 @@ int QuicHttpStream::ProcessResponseHeaders(const SpdyHeaderBlock& headers) {
response_info_->socket_address = HostPortPair::FromIPEndPoint(address);
response_info_->connection_info =
HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3;
- response_info_->vary_data
- .Init(*request_info_, *response_info_->headers.get());
+ response_info_->vary_data.Init(*request_info_,
+ *response_info_->headers.get());
response_info_->was_npn_negotiated = true;
response_info_->npn_negotiated_protocol = "quic/1+spdy/3";
response_info_->response_time = base::Time::Now();
diff --git a/net/quic/quic_http_stream.h b/net/quic/quic_http_stream.h
index e2bf08b..80f25d73 100644
--- a/net/quic/quic_http_stream.h
+++ b/net/quic/quic_http_stream.h
@@ -112,7 +112,7 @@ class NET_EXPORT_PRIVATE QuicHttpStream
State next_state_;
base::WeakPtr<QuicChromiumClientSession> session_;
- int session_error_; // Error code from the connection shutdown.
+ int session_error_; // Error code from the connection shutdown.
bool was_handshake_confirmed_; // True if the crypto handshake succeeded.
QuicChromiumClientSession::StreamRequest stream_request_;
QuicReliableClientStream* stream_; // Non-owning.
diff --git a/net/quic/quic_http_stream_test.cc b/net/quic/quic_http_stream_test.cc
index 547c5f4..ab5063c 100644
--- a/net/quic/quic_http_stream_test.cc
+++ b/net/quic/quic_http_stream_test.cc
@@ -138,9 +138,7 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
// be used by the mock socket when performing the write.
struct PacketToWrite {
PacketToWrite(IoMode mode, QuicEncryptedPacket* packet)
- : mode(mode),
- packet(packet) {
- }
+ : mode(mode), packet(packet) {}
IoMode mode;
QuicEncryptedPacket* packet;
};
@@ -174,9 +172,7 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
}
// Returns the packet to be written at position |pos|.
- QuicEncryptedPacket* GetWrite(size_t pos) {
- return writes_[pos].packet;
- }
+ QuicEncryptedPacket* GetWrite(size_t pos) { return writes_[pos].packet; }
bool AtEof() {
return socket_data_->AllReadDataConsumed() &&
@@ -191,23 +187,22 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
void Initialize() {
mock_writes_.reset(new MockWrite[writes_.size()]);
for (size_t i = 0; i < writes_.size(); i++) {
- mock_writes_[i] = MockWrite(writes_[i].mode,
- writes_[i].packet->data(),
+ mock_writes_[i] = MockWrite(writes_[i].mode, writes_[i].packet->data(),
writes_[i].packet->length());
};
socket_data_.reset(new StaticSocketDataProvider(
nullptr, 0, mock_writes_.get(), writes_.size()));
- MockUDPClientSocket* socket = new MockUDPClientSocket(socket_data_.get(),
- net_log_.net_log());
+ MockUDPClientSocket* socket =
+ new MockUDPClientSocket(socket_data_.get(), net_log_.net_log());
socket->Connect(peer_addr_);
runner_ = new TestTaskRunner(&clock_);
send_algorithm_ = new MockSendAlgorithm();
EXPECT_CALL(*send_algorithm_, InRecovery()).WillRepeatedly(Return(false));
EXPECT_CALL(*send_algorithm_, InSlowStart()).WillRepeatedly(Return(false));
- EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, _, _)).WillRepeatedly(Return(true));
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
+ .WillRepeatedly(Return(true));
EXPECT_CALL(*send_algorithm_, RetransmissionDelay())
.WillRepeatedly(Return(QuicTime::Delta::Zero()));
EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
@@ -219,12 +214,12 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
EXPECT_CALL(*send_algorithm_, BandwidthEstimate())
.WillRepeatedly(Return(QuicBandwidth::Zero()));
EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)).Times(AnyNumber());
- helper_.reset(new QuicConnectionHelper(runner_.get(), &clock_,
- &random_generator_));
+ helper_.reset(
+ new QuicConnectionHelper(runner_.get(), &clock_, &random_generator_));
TestPacketWriterFactory writer_factory(socket);
- connection_ = new TestQuicConnection(SupportedVersions(GetParam()),
- connection_id_, peer_addr_,
- helper_.get(), writer_factory);
+ connection_ =
+ new TestQuicConnection(SupportedVersions(GetParam()), connection_id_,
+ peer_addr_, helper_.get(), writer_factory);
connection_->set_visitor(&visitor_);
connection_->SetSendAlgorithm(send_algorithm_);
session_.reset(new QuicChromiumClientSession(
@@ -242,9 +237,9 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
session_->Initialize();
session_->GetCryptoStream()->CryptoConnect();
EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed());
- stream_.reset(use_closing_stream_ ?
- new AutoClosingStream(session_->GetWeakPtr()) :
- new QuicHttpStream(session_->GetWeakPtr()));
+ stream_.reset(use_closing_stream_
+ ? new AutoClosingStream(session_->GetWeakPtr())
+ : new QuicHttpStream(session_->GetWeakPtr()));
}
void SetRequest(const std::string& method,
@@ -352,7 +347,8 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> {
std::vector<PacketToWrite> writes_;
};
-INSTANTIATE_TEST_CASE_P(Version, QuicHttpStreamTest,
+INSTANTIATE_TEST_CASE_P(Version,
+ QuicHttpStreamTest,
::testing::ValuesIn(QuicSupportedVersions()));
TEST_P(QuicHttpStreamTest, RenewStreamForAuth) {
@@ -375,16 +371,15 @@ TEST_P(QuicHttpStreamTest, GetRequest) {
request_.method = "GET";
request_.url = GURL("http://www.google.com/");
- EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
- net_log_, callback_.callback()));
- EXPECT_EQ(OK, stream_->SendRequest(headers_, &response_,
- callback_.callback()));
+ EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
+ callback_.callback()));
+ EXPECT_EQ(OK,
+ stream_->SendRequest(headers_, &response_, callback_.callback()));
// Ack the request.
ProcessPacket(ConstructAckPacket(1, 0, 0));
- EXPECT_EQ(ERR_IO_PENDING,
- stream_->ReadResponseHeaders(callback_.callback()));
+ EXPECT_EQ(ERR_IO_PENDING, stream_->ReadResponseHeaders(callback_.callback()));
SetResponse("404 Not Found", std::string());
size_t spdy_response_header_frame_length;
@@ -400,9 +395,9 @@ TEST_P(QuicHttpStreamTest, GetRequest) {
EXPECT_FALSE(response_.request_time.is_null());
// There is no body, so this should return immediately.
- EXPECT_EQ(0, stream_->ReadResponseBody(read_buffer_.get(),
- read_buffer_->size(),
- callback_.callback()));
+ EXPECT_EQ(0,
+ stream_->ReadResponseBody(read_buffer_.get(), read_buffer_->size(),
+ callback_.callback()));
EXPECT_TRUE(stream_->IsResponseBodyComplete());
EXPECT_TRUE(AtEof());
@@ -425,16 +420,15 @@ TEST_P(QuicHttpStreamTest, GetRequestLargeResponse) {
request_.method = "GET";
request_.url = GURL("http://www.google.com/");
- EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
- net_log_, callback_.callback()));
- EXPECT_EQ(OK, stream_->SendRequest(headers_, &response_,
- callback_.callback()));
+ EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
+ callback_.callback()));
+ EXPECT_EQ(OK,
+ stream_->SendRequest(headers_, &response_, callback_.callback()));
// Ack the request.
ProcessPacket(ConstructAckPacket(1, 0, 0));
- EXPECT_EQ(ERR_IO_PENDING,
- stream_->ReadResponseHeaders(callback_.callback()));
+ EXPECT_EQ(ERR_IO_PENDING, stream_->ReadResponseHeaders(callback_.callback()));
SpdyHeaderBlock headers;
headers[":status"] = "200 OK";
@@ -454,9 +448,9 @@ TEST_P(QuicHttpStreamTest, GetRequestLargeResponse) {
EXPECT_TRUE(response_.headers->HasHeaderValue("Content-Type", "text/plain"));
// There is no body, so this should return immediately.
- EXPECT_EQ(0, stream_->ReadResponseBody(read_buffer_.get(),
- read_buffer_->size(),
- callback_.callback()));
+ EXPECT_EQ(0,
+ stream_->ReadResponseBody(read_buffer_.get(), read_buffer_->size(),
+ callback_.callback()));
EXPECT_TRUE(stream_->IsResponseBodyComplete());
EXPECT_TRUE(AtEof());
@@ -476,14 +470,13 @@ TEST_P(QuicHttpStreamTest, SessionClosedBeforeSendRequest) {
request_.method = "GET";
request_.url = GURL("http://www.google.com/");
- EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
- net_log_, callback_.callback()));
+ EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
+ callback_.callback()));
session_->connection()->CloseConnection(QUIC_NO_ERROR, true);
EXPECT_EQ(ERR_CONNECTION_CLOSED,
- stream_->SendRequest(headers_, &response_,
- callback_.callback()));
+ stream_->SendRequest(headers_, &response_, callback_.callback()));
EXPECT_EQ(0, stream_->GetTotalSentBytes());
EXPECT_EQ(0, stream_->GetTotalReceivedBytes());
@@ -565,11 +558,11 @@ TEST_P(QuicHttpStreamTest, SessionClosedBeforeReadResponseHeaders) {
request_.method = "GET";
request_.url = GURL("http://www.google.com/");
- EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
- net_log_, callback_.callback()));
+ EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
+ callback_.callback()));
- EXPECT_EQ(OK, stream_->SendRequest(headers_, &response_,
- callback_.callback()));
+ EXPECT_EQ(OK,
+ stream_->SendRequest(headers_, &response_, callback_.callback()));
session_->connection()->CloseConnection(QUIC_NO_ERROR, true);
@@ -601,10 +594,10 @@ TEST_P(QuicHttpStreamTest, SendPostRequest) {
request_.upload_data_stream = &upload_data_stream;
ASSERT_EQ(OK, request_.upload_data_stream->Init(CompletionCallback()));
- EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
- net_log_, callback_.callback()));
- EXPECT_EQ(OK, stream_->SendRequest(headers_, &response_,
- callback_.callback()));
+ EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
+ callback_.callback()));
+ EXPECT_EQ(OK,
+ stream_->SendRequest(headers_, &response_, callback_.callback()));
// Ack both packets in the request.
ProcessPacket(ConstructAckPacket(1, 0, 0));
@@ -650,8 +643,8 @@ TEST_P(QuicHttpStreamTest, SendChunkedPostRequest) {
AddWrite(ConstructRequestHeadersPacket(1, !kFin, DEFAULT_PRIORITY,
&spdy_request_headers_frame_length));
AddWrite(ConstructDataPacket(2, kIncludeVersion, !kFin, 0, kUploadData));
- AddWrite(ConstructDataPacket(3, kIncludeVersion, kFin, chunk_size,
- kUploadData));
+ AddWrite(
+ ConstructDataPacket(3, kIncludeVersion, kFin, chunk_size, kUploadData));
AddWrite(ConstructAckPacket(4, 3, 1));
Initialize();
@@ -662,12 +655,12 @@ TEST_P(QuicHttpStreamTest, SendChunkedPostRequest) {
request_.url = GURL("http://www.google.com/");
request_.upload_data_stream = &upload_data_stream;
ASSERT_EQ(OK, request_.upload_data_stream->Init(
- TestCompletionCallback().callback()));
+ TestCompletionCallback().callback()));
- ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
- net_log_, callback_.callback()));
- ASSERT_EQ(ERR_IO_PENDING, stream_->SendRequest(headers_, &response_,
- callback_.callback()));
+ ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
+ callback_.callback()));
+ ASSERT_EQ(ERR_IO_PENDING,
+ stream_->SendRequest(headers_, &response_, callback_.callback()));
upload_data_stream.AppendData(kUploadData, chunk_size, true);
EXPECT_EQ(OK, callback_.WaitForResult());
@@ -729,12 +722,12 @@ TEST_P(QuicHttpStreamTest, SendChunkedPostRequestWithFinalEmptyDataPacket) {
request_.url = GURL("http://www.google.com/");
request_.upload_data_stream = &upload_data_stream;
ASSERT_EQ(OK, request_.upload_data_stream->Init(
- TestCompletionCallback().callback()));
+ TestCompletionCallback().callback()));
- ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
- net_log_, callback_.callback()));
- ASSERT_EQ(ERR_IO_PENDING, stream_->SendRequest(headers_, &response_,
- callback_.callback()));
+ ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
+ callback_.callback()));
+ ASSERT_EQ(ERR_IO_PENDING,
+ stream_->SendRequest(headers_, &response_, callback_.callback()));
upload_data_stream.AppendData(nullptr, 0, true);
EXPECT_EQ(OK, callback_.WaitForResult());
@@ -791,12 +784,12 @@ TEST_P(QuicHttpStreamTest, SendChunkedPostRequestWithOneEmptyDataPacket) {
request_.url = GURL("http://www.google.com/");
request_.upload_data_stream = &upload_data_stream;
ASSERT_EQ(OK, request_.upload_data_stream->Init(
- TestCompletionCallback().callback()));
+ TestCompletionCallback().callback()));
- ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
- net_log_, callback_.callback()));
- ASSERT_EQ(ERR_IO_PENDING, stream_->SendRequest(headers_, &response_,
- callback_.callback()));
+ ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
+ callback_.callback()));
+ ASSERT_EQ(ERR_IO_PENDING,
+ stream_->SendRequest(headers_, &response_, callback_.callback()));
upload_data_stream.AppendData(nullptr, 0, true);
EXPECT_EQ(OK, callback_.WaitForResult());
@@ -850,15 +843,14 @@ TEST_P(QuicHttpStreamTest, DestroyedEarly) {
request_.method = "GET";
request_.url = GURL("http://www.google.com/");
- EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
- net_log_, callback_.callback()));
- EXPECT_EQ(OK, stream_->SendRequest(headers_, &response_,
- callback_.callback()));
+ EXPECT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, net_log_,
+ callback_.callback()));
+ EXPECT_EQ(OK,
+ stream_->SendRequest(headers_, &response_, callback_.callback()));
// Ack the request.
ProcessPacket(ConstructAckPacket(1, 0, 0));
- EXPECT_EQ(ERR_IO_PENDING,
- stream_->ReadResponseHeaders(callback_.callback()));
+ EXPECT_EQ(ERR_IO_PENDING, stream_->ReadResponseHeaders(callback_.callback()));
// Send the response with a body.
SetResponse("404 OK", "hello world!");
@@ -889,8 +881,8 @@ TEST_P(QuicHttpStreamTest, Priority) {
request_.method = "GET";
request_.url = GURL("http://www.google.com/");
- EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM,
- net_log_, callback_.callback()));
+ EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM, net_log_,
+ callback_.callback()));
// Check that priority is highest.
QuicReliableClientStream* reliable_stream =
@@ -898,8 +890,8 @@ TEST_P(QuicHttpStreamTest, Priority) {
DCHECK(reliable_stream);
DCHECK_EQ(kV3HighestPriority, reliable_stream->Priority());
- EXPECT_EQ(OK, stream_->SendRequest(headers_, &response_,
- callback_.callback()));
+ EXPECT_EQ(OK,
+ stream_->SendRequest(headers_, &response_, callback_.callback()));
// Check that priority has now dropped back to MEDIUM.
DCHECK_EQ(MEDIUM,
@@ -907,8 +899,7 @@ TEST_P(QuicHttpStreamTest, Priority) {
// Ack the request.
ProcessPacket(ConstructAckPacket(1, 0, 0));
- EXPECT_EQ(ERR_IO_PENDING,
- stream_->ReadResponseHeaders(callback_.callback()));
+ EXPECT_EQ(ERR_IO_PENDING, stream_->ReadResponseHeaders(callback_.callback()));
// Send the response with a body.
SetResponse("404 OK", "hello world!");
@@ -939,8 +930,8 @@ TEST_P(QuicHttpStreamTest, CheckPriorityWithNoDelegate) {
request_.method = "GET";
request_.url = GURL("http://www.google.com/");
- EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM,
- net_log_, callback_.callback()));
+ EXPECT_EQ(OK, stream_->InitializeStream(&request_, MEDIUM, net_log_,
+ callback_.callback()));
// Check that priority is highest.
QuicReliableClientStream* reliable_stream =
diff --git a/net/quic/quic_http_utils.cc b/net/quic/quic_http_utils.cc
index 856427b..f9524f5 100644
--- a/net/quic/quic_http_utils.cc
+++ b/net/quic/quic_http_utils.cc
@@ -16,8 +16,8 @@ SpdyPriority ConvertRequestPriorityToQuicPriority(
NET_EXPORT_PRIVATE RequestPriority
ConvertQuicPriorityToRequestPriority(SpdyPriority priority) {
// Handle invalid values gracefully.
- return (priority >= 5) ?
- IDLE : static_cast<RequestPriority>(HIGHEST - priority);
+ return (priority >= 5) ? IDLE
+ : static_cast<RequestPriority>(HIGHEST - priority);
}
scoped_ptr<base::Value> QuicRequestNetLogCallback(
diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc
index fa5503a..fb5d3b7 100644
--- a/net/quic/quic_network_transaction_unittest.cc
+++ b/net/quic/quic_network_transaction_unittest.cc
@@ -80,9 +80,7 @@ class MockQuicData {
public:
MockQuicData() : packet_number_(0) {}
- ~MockQuicData() {
- STLDeleteElements(&packets_);
- }
+ ~MockQuicData() { STLDeleteElements(&packets_); }
void AddSynchronousRead(scoped_ptr<QuicEncryptedPacket> packet) {
reads_.push_back(MockRead(SYNCHRONOUS, packet->data(), packet->length(),
@@ -107,8 +105,8 @@ class MockQuicData {
}
void AddSocketDataToFactory(MockClientSocketFactory* factory) {
- MockRead* reads = reads_.empty() ? nullptr : &reads_[0];
- MockWrite* writes = writes_.empty() ? nullptr : &writes_[0];
+ MockRead* reads = reads_.empty() ? nullptr : &reads_[0];
+ MockWrite* writes = writes_.empty() ? nullptr : &writes_[0];
socket_data_.reset(
new SequencedSocketData(reads, reads_.size(), writes, writes_.size()));
factory->AddSocketDataProvider(socket_data_.get());
@@ -301,9 +299,7 @@ class QuicNetworkTransactionTest
packet_number, stream_id, should_include_version, fin, headers);
}
- void CreateSession() {
- CreateSessionWithFactory(&socket_factory_, false);
- }
+ void CreateSession() { CreateSessionWithFactory(&socket_factory_, false); }
void CreateSessionWithNextProtos() {
CreateSessionWithFactory(&socket_factory_, true);
@@ -484,7 +480,8 @@ class QuicNetworkTransactionTest
}
};
-INSTANTIATE_TEST_CASE_P(Version, QuicNetworkTransactionTest,
+INSTANTIATE_TEST_CASE_P(Version,
+ QuicNetworkTransactionTest,
::testing::ValuesIn(QuicSupportedVersions()));
TEST_P(QuicNetworkTransactionTest, ForceQuic) {
@@ -495,9 +492,8 @@ TEST_P(QuicNetworkTransactionTest, ForceQuic) {
mock_quic_data.AddWrite(
ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true,
GetRequestHeaders("GET", "https", "/")));
- mock_quic_data.AddRead(
- ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false,
- GetResponseHeaders("200 OK")));
+ mock_quic_data.AddRead(ConstructResponseHeadersPacket(
+ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK")));
mock_quic_data.AddRead(
ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!"));
mock_quic_data.AddWrite(ConstructAckPacket(2, 1));
@@ -563,9 +559,8 @@ TEST_P(QuicNetworkTransactionTest, QuicProxy) {
mock_quic_data.AddWrite(
ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true,
GetRequestHeaders("GET", "http", "/")));
- mock_quic_data.AddRead(
- ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false,
- GetResponseHeaders("200 OK")));
+ mock_quic_data.AddRead(ConstructResponseHeadersPacket(
+ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK")));
mock_quic_data.AddRead(
ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!"));
mock_quic_data.AddWrite(ConstructAckPacket(2, 1));
@@ -1005,8 +1000,8 @@ TEST_P(QuicNetworkTransactionTest, UseAlternateProtocolForQuic) {
MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
MockRead(ASYNC, OK)};
- StaticSocketDataProvider http_data(http_reads, arraysize(http_reads),
- nullptr, 0);
+ StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&http_data);
socket_factory_.AddSSLSocketDataProvider(&ssl_data_);
@@ -1014,9 +1009,8 @@ TEST_P(QuicNetworkTransactionTest, UseAlternateProtocolForQuic) {
mock_quic_data.AddWrite(
ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true,
GetRequestHeaders("GET", "https", "/")));
- mock_quic_data.AddRead(
- ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false,
- GetResponseHeaders("200 OK")));
+ mock_quic_data.AddRead(ConstructResponseHeadersPacket(
+ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK")));
mock_quic_data.AddRead(
ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!"));
mock_quic_data.AddWrite(ConstructAckPacket(2, 1));
@@ -1127,17 +1121,16 @@ TEST_P(QuicNetworkTransactionTest, UseAlternateProtocolProbabilityForQuic) {
MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
MockRead(ASYNC, OK)};
- StaticSocketDataProvider http_data(http_reads, arraysize(http_reads),
- nullptr, 0);
+ StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&http_data);
MockQuicData mock_quic_data;
mock_quic_data.AddWrite(
ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true,
GetRequestHeaders("GET", "https", "/")));
- mock_quic_data.AddRead(
- ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false,
- GetResponseHeaders("200 OK")));
+ mock_quic_data.AddRead(ConstructResponseHeadersPacket(
+ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK")));
mock_quic_data.AddRead(
ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!"));
mock_quic_data.AddWrite(ConstructAckPacket(2, 1));
@@ -1164,8 +1157,8 @@ TEST_P(QuicNetworkTransactionTest, DontUseAlternateProtocolProbabilityForQuic) {
MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
MockRead(ASYNC, OK)};
- StaticSocketDataProvider http_data(http_reads, arraysize(http_reads),
- nullptr, 0);
+ StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&http_data);
socket_factory_.AddSSLSocketDataProvider(&ssl_data_);
socket_factory_.AddSocketDataProvider(&http_data);
@@ -1181,15 +1174,14 @@ TEST_P(QuicNetworkTransactionTest, DontUseAlternateProtocolProbabilityForQuic) {
TEST_P(QuicNetworkTransactionTest,
DontUseAlternateProtocolWithBadProbabilityForQuic) {
MockRead http_reads[] = {
- MockRead("HTTP/1.1 200 OK\r\n"),
- MockRead("Alternate-Protocol: 443:quic,p=2\r\n\r\n"),
- MockRead("hello world"),
- MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
- MockRead(ASYNC, OK)
- };
+ MockRead("HTTP/1.1 200 OK\r\n"),
+ MockRead("Alternate-Protocol: 443:quic,p=2\r\n\r\n"),
+ MockRead("hello world"),
+ MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
+ MockRead(ASYNC, OK)};
- StaticSocketDataProvider http_data(http_reads, arraysize(http_reads),
- nullptr, 0);
+ StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&http_data);
socket_factory_.AddSSLSocketDataProvider(&ssl_data_);
socket_factory_.AddSocketDataProvider(&http_data);
@@ -1209,17 +1201,16 @@ TEST_P(QuicNetworkTransactionTest, UseAlternateProtocolForQuicForHttps) {
MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
MockRead(ASYNC, OK)};
- StaticSocketDataProvider http_data(http_reads, arraysize(http_reads),
- nullptr, 0);
+ StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&http_data);
MockQuicData mock_quic_data;
mock_quic_data.AddWrite(
ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true,
GetRequestHeaders("GET", "https", "/")));
- mock_quic_data.AddRead(
- ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false,
- GetResponseHeaders("200 OK")));
+ mock_quic_data.AddRead(ConstructResponseHeadersPacket(
+ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK")));
mock_quic_data.AddRead(
ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!"));
mock_quic_data.AddWrite(ConstructAckPacket(2, 1));
@@ -1381,9 +1372,8 @@ TEST_P(QuicNetworkTransactionTest, ZeroRTTWithHttpRace) {
mock_quic_data.AddWrite(
ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true,
GetRequestHeaders("GET", "https", "/")));
- mock_quic_data.AddRead(
- ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false,
- GetResponseHeaders("200 OK")));
+ mock_quic_data.AddRead(ConstructResponseHeadersPacket(
+ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK")));
mock_quic_data.AddRead(
ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!"));
mock_quic_data.AddWrite(ConstructAckPacket(2, 1));
@@ -1406,9 +1396,8 @@ TEST_P(QuicNetworkTransactionTest, ZeroRTTWithNoHttpRace) {
mock_quic_data.AddWrite(
ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true,
GetRequestHeaders("GET", "https", "/")));
- mock_quic_data.AddRead(
- ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false,
- GetResponseHeaders("200 OK")));
+ mock_quic_data.AddRead(ConstructResponseHeadersPacket(
+ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK")));
mock_quic_data.AddRead(
ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!"));
mock_quic_data.AddWrite(ConstructAckPacket(2, 1));
@@ -1424,12 +1413,8 @@ TEST_P(QuicNetworkTransactionTest, ZeroRTTWithNoHttpRace) {
"");
HostResolver::RequestInfo info(HostPortPair("mail.example.com", 443));
AddressList address;
- host_resolver_.Resolve(info,
- DEFAULT_PRIORITY,
- &address,
- CompletionCallback(),
- nullptr,
- net_log_.bound());
+ host_resolver_.Resolve(info, DEFAULT_PRIORITY, &address, CompletionCallback(),
+ nullptr, net_log_.bound());
CreateSessionWithNextProtos();
AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT);
@@ -1462,12 +1447,8 @@ TEST_P(QuicNetworkTransactionTest, ZeroRTTWithProxy) {
"");
HostResolver::RequestInfo info(HostPortPair("mail.example.com", 443));
AddressList address;
- host_resolver_.Resolve(info,
- DEFAULT_PRIORITY,
- &address,
- CompletionCallback(),
- nullptr,
- net_log_.bound());
+ host_resolver_.Resolve(info, DEFAULT_PRIORITY, &address, CompletionCallback(),
+ nullptr, net_log_.bound());
request_.url = GURL("http://mail.example.com/");
CreateSessionWithNextProtos();
@@ -1480,9 +1461,8 @@ TEST_P(QuicNetworkTransactionTest, ZeroRTTWithConfirmationRequired) {
mock_quic_data.AddWrite(
ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true,
GetRequestHeaders("GET", "https", "/")));
- mock_quic_data.AddRead(
- ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false,
- GetResponseHeaders("200 OK")));
+ mock_quic_data.AddRead(ConstructResponseHeadersPacket(
+ 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK")));
mock_quic_data.AddRead(
ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!"));
mock_quic_data.AddWrite(ConstructAckPacket(2, 1));
@@ -1503,8 +1483,8 @@ TEST_P(QuicNetworkTransactionTest, ZeroRTTWithConfirmationRequired) {
"");
HostResolver::RequestInfo info(HostPortPair("mail.example.com", 443));
AddressList address;
- host_resolver_.Resolve(info, DEFAULT_PRIORITY, &address,
- CompletionCallback(), nullptr, net_log_.bound());
+ host_resolver_.Resolve(info, DEFAULT_PRIORITY, &address, CompletionCallback(),
+ nullptr, net_log_.bound());
CreateSessionWithNextProtos();
session_->quic_stream_factory()->set_require_confirmation(true);
@@ -1635,20 +1615,18 @@ TEST_P(QuicNetworkTransactionTest, BrokenAlternateProtocol) {
MockRead(ASYNC, ERR_IO_PENDING), // No more data to read
MockRead(ASYNC, OK), // EOF
};
- StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads),
- nullptr, 0);
+ StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&quic_data);
// Main job which will succeed even though the alternate job fails.
MockRead http_reads[] = {
- MockRead("HTTP/1.1 200 OK\r\n\r\n"),
- MockRead("hello from http"),
- MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
- MockRead(ASYNC, OK)
- };
+ MockRead("HTTP/1.1 200 OK\r\n\r\n"), MockRead("hello from http"),
+ MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
+ MockRead(ASYNC, OK)};
- StaticSocketDataProvider http_data(http_reads, arraysize(http_reads),
- nullptr, 0);
+ StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&http_data);
socket_factory_.AddSSLSocketDataProvider(&ssl_data_);
@@ -1661,22 +1639,20 @@ TEST_P(QuicNetworkTransactionTest, BrokenAlternateProtocol) {
TEST_P(QuicNetworkTransactionTest, BrokenAlternateProtocolReadError) {
// Alternate-protocol job
MockRead quic_reads[] = {
- MockRead(ASYNC, ERR_SOCKET_NOT_CONNECTED),
+ MockRead(ASYNC, ERR_SOCKET_NOT_CONNECTED),
};
- StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads),
- nullptr, 0);
+ StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&quic_data);
// Main job which will succeed even though the alternate job fails.
MockRead http_reads[] = {
- MockRead("HTTP/1.1 200 OK\r\n\r\n"),
- MockRead("hello from http"),
- MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
- MockRead(ASYNC, OK)
- };
+ MockRead("HTTP/1.1 200 OK\r\n\r\n"), MockRead("hello from http"),
+ MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
+ MockRead(ASYNC, OK)};
- StaticSocketDataProvider http_data(http_reads, arraysize(http_reads),
- nullptr, 0);
+ StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&http_data);
socket_factory_.AddSSLSocketDataProvider(&ssl_data_);
@@ -1690,19 +1666,19 @@ TEST_P(QuicNetworkTransactionTest, BrokenAlternateProtocolReadError) {
TEST_P(QuicNetworkTransactionTest, NoBrokenAlternateProtocolIfTcpFails) {
// Alternate-protocol job will fail when the session attempts to read.
MockRead quic_reads[] = {
- MockRead(ASYNC, ERR_SOCKET_NOT_CONNECTED),
+ MockRead(ASYNC, ERR_SOCKET_NOT_CONNECTED),
};
- StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads),
- nullptr, 0);
+ StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&quic_data);
// Main job will also fail.
MockRead http_reads[] = {
- MockRead(ASYNC, ERR_SOCKET_NOT_CONNECTED),
+ MockRead(ASYNC, ERR_SOCKET_NOT_CONNECTED),
};
- StaticSocketDataProvider http_data(http_reads, arraysize(http_reads),
- nullptr, 0);
+ StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr,
+ 0);
http_data.set_connect_data(MockConnect(ASYNC, ERR_SOCKET_NOT_CONNECTED));
socket_factory_.AddSocketDataProvider(&http_data);
socket_factory_.AddSSLSocketDataProvider(&ssl_data_);
@@ -1722,10 +1698,10 @@ TEST_P(QuicNetworkTransactionTest, NoBrokenAlternateProtocolIfTcpFails) {
TEST_P(QuicNetworkTransactionTest, FailedZeroRttBrokenAlternateProtocol) {
// Alternate-protocol job
MockRead quic_reads[] = {
- MockRead(ASYNC, ERR_SOCKET_NOT_CONNECTED),
+ MockRead(ASYNC, ERR_SOCKET_NOT_CONNECTED),
};
- StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads),
- nullptr, 0);
+ StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&quic_data);
AddHangingNonAlternateProtocolSocketData();
@@ -1737,14 +1713,12 @@ TEST_P(QuicNetworkTransactionTest, FailedZeroRttBrokenAlternateProtocol) {
// Final job that will proceed when the QUIC job fails.
MockRead http_reads[] = {
- MockRead("HTTP/1.1 200 OK\r\n\r\n"),
- MockRead("hello from http"),
- MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
- MockRead(ASYNC, OK)
- };
+ MockRead("HTTP/1.1 200 OK\r\n\r\n"), MockRead("hello from http"),
+ MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
+ MockRead(ASYNC, OK)};
- StaticSocketDataProvider http_data(http_reads, arraysize(http_reads),
- nullptr, 0);
+ StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&http_data);
socket_factory_.AddSSLSocketDataProvider(&ssl_data_);
@@ -1765,20 +1739,18 @@ TEST_P(QuicNetworkTransactionTest, DISABLED_HangingZeroRttFallback) {
MockRead quic_reads[] = {
MockRead(SYNCHRONOUS, ERR_IO_PENDING),
};
- StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads),
- nullptr, 0);
+ StaticSocketDataProvider quic_data(quic_reads, arraysize(quic_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&quic_data);
// Main job that will proceed when the QUIC job fails.
MockRead http_reads[] = {
- MockRead("HTTP/1.1 200 OK\r\n\r\n"),
- MockRead("hello from http"),
- MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
- MockRead(ASYNC, OK)
- };
+ MockRead("HTTP/1.1 200 OK\r\n\r\n"), MockRead("hello from http"),
+ MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
+ MockRead(ASYNC, OK)};
- StaticSocketDataProvider http_data(http_reads, arraysize(http_reads),
- nullptr, 0);
+ StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&http_data);
CreateSessionWithNextProtos();
@@ -1791,20 +1763,18 @@ TEST_P(QuicNetworkTransactionTest, DISABLED_HangingZeroRttFallback) {
TEST_P(QuicNetworkTransactionTest, BrokenAlternateProtocolOnConnectFailure) {
// Alternate-protocol job will fail before creating a QUIC session.
StaticSocketDataProvider quic_data(nullptr, 0, nullptr, 0);
- quic_data.set_connect_data(MockConnect(SYNCHRONOUS,
- ERR_INTERNET_DISCONNECTED));
+ quic_data.set_connect_data(
+ MockConnect(SYNCHRONOUS, ERR_INTERNET_DISCONNECTED));
socket_factory_.AddSocketDataProvider(&quic_data);
// Main job which will succeed even though the alternate job fails.
MockRead http_reads[] = {
- MockRead("HTTP/1.1 200 OK\r\n\r\n"),
- MockRead("hello from http"),
- MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
- MockRead(ASYNC, OK)
- };
+ MockRead("HTTP/1.1 200 OK\r\n\r\n"), MockRead("hello from http"),
+ MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
+ MockRead(ASYNC, OK)};
- StaticSocketDataProvider http_data(http_reads, arraysize(http_reads),
- nullptr, 0);
+ StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&http_data);
socket_factory_.AddSSLSocketDataProvider(&ssl_data_);
@@ -1831,8 +1801,8 @@ TEST_P(QuicNetworkTransactionTest, ConnectionCloseDuringConnect) {
MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
MockRead(ASYNC, OK)};
- StaticSocketDataProvider http_data(http_reads, arraysize(http_reads),
- nullptr, 0);
+ StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr,
+ 0);
socket_factory_.AddSocketDataProvider(&http_data);
socket_factory_.AddSSLSocketDataProvider(&ssl_data_);
@@ -1844,12 +1814,8 @@ TEST_P(QuicNetworkTransactionTest, ConnectionCloseDuringConnect) {
"");
HostResolver::RequestInfo info(HostPortPair("mail.example.com", 443));
AddressList address;
- host_resolver_.Resolve(info,
- DEFAULT_PRIORITY,
- &address,
- CompletionCallback(),
- nullptr,
- net_log_.bound());
+ host_resolver_.Resolve(info, DEFAULT_PRIORITY, &address, CompletionCallback(),
+ nullptr, net_log_.bound());
CreateSessionWithNextProtos();
AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT);
diff --git a/net/quic/quic_packet_creator.cc b/net/quic/quic_packet_creator.cc
index 6c2dd3e..c47dcc6 100644
--- a/net/quic/quic_packet_creator.cc
+++ b/net/quic/quic_packet_creator.cc
@@ -53,9 +53,7 @@ class QuicRandomBoolSource {
public:
// random: Source of entropy. Not owned.
explicit QuicRandomBoolSource(QuicRandom* random)
- : random_(random),
- bit_bucket_(0),
- bit_mask_(0) {}
+ : random_(random), bit_bucket_(0), bit_mask_(0) {}
~QuicRandomBoolSource() {}
@@ -111,11 +109,11 @@ QuicPacketCreator::QuicPacketCreator(QuicConnectionId connection_id,
SetMaxPacketLength(kDefaultMaxPacketSize);
}
-QuicPacketCreator::~QuicPacketCreator() {
-}
+QuicPacketCreator::~QuicPacketCreator() {}
void QuicPacketCreator::OnBuiltFecProtectedPayload(
- const QuicPacketHeader& header, StringPiece payload) {
+ const QuicPacketHeader& header,
+ StringPiece payload) {
if (fec_group_.get() != nullptr) {
DCHECK_NE(0u, header.fec_group);
fec_group_->Update(encryption_level_, header, payload);
@@ -148,8 +146,8 @@ void QuicPacketCreator::SetMaxPacketLength(QuicByteCount length) {
void QuicPacketCreator::set_max_packets_per_fec_group(
size_t max_packets_per_fec_group) {
- max_packets_per_fec_group_ = max(kLowestMaxPacketsPerFecGroup,
- max_packets_per_fec_group);
+ max_packets_per_fec_group_ =
+ max(kLowestMaxPacketsPerFecGroup, max_packets_per_fec_group);
DCHECK_LT(0u, max_packets_per_fec_group_);
}
@@ -323,8 +321,7 @@ size_t QuicPacketCreator::CreateStreamFrame(QuicStreamId id,
<< QuicFramer::GetMinStreamFrameSize(id, offset, true, is_in_fec_group);
if (iov_offset == iov.total_length) {
- LOG_IF(DFATAL, !fin)
- << "Creating a stream frame with no data or fin.";
+ LOG_IF(DFATAL, !fin) << "Creating a stream frame with no data or fin.";
// Create a new packet for the fin, if necessary.
*frame = QuicFrame(new QuicStreamFrame(id, true, offset, StringPiece()));
return 0;
@@ -438,8 +435,7 @@ SerializedPacket QuicPacketCreator::SerializeAllFrames(const QuicFrames& frames,
char* buffer,
size_t buffer_len) {
LOG_IF(DFATAL, !queued_frames_.empty()) << "Frames already queued.";
- LOG_IF(DFATAL, frames.empty())
- << "Attempt to serialize empty packet";
+ LOG_IF(DFATAL, frames.empty()) << "Attempt to serialize empty packet";
for (const QuicFrame& frame : frames) {
bool success = AddFrame(frame, false);
DCHECK(success);
@@ -496,7 +492,7 @@ bool QuicPacketCreator::HasPendingRetransmittableFrames() const {
size_t QuicPacketCreator::ExpansionOnNewFrame() const {
// If packet is FEC protected, there's no expansion.
if (fec_protect_) {
- return 0;
+ return 0;
}
// If the last frame in the packet is a stream frame, then it will expand to
// include the stream_length field when a new frame is added.
@@ -507,8 +503,8 @@ size_t QuicPacketCreator::ExpansionOnNewFrame() const {
size_t QuicPacketCreator::BytesFree() const {
DCHECK_GE(max_plaintext_size_, PacketSize());
- return max_plaintext_size_ - min(max_plaintext_size_, PacketSize()
- + ExpansionOnNewFrame());
+ return max_plaintext_size_ -
+ min(max_plaintext_size_, PacketSize() + ExpansionOnNewFrame());
}
size_t QuicPacketCreator::PacketSize() const {
@@ -547,8 +543,7 @@ SerializedPacket QuicPacketCreator::SerializePacket(
char* encrypted_buffer,
size_t encrypted_buffer_len) {
DCHECK_LT(0u, encrypted_buffer_len);
- LOG_IF(DFATAL, queued_frames_.empty())
- << "Attempt to serialize empty packet";
+ LOG_IF(DFATAL, queued_frames_.empty()) << "Attempt to serialize empty packet";
if (fec_group_.get() != nullptr) {
DCHECK_GE(packet_number_ + 1, fec_group_->FecGroupNumber());
}
diff --git a/net/quic/quic_packet_creator.h b/net/quic/quic_packet_creator.h
index 9d23338..0350cec 100644
--- a/net/quic/quic_packet_creator.h
+++ b/net/quic/quic_packet_creator.h
@@ -219,9 +219,7 @@ class NET_EXPORT_PRIVATE QuicPacketCreator {
connection_id_length_ = length;
}
- QuicByteCount max_packet_length() const {
- return max_packet_length_;
- }
+ QuicByteCount max_packet_length() const { return max_packet_length_; }
bool has_ack() const { return has_ack_; }
@@ -249,7 +247,7 @@ class NET_EXPORT_PRIVATE QuicPacketCreator {
// Returns current max number of packets covered by an FEC group.
size_t max_packets_per_fec_group() const {
- return max_packets_per_fec_group_;
+ return max_packets_per_fec_group_;
}
// Sets creator's max number of packets covered by an FEC group.
diff --git a/net/quic/quic_packet_creator_test.cc b/net/quic/quic_packet_creator_test.cc
index fa4117f..4a85376 100644
--- a/net/quic/quic_packet_creator_test.cc
+++ b/net/quic/quic_packet_creator_test.cc
@@ -169,8 +169,8 @@ class QuicPacketCreatorTest : public ::testing::TestWithParam<TestParams> {
// Returns the number of bytes of overhead that will be added to a packet
// of maximum length.
size_t GetEncryptionOverhead() {
- return creator_.max_packet_length() - client_framer_.GetMaxPlaintextSize(
- creator_.max_packet_length());
+ return creator_.max_packet_length() -
+ client_framer_.GetMaxPlaintextSize(creator_.max_packet_length());
}
// Returns the number of bytes consumed by the non-data fields of a stream
@@ -383,8 +383,8 @@ TEST_P(QuicPacketCreatorTest, ChangeSequenceNumberLengthMidPacket) {
EXPECT_CALL(framer_visitor_, OnUnauthenticatedPublicHeader(_));
EXPECT_CALL(framer_visitor_, OnUnauthenticatedHeader(_));
EXPECT_CALL(framer_visitor_, OnDecryptedPacket(_));
- EXPECT_CALL(framer_visitor_, OnPacketHeader(_)).WillOnce(
- DoAll(SaveArg<0>(&header), Return(true)));
+ EXPECT_CALL(framer_visitor_, OnPacketHeader(_))
+ .WillOnce(DoAll(SaveArg<0>(&header), Return(true)));
EXPECT_CALL(framer_visitor_, OnAckFrame(_));
EXPECT_CALL(framer_visitor_, OnStopWaitingFrame(_));
EXPECT_CALL(framer_visitor_, OnPacketComplete());
@@ -414,8 +414,8 @@ TEST_P(QuicPacketCreatorTest, ChangeSequenceNumberLengthMidPacket) {
EXPECT_CALL(framer_visitor_, OnUnauthenticatedPublicHeader(_));
EXPECT_CALL(framer_visitor_, OnUnauthenticatedHeader(_));
EXPECT_CALL(framer_visitor_, OnDecryptedPacket(_));
- EXPECT_CALL(framer_visitor_, OnPacketHeader(_)).WillOnce(
- DoAll(SaveArg<0>(&header), Return(true)));
+ EXPECT_CALL(framer_visitor_, OnPacketHeader(_))
+ .WillOnce(DoAll(SaveArg<0>(&header), Return(true)));
EXPECT_CALL(framer_visitor_, OnStopWaitingFrame(_));
EXPECT_CALL(framer_visitor_, OnPacketComplete());
}
@@ -614,8 +614,9 @@ TEST_P(QuicPacketCreatorTest, ReserializeFramesWithPadding) {
}
TEST_P(QuicPacketCreatorTest, ReserializeFramesWithFullPacketAndPadding) {
- const size_t overhead = GetPacketHeaderOverhead(NOT_IN_FEC_GROUP)
- + GetEncryptionOverhead() + GetStreamFrameOverhead(NOT_IN_FEC_GROUP);
+ const size_t overhead = GetPacketHeaderOverhead(NOT_IN_FEC_GROUP) +
+ GetEncryptionOverhead() +
+ GetStreamFrameOverhead(NOT_IN_FEC_GROUP);
size_t capacity = kDefaultMaxPacketSize - overhead;
for (int delta = -5; delta <= 0; ++delta) {
string data(capacity + delta, 'A');
@@ -791,14 +792,14 @@ TEST_P(QuicPacketCreatorTest, ConsumeDataWithFecProtect) {
}
TEST_P(QuicPacketCreatorTest, CreateAllFreeBytesForStreamFrames) {
- const size_t overhead = GetPacketHeaderOverhead(NOT_IN_FEC_GROUP)
- + GetEncryptionOverhead();
+ const size_t overhead =
+ GetPacketHeaderOverhead(NOT_IN_FEC_GROUP) + GetEncryptionOverhead();
for (size_t i = overhead; i < overhead + 100; ++i) {
creator_.SetMaxPacketLength(i);
- const bool should_have_room = i > overhead + GetStreamFrameOverhead(
- NOT_IN_FEC_GROUP);
- ASSERT_EQ(should_have_room, creator_.HasRoomForStreamFrame(
- kClientDataStreamId1, kOffset));
+ const bool should_have_room =
+ i > overhead + GetStreamFrameOverhead(NOT_IN_FEC_GROUP);
+ ASSERT_EQ(should_have_room,
+ creator_.HasRoomForStreamFrame(kClientDataStreamId1, kOffset));
if (should_have_room) {
QuicFrame frame;
QuicIOVector io_vector(MakeIOVector("testdata"));
@@ -900,8 +901,9 @@ TEST_P(QuicPacketCreatorTest, StreamFrameConsumptionWithFec) {
TEST_P(QuicPacketCreatorTest, CryptoStreamFramePacketPadding) {
// Compute the total overhead for a single frame in packet.
- const size_t overhead = GetPacketHeaderOverhead(NOT_IN_FEC_GROUP)
- + GetEncryptionOverhead() + GetStreamFrameOverhead(NOT_IN_FEC_GROUP);
+ const size_t overhead = GetPacketHeaderOverhead(NOT_IN_FEC_GROUP) +
+ GetEncryptionOverhead() +
+ GetStreamFrameOverhead(NOT_IN_FEC_GROUP);
ASSERT_GT(kMaxPacketSize, overhead);
size_t capacity = kDefaultMaxPacketSize - overhead;
// Now, test various sizes around this size.
@@ -936,8 +938,9 @@ TEST_P(QuicPacketCreatorTest, CryptoStreamFramePacketPadding) {
TEST_P(QuicPacketCreatorTest, NonCryptoStreamFramePacketNonPadding) {
// Compute the total overhead for a single frame in packet.
- const size_t overhead = GetPacketHeaderOverhead(NOT_IN_FEC_GROUP)
- + GetEncryptionOverhead() + GetStreamFrameOverhead(NOT_IN_FEC_GROUP);
+ const size_t overhead = GetPacketHeaderOverhead(NOT_IN_FEC_GROUP) +
+ GetEncryptionOverhead() +
+ GetStreamFrameOverhead(NOT_IN_FEC_GROUP);
ASSERT_GT(kDefaultMaxPacketSize, overhead);
size_t capacity = kDefaultMaxPacketSize - overhead;
// Now, test various sizes around this size.
@@ -1055,8 +1058,8 @@ TEST_P(QuicPacketCreatorTest, SerializeFrame) {
EXPECT_CALL(framer_visitor_, OnUnauthenticatedPublicHeader(_));
EXPECT_CALL(framer_visitor_, OnUnauthenticatedHeader(_));
EXPECT_CALL(framer_visitor_, OnDecryptedPacket(_));
- EXPECT_CALL(framer_visitor_, OnPacketHeader(_)).WillOnce(
- DoAll(SaveArg<0>(&header), Return(true)));
+ EXPECT_CALL(framer_visitor_, OnPacketHeader(_))
+ .WillOnce(DoAll(SaveArg<0>(&header), Return(true)));
EXPECT_CALL(framer_visitor_, OnStreamFrame(_));
EXPECT_CALL(framer_visitor_, OnPacketComplete());
}
@@ -1234,7 +1237,6 @@ TEST_P(QuicPacketCreatorTest, SerializeTruncatedAckFrameWithSmallPacketSize) {
ClearSerializedPacket(&serialized_packet_);
}
-
TEST_P(QuicPacketCreatorTest, EntropyFlag) {
frames_.push_back(
QuicFrame(new QuicStreamFrame(0u, false, 0u, StringPiece())));
@@ -1246,8 +1248,8 @@ TEST_P(QuicPacketCreatorTest, EntropyFlag) {
bool expected_rand_bool =
(mock_random_.RandUint64() & (UINT64_C(1) << j)) != 0;
bool observed_rand_bool =
- (serialized.entropy_hash & (1 << ((j+1) % 8))) != 0;
- uint8 rest_of_hash = serialized.entropy_hash & ~(1 << ((j+1) % 8));
+ (serialized.entropy_hash & (1 << ((j + 1) % 8))) != 0;
+ uint8 rest_of_hash = serialized.entropy_hash & ~(1 << ((j + 1) % 8));
EXPECT_EQ(expected_rand_bool, observed_rand_bool);
EXPECT_EQ(0, rest_of_hash);
delete serialized.packet;
diff --git a/net/quic/quic_packet_generator_test.cc b/net/quic/quic_packet_generator_test.cc
index f61cae80..bc5ca9b 100644
--- a/net/quic/quic_packet_generator_test.cc
+++ b/net/quic/quic_packet_generator_test.cc
@@ -35,8 +35,7 @@ namespace {
const int64 kMinFecTimeoutMs = 5u;
static const FecSendPolicy kFecSendPolicyList[] = {
- FEC_ANY_TRIGGER,
- FEC_ALARM_TRIGGER,
+ FEC_ANY_TRIGGER, FEC_ALARM_TRIGGER,
};
class MockDelegate : public QuicPacketGenerator::DelegateInterface {
@@ -235,8 +234,7 @@ class QuicPacketGeneratorTest : public ::testing::TestWithParam<FecSendPolicy> {
class MockDebugDelegate : public QuicPacketCreator::DebugDelegate {
public:
- MOCK_METHOD1(OnFrameAddedToPacket,
- void(const QuicFrame&));
+ MOCK_METHOD1(OnFrameAddedToPacket, void(const QuicFrame&));
};
// Run all end to end tests with all supported FEC send polocies.
@@ -699,11 +697,11 @@ TEST_P(QuicPacketGeneratorTest, ConsumeData_FramesPreviouslyQueued) {
generator_.SetMaxPacketLength(length, /*force=*/false);
delegate_.SetCanWriteAnything();
{
- InSequence dummy;
- EXPECT_CALL(delegate_, OnSerializedPacket(_))
- .WillOnce(Invoke(this, &QuicPacketGeneratorTest::SavePacket));
- EXPECT_CALL(delegate_, OnSerializedPacket(_))
- .WillOnce(Invoke(this, &QuicPacketGeneratorTest::SavePacket));
+ InSequence dummy;
+ EXPECT_CALL(delegate_, OnSerializedPacket(_))
+ .WillOnce(Invoke(this, &QuicPacketGeneratorTest::SavePacket));
+ EXPECT_CALL(delegate_, OnSerializedPacket(_))
+ .WillOnce(Invoke(this, &QuicPacketGeneratorTest::SavePacket));
}
generator_.StartBatchOperations();
// Queue enough data to prevent a stream frame with a non-zero offset from
diff --git a/net/quic/quic_packet_reader.cc b/net/quic/quic_packet_reader.cc
index 7b90dc9..7fc57b0 100644
--- a/net/quic/quic_packet_reader.cc
+++ b/net/quic/quic_packet_reader.cc
@@ -32,8 +32,7 @@ QuicPacketReader::QuicPacketReader(DatagramClientSocket* socket,
net_log_(net_log),
weak_factory_(this) {}
-QuicPacketReader::~QuicPacketReader() {
-}
+QuicPacketReader::~QuicPacketReader() {}
void QuicPacketReader::StartReading() {
if (read_pending_)
diff --git a/net/quic/quic_packet_reader.h b/net/quic/quic_packet_reader.h
index 02c3877..e6fde6f 100644
--- a/net/quic/quic_packet_reader.h
+++ b/net/quic/quic_packet_reader.h
@@ -28,7 +28,7 @@ class NET_EXPORT_PRIVATE QuicPacketReader {
public:
class NET_EXPORT_PRIVATE Visitor {
public:
- virtual ~Visitor() {};
+ virtual ~Visitor(){};
virtual void OnReadError(int result) = 0;
virtual bool OnPacket(const QuicEncryptedPacket& packet,
IPEndPoint local_address,
diff --git a/net/quic/quic_packet_writer.h b/net/quic/quic_packet_writer.h
index b1eb148..f26fee0 100644
--- a/net/quic/quic_packet_writer.h
+++ b/net/quic/quic_packet_writer.h
@@ -23,10 +23,10 @@ class NET_EXPORT_PRIVATE QuicPacketWriter {
// status is WRITE_STATUS_OK and bytes_written is populated. If the write
// failed, the result's status is WRITE_STATUS_BLOCKED or WRITE_STATUS_ERROR
// and error_code is populated.
- virtual WriteResult WritePacket(
- const char* buffer, size_t buf_len,
- const IPAddressNumber& self_address,
- const IPEndPoint& peer_address) = 0;
+ virtual WriteResult WritePacket(const char* buffer,
+ size_t buf_len,
+ const IPAddressNumber& self_address,
+ const IPEndPoint& peer_address) = 0;
// Returns true if the writer buffers and subsequently rewrites data
// when an attempt to write results in the underlying socket becoming
diff --git a/net/quic/quic_protocol.cc b/net/quic/quic_protocol.cc
index 7a029f7..df0b07b 100644
--- a/net/quic/quic_protocol.cc
+++ b/net/quic/quic_protocol.cc
@@ -159,15 +159,13 @@ QuicStreamFrame::QuicStreamFrame(QuicStreamId stream_id,
QuicStreamFrame::~QuicStreamFrame() {}
uint32 MakeQuicTag(char a, char b, char c, char d) {
- return static_cast<uint32>(a) |
- static_cast<uint32>(b) << 8 |
- static_cast<uint32>(c) << 16 |
- static_cast<uint32>(d) << 24;
+ return static_cast<uint32>(a) | static_cast<uint32>(b) << 8 |
+ static_cast<uint32>(c) << 16 | static_cast<uint32>(d) << 24;
}
bool ContainsQuicTag(const QuicTagVector& tag_vector, QuicTag tag) {
- return std::find(tag_vector.begin(), tag_vector.end(), tag)
- != tag_vector.end();
+ return std::find(tag_vector.begin(), tag_vector.end(), tag) !=
+ tag_vector.end();
}
QuicVersionVector QuicSupportedVersions() {
@@ -213,8 +211,8 @@ QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) {
}
#define RETURN_STRING_LITERAL(x) \
-case x: \
-return #x
+ case x: \
+ return #x
string QuicVersionToString(const QuicVersion version) {
switch (version) {
@@ -304,15 +302,12 @@ QuicRstStreamFrame::QuicRstStreamFrame()
QuicRstStreamFrame::QuicRstStreamFrame(QuicStreamId stream_id,
QuicRstStreamErrorCode error_code,
QuicStreamOffset bytes_written)
- : stream_id(stream_id),
- error_code(error_code),
- byte_offset(bytes_written) {
+ : stream_id(stream_id), error_code(error_code), byte_offset(bytes_written) {
DCHECK_LE(error_code, numeric_limits<uint8>::max());
}
QuicConnectionCloseFrame::QuicConnectionCloseFrame()
- : error_code(QUIC_NO_ERROR) {
-}
+ : error_code(QUIC_NO_ERROR) {}
QuicFrame::QuicFrame() {}
@@ -535,7 +530,7 @@ ostream& operator<<(ostream& os, const QuicAckFrame& ack_frame) {
ostream& operator<<(ostream& os, const QuicFrame& frame) {
switch (frame.type) {
- case PADDING_FRAME: {
+ case PADDING_FRAME: {
os << "type { PADDING_FRAME } ";
break;
}
@@ -629,9 +624,7 @@ ostream& operator<<(ostream& os, const QuicStreamFrame& stream_frame) {
}
QuicGoAwayFrame::QuicGoAwayFrame()
- : error_code(QUIC_NO_ERROR),
- last_good_stream_id(0) {
-}
+ : error_code(QUIC_NO_ERROR), last_good_stream_id(0) {}
QuicGoAwayFrame::QuicGoAwayFrame(QuicErrorCode error_code,
QuicStreamId last_good_stream_id,
@@ -642,31 +635,21 @@ QuicGoAwayFrame::QuicGoAwayFrame(QuicErrorCode error_code,
DCHECK_LE(error_code, numeric_limits<uint8>::max());
}
-QuicData::QuicData(const char* buffer,
- size_t length)
- : buffer_(buffer),
- length_(length),
- owns_buffer_(false) {
-}
+QuicData::QuicData(const char* buffer, size_t length)
+ : buffer_(buffer), length_(length), owns_buffer_(false) {}
-QuicData::QuicData(char* buffer,
- size_t length,
- bool owns_buffer)
- : buffer_(buffer),
- length_(length),
- owns_buffer_(owns_buffer) {
-}
+QuicData::QuicData(char* buffer, size_t length, bool owns_buffer)
+ : buffer_(buffer), length_(length), owns_buffer_(owns_buffer) {}
QuicData::~QuicData() {
if (owns_buffer_) {
- delete [] const_cast<char*>(buffer_);
+ delete[] const_cast<char*>(buffer_);
}
}
QuicWindowUpdateFrame::QuicWindowUpdateFrame(QuicStreamId stream_id,
QuicStreamOffset byte_offset)
- : stream_id(stream_id),
- byte_offset(byte_offset) {}
+ : stream_id(stream_id), byte_offset(byte_offset) {}
QuicBlockedFrame::QuicBlockedFrame(QuicStreamId stream_id)
: stream_id(stream_id) {}
@@ -683,16 +666,13 @@ QuicPacket::QuicPacket(char* buffer,
includes_version_(includes_version),
packet_number_length_(packet_number_length) {}
-QuicEncryptedPacket::QuicEncryptedPacket(const char* buffer,
- size_t length)
- : QuicData(buffer, length) {
-}
+QuicEncryptedPacket::QuicEncryptedPacket(const char* buffer, size_t length)
+ : QuicData(buffer, length) {}
QuicEncryptedPacket::QuicEncryptedPacket(char* buffer,
size_t length,
bool owns_buffer)
- : QuicData(buffer, length, owns_buffer) {
-}
+ : QuicData(buffer, length, owns_buffer) {}
StringPiece QuicPacket::FecProtectedData() const {
const size_t start_of_fec = GetStartOfFecProtectedData(
diff --git a/net/quic/quic_protocol.h b/net/quic/quic_protocol.h
index 7029687..b7c92c8 100644
--- a/net/quic/quic_protocol.h
+++ b/net/quic/quic_protocol.h
@@ -185,12 +185,12 @@ const int kMaxAvailableStreamsMultiplier = 10;
// if (exponent == 0) value = mantissa;
// else value = (mantissa | 1 << 11) << (exponent - 1)
const int kUFloat16ExponentBits = 5;
-const int kUFloat16MaxExponent = (1 << kUFloat16ExponentBits) - 2; // 30
-const int kUFloat16MantissaBits = 16 - kUFloat16ExponentBits; // 11
+const int kUFloat16MaxExponent = (1 << kUFloat16ExponentBits) - 2; // 30
+const int kUFloat16MantissaBits = 16 - kUFloat16ExponentBits; // 11
const int kUFloat16MantissaEffectiveBits = kUFloat16MantissaBits + 1; // 12
const uint64 kUFloat16MaxValue = // 0x3FFC0000000
- ((UINT64_C(1) << kUFloat16MantissaEffectiveBits) - 1) <<
- kUFloat16MaxExponent;
+ ((UINT64_C(1) << kUFloat16MantissaEffectiveBits) - 1)
+ << kUFloat16MaxExponent;
// Default path ID.
const QuicPathId kDefaultPathId = 0;
@@ -198,12 +198,12 @@ const QuicPathId kDefaultPathId = 0;
enum TransmissionType {
NOT_RETRANSMISSION,
FIRST_TRANSMISSION_TYPE = NOT_RETRANSMISSION,
- HANDSHAKE_RETRANSMISSION, // Retransmits due to handshake timeouts.
+ HANDSHAKE_RETRANSMISSION, // Retransmits due to handshake timeouts.
ALL_UNACKED_RETRANSMISSION, // Retransmits all unacked packets.
ALL_INITIAL_RETRANSMISSION, // Retransmits all initially encrypted packets.
- LOSS_RETRANSMISSION, // Retransmits due to loss detection.
- RTO_RETRANSMISSION, // Retransmits due to retransmit time out.
- TLP_RETRANSMISSION, // Tail loss probes.
+ LOSS_RETRANSMISSION, // Retransmits due to loss detection.
+ RTO_RETRANSMISSION, // Retransmits due to retransmit time out.
+ TLP_RETRANSMISSION, // Tail loss probes.
LAST_TRANSMISSION_TYPE = TLP_RETRANSMISSION,
};
@@ -212,10 +212,7 @@ enum HasRetransmittableData {
HAS_RETRANSMITTABLE_DATA,
};
-enum IsHandshake {
- NOT_HANDSHAKE,
- IS_HANDSHAKE
-};
+enum IsHandshake { NOT_HANDSHAKE, IS_HANDSHAKE };
enum class Perspective { IS_SERVER, IS_CLIENT };
@@ -467,9 +464,8 @@ enum QuicRstStreamErrorCode {
// Because receiving an unknown QuicRstStreamErrorCode results in connection
// teardown, we use this to make sure any errors predating a given version are
// downgraded to the most appropriate existing error.
-NET_EXPORT_PRIVATE QuicRstStreamErrorCode AdjustErrorForVersion(
- QuicRstStreamErrorCode error_code,
- QuicVersion version);
+NET_EXPORT_PRIVATE QuicRstStreamErrorCode
+AdjustErrorForVersion(QuicRstStreamErrorCode error_code, QuicVersion version);
// These values must remain stable as they are uploaded to UMA histograms.
// To add a new error code, use the current value of QUIC_LAST_ERROR and
@@ -666,8 +662,8 @@ struct NET_EXPORT_PRIVATE QuicPacketHeader {
QuicPacketHeader();
explicit QuicPacketHeader(const QuicPacketPublicHeader& header);
- NET_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os, const QuicPacketHeader& s);
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os,
+ const QuicPacketHeader& s);
QuicPacketPublicHeader public_header;
QuicPathId path_id;
@@ -740,8 +736,8 @@ struct NET_EXPORT_PRIVATE QuicStreamFrame {
UniqueStreamBuffer buffer);
~QuicStreamFrame();
- NET_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os, const QuicStreamFrame& s);
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os,
+ const QuicStreamFrame& s);
QuicStreamId stream_id;
bool fin;
@@ -775,7 +771,8 @@ struct NET_EXPORT_PRIVATE QuicStopWaitingFrame {
~QuicStopWaitingFrame();
NET_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os, const QuicStopWaitingFrame& s);
+ std::ostream& os,
+ const QuicStopWaitingFrame& s);
// Path which this stop waiting frame belongs to.
QuicPathId path_id;
// Entropy hash of all packets up to, but not including, the least unacked
@@ -882,8 +879,8 @@ struct NET_EXPORT_PRIVATE QuicAckFrame {
QuicAckFrame();
~QuicAckFrame();
- NET_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os, const QuicAckFrame& s);
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os,
+ const QuicAckFrame& s);
// Path which this ack belongs to.
QuicPathId path_id;
@@ -950,7 +947,8 @@ struct NET_EXPORT_PRIVATE QuicRstStreamFrame {
QuicStreamOffset bytes_written);
NET_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os, const QuicRstStreamFrame& r);
+ std::ostream& os,
+ const QuicRstStreamFrame& r);
QuicStreamId stream_id;
QuicRstStreamErrorCode error_code;
@@ -966,7 +964,8 @@ struct NET_EXPORT_PRIVATE QuicConnectionCloseFrame {
QuicConnectionCloseFrame();
NET_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os, const QuicConnectionCloseFrame& c);
+ std::ostream& os,
+ const QuicConnectionCloseFrame& c);
QuicErrorCode error_code;
std::string error_details;
@@ -978,8 +977,8 @@ struct NET_EXPORT_PRIVATE QuicGoAwayFrame {
QuicStreamId last_good_stream_id,
const std::string& reason);
- NET_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os, const QuicGoAwayFrame& g);
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os,
+ const QuicGoAwayFrame& g);
QuicErrorCode error_code;
QuicStreamId last_good_stream_id;
@@ -996,7 +995,8 @@ struct NET_EXPORT_PRIVATE QuicWindowUpdateFrame {
QuicWindowUpdateFrame(QuicStreamId stream_id, QuicStreamOffset byte_offset);
NET_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os, const QuicWindowUpdateFrame& w);
+ std::ostream& os,
+ const QuicWindowUpdateFrame& w);
// The stream this frame applies to. 0 is a special case meaning the overall
// connection rather than a specific stream.
@@ -1015,8 +1015,8 @@ struct NET_EXPORT_PRIVATE QuicBlockedFrame {
QuicBlockedFrame() {}
explicit QuicBlockedFrame(QuicStreamId stream_id);
- NET_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os, const QuicBlockedFrame& b);
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os,
+ const QuicBlockedFrame& b);
// The stream this frame applies to. 0 is a special case meaning the overall
// connection rather than a specific stream.
@@ -1067,8 +1067,8 @@ struct NET_EXPORT_PRIVATE QuicFrame {
explicit QuicFrame(QuicWindowUpdateFrame* frame);
explicit QuicFrame(QuicBlockedFrame* frame);
- NET_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os, const QuicFrame& frame);
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os,
+ const QuicFrame& frame);
QuicFrameType type;
union {
@@ -1153,7 +1153,8 @@ class NET_EXPORT_PRIVATE QuicEncryptedPacket : public QuicData {
// bytes, which causes the default gtest object printer to read
// uninitialize memory. So we need to teach gtest how to print this object.
NET_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os, const QuicEncryptedPacket& s);
+ std::ostream& os,
+ const QuicEncryptedPacket& s);
private:
DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket);
@@ -1171,9 +1172,7 @@ class NET_EXPORT_PRIVATE RetransmittableFrames {
const QuicFrames& frames() const { return frames_; }
- IsHandshake HasCryptoHandshake() const {
- return has_crypto_handshake_;
- }
+ IsHandshake HasCryptoHandshake() const { return has_crypto_handshake_; }
bool needs_padding() const { return needs_padding_; }
diff --git a/net/quic/quic_protocol_test.cc b/net/quic/quic_protocol_test.cc
index 2eed68c..7f9aaa6 100644
--- a/net/quic/quic_protocol_test.cc
+++ b/net/quic/quic_protocol_test.cc
@@ -61,10 +61,10 @@ TEST(QuicProtocolTest, QuicDeprecatedErrorCodeCount) {
}
TEST(QuicProtocolTest, QuicVersionToQuicTag) {
- // If you add a new version to the QuicVersion enum you will need to add a new
- // case to QuicVersionToQuicTag, otherwise this test will fail.
+// If you add a new version to the QuicVersion enum you will need to add a new
+// case to QuicVersionToQuicTag, otherwise this test will fail.
- // TODO(rtenneti): Enable checking of Log(ERROR) messages.
+// TODO(rtenneti): Enable checking of Log(ERROR) messages.
#if 0
// Any logs would indicate an unsupported version which we don't expect.
ScopedMockLog log(kDoNotCaptureLogsYet);
@@ -86,7 +86,7 @@ TEST(QuicProtocolTest, QuicVersionToQuicTag) {
}
TEST(QuicProtocolTest, QuicVersionToQuicTagUnsupported) {
- // TODO(rtenneti): Enable checking of Log(ERROR) messages.
+// TODO(rtenneti): Enable checking of Log(ERROR) messages.
#if 0
// TODO(rjshade): Change to DFATAL once we actually support multiple versions,
// and QuicConnectionTest::SendVersionNegotiationPacket can be changed to use
@@ -100,10 +100,10 @@ TEST(QuicProtocolTest, QuicVersionToQuicTagUnsupported) {
}
TEST(QuicProtocolTest, QuicTagToQuicVersion) {
- // If you add a new version to the QuicVersion enum you will need to add a new
- // case to QuicTagToQuicVersion, otherwise this test will fail.
+// If you add a new version to the QuicVersion enum you will need to add a new
+// case to QuicTagToQuicVersion, otherwise this test will fail.
- // TODO(rtenneti): Enable checking of Log(ERROR) messages.
+// TODO(rtenneti): Enable checking of Log(ERROR) messages.
#if 0
// Any logs would indicate an unsupported version which we don't expect.
ScopedMockLog log(kDoNotCaptureLogsYet);
@@ -130,7 +130,7 @@ TEST(QuicProtocolTest, QuicTagToQuicVersion) {
}
TEST(QuicProtocolTest, QuicTagToQuicVersionUnsupported) {
- // TODO(rtenneti): Enable checking of Log(ERROR) messages.
+// TODO(rtenneti): Enable checking of Log(ERROR) messages.
#if 0
ScopedMockLog log(kDoNotCaptureLogsYet);
#ifndef NDEBUG
diff --git a/net/quic/quic_received_packet_manager.cc b/net/quic/quic_received_packet_manager.cc
index 5600fd2..13e9a74 100644
--- a/net/quic/quic_received_packet_manager.cc
+++ b/net/quic/quic_received_packet_manager.cc
@@ -27,14 +27,10 @@ namespace {
// Set to the number of nacks needed for fast retransmit plus one for protection
// against an ack loss
const size_t kMaxPacketsAfterNewMissing = 4;
-
}
QuicReceivedPacketManager::EntropyTracker::EntropyTracker()
- : packets_entropy_hash_(0),
- first_gap_(1),
- largest_observed_(0) {
-}
+ : packets_entropy_hash_(0), first_gap_(1), largest_observed_(0) {}
QuicReceivedPacketManager::EntropyTracker::~EntropyTracker() {}
@@ -115,7 +111,7 @@ void QuicReceivedPacketManager::EntropyTracker::SetCumulativeEntropyUpTo(
// and since packet_number.
packets_entropy_hash_ = entropy_hash;
for (ReceivedEntropyHashes::const_iterator it = packets_entropy_.begin();
- it != packets_entropy_.end(); ++it) {
+ it != packets_entropy_.end(); ++it) {
packets_entropy_hash_ ^= it->first;
}
@@ -124,7 +120,7 @@ void QuicReceivedPacketManager::EntropyTracker::SetCumulativeEntropyUpTo(
}
void QuicReceivedPacketManager::EntropyTracker::
-AdvanceFirstGapAndGarbageCollectEntropyMap() {
+ AdvanceFirstGapAndGarbageCollectEntropyMap() {
while (!packets_entropy_.empty() && packets_entropy_.front().second) {
++first_gap_;
packets_entropy_.pop_front();
@@ -169,8 +165,8 @@ void QuicReceivedPacketManager::RecordPacketReceived(
ack_frame_.largest_observed - packet_number);
int64 reordering_time_us =
receipt_time.Subtract(time_largest_observed_).ToMicroseconds();
- stats_->max_time_reordering_us = max(stats_->max_time_reordering_us,
- reordering_time_us);
+ stats_->max_time_reordering_us =
+ max(stats_->max_time_reordering_us, reordering_time_us);
}
if (packet_number > ack_frame_.largest_observed) {
ack_frame_.largest_observed = packet_number;
@@ -216,7 +212,8 @@ struct isTooLarge {
} // namespace
void QuicReceivedPacketManager::UpdateReceivedPacketInfo(
- QuicAckFrame* ack_frame, QuicTime approximate_now) {
+ QuicAckFrame* ack_frame,
+ QuicTime approximate_now) {
ack_frame_updated_ = false;
*ack_frame = ack_frame_;
ack_frame->entropy_hash = EntropyHash(ack_frame_.largest_observed);
@@ -229,9 +226,9 @@ void QuicReceivedPacketManager::UpdateReceivedPacketInfo(
// Ensure the delta is zero if approximate now is "in the past".
ack_frame->delta_time_largest_observed =
- approximate_now < time_largest_observed_ ?
- QuicTime::Delta::Zero() :
- approximate_now.Subtract(time_largest_observed_);
+ approximate_now < time_largest_observed_
+ ? QuicTime::Delta::Zero()
+ : approximate_now.Subtract(time_largest_observed_);
// Clear all packet times if any are too far from largest observed.
// It's expected this is extremely rare.
diff --git a/net/quic/quic_received_packet_manager.h b/net/quic/quic_received_packet_manager.h
index fa48f50..e26dbbb 100644
--- a/net/quic/quic_received_packet_manager.h
+++ b/net/quic/quic_received_packet_manager.h
@@ -27,8 +27,8 @@ struct QuicConnectionStats;
// Records all received packets by a connection and tracks their entropy.
// Also calculates the correct entropy for the framer when it truncates an ack
// frame being serialized.
-class NET_EXPORT_PRIVATE QuicReceivedPacketManager :
- public QuicReceivedEntropyHashCalculatorInterface {
+class NET_EXPORT_PRIVATE QuicReceivedPacketManager
+ : public QuicReceivedEntropyHashCalculatorInterface {
public:
class NET_EXPORT_PRIVATE EntropyTracker {
public:
diff --git a/net/quic/quic_received_packet_manager_test.cc b/net/quic/quic_received_packet_manager_test.cc
index c015eb0..926fcfb 100644
--- a/net/quic/quic_received_packet_manager_test.cc
+++ b/net/quic/quic_received_packet_manager_test.cc
@@ -232,7 +232,8 @@ TEST_F(QuicReceivedPacketManagerTest, ReceivedPacketEntropyHash) {
hash ^= entropies[index].second;
++index;
}
- if (i < 3) continue;
+ if (i < 3)
+ continue;
EXPECT_EQ(hash, received_manager_.EntropyHash(i));
}
// Reorder by 5 when 2 is received after 7.
@@ -274,12 +275,12 @@ TEST_F(QuicReceivedPacketManagerTest, SetCumulativeEntropyUpTo) {
for (size_t i = 0; i < 4; ++i) {
entropy_hash ^= entropies[i].second;
}
- QuicReceivedPacketManagerPeer::SetCumulativeEntropyUpTo(
- &received_manager_, 5, 100);
+ QuicReceivedPacketManagerPeer::SetCumulativeEntropyUpTo(&received_manager_, 5,
+ 100);
EXPECT_EQ(entropy_hash, received_manager_.EntropyHash(7));
- QuicReceivedPacketManagerPeer::SetCumulativeEntropyUpTo(
- &received_manager_, 1, 50);
+ QuicReceivedPacketManagerPeer::SetCumulativeEntropyUpTo(&received_manager_, 1,
+ 50);
EXPECT_EQ(entropy_hash, received_manager_.EntropyHash(7));
// No reordering.
diff --git a/net/quic/quic_reliable_client_stream.cc b/net/quic/quic_reliable_client_stream.cc
index 93bcbb3..ada2869 100644
--- a/net/quic/quic_reliable_client_stream.cc
+++ b/net/quic/quic_reliable_client_stream.cc
@@ -124,7 +124,7 @@ int QuicReliableClientStream::Read(IOBuffer* buf, int buf_len) {
}
bool QuicReliableClientStream::CanWrite(const CompletionCallback& callback) {
- bool can_write = session()->connection()->CanWrite(HAS_RETRANSMITTABLE_DATA);
+ bool can_write = session()->connection()->CanWrite(HAS_RETRANSMITTABLE_DATA);
if (!can_write) {
session()->MarkConnectionLevelWriteBlocked(id(), Priority());
DCHECK(callback_.is_null());
diff --git a/net/quic/quic_reliable_client_stream_test.cc b/net/quic/quic_reliable_client_stream_test.cc
index 9162ba9..f09b34c 100644
--- a/net/quic/quic_reliable_client_stream_test.cc
+++ b/net/quic/quic_reliable_client_stream_test.cc
@@ -104,7 +104,8 @@ class QuicReliableClientStreamTest
SpdyHeaderBlock headers_;
};
-INSTANTIATE_TEST_CASE_P(Version, QuicReliableClientStreamTest,
+INSTANTIATE_TEST_CASE_P(Version,
+ QuicReliableClientStreamTest,
::testing::ValuesIn(QuicSupportedVersions()));
TEST_P(QuicReliableClientStreamTest, OnFinRead) {
@@ -206,8 +207,8 @@ TEST_P(QuicReliableClientStreamTest, WriteStreamData) {
const size_t kDataLen = arraysize(kData1);
// All data written.
- EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _)).WillOnce(
- Return(QuicConsumedData(kDataLen, true)));
+ EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _))
+ .WillOnce(Return(QuicConsumedData(kDataLen, true)));
TestCompletionCallback callback;
EXPECT_EQ(OK, stream_->WriteStreamData(base::StringPiece(kData1, kDataLen),
true, callback.callback()));
@@ -221,17 +222,17 @@ TEST_P(QuicReliableClientStreamTest, WriteStreamDataAsync) {
const size_t kDataLen = arraysize(kData1);
// No data written.
- EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _)).WillOnce(
- Return(QuicConsumedData(0, false)));
+ EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _))
+ .WillOnce(Return(QuicConsumedData(0, false)));
TestCompletionCallback callback;
EXPECT_EQ(ERR_IO_PENDING,
- stream_->WriteStreamData(base::StringPiece(kData1, kDataLen),
- true, callback.callback()));
+ stream_->WriteStreamData(base::StringPiece(kData1, kDataLen), true,
+ callback.callback()));
ASSERT_FALSE(callback.have_result());
// All data written.
- EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _)).WillOnce(
- Return(QuicConsumedData(kDataLen, true)));
+ EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _))
+ .WillOnce(Return(QuicConsumedData(kDataLen, true)));
stream_->OnCanWrite();
ASSERT_TRUE(callback.have_result());
EXPECT_EQ(OK, callback.WaitForResult());
diff --git a/net/quic/quic_sent_entropy_manager_test.cc b/net/quic/quic_sent_entropy_manager_test.cc
index 167e56b..a73185d 100644
--- a/net/quic/quic_sent_entropy_manager_test.cc
+++ b/net/quic/quic_sent_entropy_manager_test.cc
@@ -38,8 +38,8 @@ TEST_F(QuicSentEntropyManagerTest, SentEntropyHash) {
}
TEST_F(QuicSentEntropyManagerTest, IsValidEntropy) {
- QuicPacketEntropyHash entropies[10] =
- {12, 1, 33, 3, 32, 100, 28, 42, 22, 255};
+ QuicPacketEntropyHash entropies[10] = {12, 1, 33, 3, 32,
+ 100, 28, 42, 22, 255};
for (size_t i = 0; i < arraysize(entropies); ++i) {
entropy_manager_.RecordPacketEntropyHash(i + 1, entropies[i]);
}
@@ -56,13 +56,13 @@ TEST_F(QuicSentEntropyManagerTest, IsValidEntropy) {
}
}
- EXPECT_TRUE(entropy_manager_.IsValidEntropy(10, missing_packets,
- entropy_hash));
+ EXPECT_TRUE(
+ entropy_manager_.IsValidEntropy(10, missing_packets, entropy_hash));
}
TEST_F(QuicSentEntropyManagerTest, ClearEntropiesBefore) {
- QuicPacketEntropyHash entropies[10] =
- {12, 1, 33, 3, 32, 100, 28, 42, 22, 255};
+ QuicPacketEntropyHash entropies[10] = {12, 1, 33, 3, 32,
+ 100, 28, 42, 22, 255};
for (size_t i = 0; i < arraysize(entropies); ++i) {
entropy_manager_.RecordPacketEntropyHash(i + 1, entropies[i]);
@@ -81,8 +81,8 @@ TEST_F(QuicSentEntropyManagerTest, ClearEntropiesBefore) {
entropy_hash ^= entropies[i];
}
}
- EXPECT_TRUE(entropy_manager_.IsValidEntropy(10, missing_packets,
- entropy_hash));
+ EXPECT_TRUE(
+ entropy_manager_.IsValidEntropy(10, missing_packets, entropy_hash));
entropy_hash = 0;
for (size_t i = 0; i < arraysize(entropies); ++i) {
diff --git a/net/quic/quic_sent_packet_manager.cc b/net/quic/quic_sent_packet_manager.cc
index a3176cc..9648917 100644
--- a/net/quic/quic_sent_packet_manager.cc
+++ b/net/quic/quic_sent_packet_manager.cc
@@ -53,7 +53,7 @@ bool HasCryptoHandshake(const TransmissionInfo& transmission_info) {
return false;
}
return transmission_info.retransmittable_frames->HasCryptoHandshake() ==
- IS_HANDSHAKE;
+ IS_HANDSHAKE;
}
} // namespace
@@ -96,8 +96,7 @@ QuicSentPacketManager::QuicSentPacketManager(
handshake_confirmed_(false),
use_general_loss_algorithm_(FLAGS_quic_general_loss_algorithm) {}
-QuicSentPacketManager::~QuicSentPacketManager() {
-}
+QuicSentPacketManager::~QuicSentPacketManager() {}
void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) {
if (config.HasReceivedInitialRoundTripTimeUs() &&
@@ -118,8 +117,7 @@ void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) {
network_change_visitor_->OnRttChange();
}
// TODO(ianswett): BBR is currently a server only feature.
- if (FLAGS_quic_allow_bbr &&
- config.HasReceivedConnectionOptions() &&
+ if (FLAGS_quic_allow_bbr && config.HasReceivedConnectionOptions() &&
ContainsQuicTag(config.ReceivedConnectionOptions(), kTBBR)) {
if (FLAGS_quic_recent_min_rtt_window_s > 0) {
rtt_stats_.set_recent_min_rtt_window(
@@ -225,11 +223,8 @@ void QuicSentPacketManager::OnIncomingAck(const QuicAckFrame& ack_frame,
unacked_packets_.RemoveObsoletePackets();
sustained_bandwidth_recorder_.RecordEstimate(
- send_algorithm_->InRecovery(),
- send_algorithm_->InSlowStart(),
- send_algorithm_->BandwidthEstimate(),
- ack_receive_time,
- clock_->WallNow(),
+ send_algorithm_->InRecovery(), send_algorithm_->InSlowStart(),
+ send_algorithm_->BandwidthEstimate(), ack_receive_time, clock_->WallNow(),
rtt_stats_.smoothed_rtt());
// Anytime we are making forward progress and have a new RTT estimate, reset
@@ -271,7 +266,8 @@ void QuicSentPacketManager::UpdatePacketInformationReceivedByPeer(
}
void QuicSentPacketManager::MaybeInvokeCongestionEvent(
- bool rtt_updated, QuicByteCount bytes_in_flight) {
+ bool rtt_updated,
+ QuicByteCount bytes_in_flight) {
if (!rtt_updated && packets_acked_.empty() && packets_lost_.empty()) {
return;
}
@@ -441,7 +437,7 @@ bool QuicSentPacketManager::HasPendingRetransmissions() const {
}
QuicSentPacketManager::PendingRetransmission
- QuicSentPacketManager::NextPendingRetransmission() {
+QuicSentPacketManager::NextPendingRetransmission() {
LOG_IF(DFATAL, pending_retransmissions_.empty())
<< "Unexpected call to PendingRetransmissions() with empty pending "
<< "retransmission list. Corrupted memory usage imminent.";
@@ -711,7 +707,7 @@ void QuicSentPacketManager::RetransmitRtoPackets() {
}
QuicSentPacketManager::RetransmissionTimeoutMode
- QuicSentPacketManager::GetRetransmissionMode() const {
+QuicSentPacketManager::GetRetransmissionMode() const {
DCHECK(unacked_packets_.HasInFlightPackets());
if (!handshake_confirmed_ && unacked_packets_.HasPendingCryptoPackets()) {
return HANDSHAKE_MODE;
@@ -774,9 +770,8 @@ void QuicSentPacketManager::InvokeLossDetection(QuicTime time) {
}
}
-bool QuicSentPacketManager::MaybeUpdateRTT(
- const QuicAckFrame& ack_frame,
- const QuicTime& ack_receive_time) {
+bool QuicSentPacketManager::MaybeUpdateRTT(const QuicAckFrame& ack_frame,
+ const QuicTime& ack_receive_time) {
// We rely on delta_time_largest_observed to compute an RTT estimate, so we
// only update rtt when the largest observed gets acked.
// NOTE: If ack is a truncated ack, then the largest observed is in fact
@@ -797,8 +792,8 @@ bool QuicSentPacketManager::MaybeUpdateRTT(
QuicTime::Delta send_delta =
ack_receive_time.Subtract(transmission_info.sent_time);
- rtt_stats_.UpdateRtt(
- send_delta, ack_frame.delta_time_largest_observed, ack_receive_time);
+ rtt_stats_.UpdateRtt(send_delta, ack_frame.delta_time_largest_observed,
+ ack_receive_time);
if (network_change_visitor_ != nullptr) {
network_change_visitor_->OnRttChange();
@@ -815,8 +810,8 @@ QuicTime::Delta QuicSentPacketManager::TimeUntilSend(
if (pending_timer_transmission_count_ > 0) {
return QuicTime::Delta::Zero();
}
- return send_algorithm_->TimeUntilSend(
- now, unacked_packets_.bytes_in_flight(), retransmittable);
+ return send_algorithm_->TimeUntilSend(now, unacked_packets_.bytes_in_flight(),
+ retransmittable);
}
// Uses a 25ms delayed ack timer. Also helps with better signaling
@@ -834,8 +829,8 @@ QuicTime::Delta QuicSentPacketManager::TimeUntilSend(
// any benefits, but if the delayed ack becomes a significant source
// of (likely, tail) latency, then consider such a mechanism.
const QuicTime::Delta QuicSentPacketManager::DelayedAckTime() const {
- return QuicTime::Delta::FromMilliseconds(min(kMaxDelayedAckTimeMs,
- kMinRetransmissionTimeMs / 2));
+ return QuicTime::Delta::FromMilliseconds(
+ min(kMaxDelayedAckTimeMs, kMinRetransmissionTimeMs / 2));
}
const QuicTime QuicSentPacketManager::GetRetransmissionTime() const {
@@ -899,7 +894,8 @@ const QuicTime::Delta QuicSentPacketManager::GetTailLossProbeDelay() const {
}
if (!unacked_packets_.HasMultipleInFlightPackets()) {
return QuicTime::Delta::Max(
- srtt.Multiply(2), srtt.Multiply(1.5).Add(
+ srtt.Multiply(2),
+ srtt.Multiply(1.5).Add(
QuicTime::Delta::FromMilliseconds(kMinRetransmissionTimeMs / 2)));
}
return QuicTime::Delta::FromMilliseconds(
@@ -983,10 +979,9 @@ void QuicSentPacketManager::EnablePacing() {
// Set up a pacing sender with a 1 millisecond alarm granularity, the same as
// the default granularity of the Linux kernel's FQ qdisc.
using_pacing_ = true;
- send_algorithm_.reset(
- new PacingSender(send_algorithm_.release(),
- QuicTime::Delta::FromMilliseconds(1),
- kInitialUnpacedBurst));
+ send_algorithm_.reset(new PacingSender(send_algorithm_.release(),
+ QuicTime::Delta::FromMilliseconds(1),
+ kInitialUnpacedBurst));
}
void QuicSentPacketManager::OnConnectionMigration(PeerAddressChangeType type) {
diff --git a/net/quic/quic_sent_packet_manager.h b/net/quic/quic_sent_packet_manager.h
index f0d990f..84ff327 100644
--- a/net/quic/quic_sent_packet_manager.h
+++ b/net/quic/quic_sent_packet_manager.h
@@ -111,8 +111,7 @@ class NET_EXPORT_PRIVATE QuicSentPacketManager {
void SetHandshakeConfirmed() { handshake_confirmed_ = true; }
// Processes the incoming ack.
- void OnIncomingAck(const QuicAckFrame& ack_frame,
- QuicTime ack_receive_time);
+ void OnIncomingAck(const QuicAckFrame& ack_frame, QuicTime ack_receive_time);
// Returns true if the non-FEC packet |packet_number| is unacked.
bool IsUnacked(QuicPacketNumber packet_number) const;
@@ -244,14 +243,10 @@ class NET_EXPORT_PRIVATE QuicSentPacketManager {
}
// Used in Chromium, but not in the server.
- size_t consecutive_rto_count() const {
- return consecutive_rto_count_;
- }
+ size_t consecutive_rto_count() const { return consecutive_rto_count_; }
// Used in Chromium, but not in the server.
- size_t consecutive_tlp_count() const {
- return consecutive_tlp_count_;
- }
+ size_t consecutive_tlp_count() const { return consecutive_tlp_count_; }
private:
friend class test::QuicConnectionPeer;
diff --git a/net/quic/quic_sent_packet_manager_test.cc b/net/quic/quic_sent_packet_manager_test.cc
index 40adefa..9b7442c 100644
--- a/net/quic/quic_sent_packet_manager_test.cc
+++ b/net/quic/quic_sent_packet_manager_test.cc
@@ -84,7 +84,7 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
if (num_packets == 0) {
EXPECT_FALSE(manager_.HasUnackedPackets());
EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetNumRetransmittablePackets(
- &manager_));
+ &manager_));
return;
}
@@ -97,9 +97,9 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
void VerifyRetransmittablePackets(QuicPacketNumber* packets,
size_t num_packets) {
- EXPECT_EQ(num_packets,
- QuicSentPacketManagerPeer::GetNumRetransmittablePackets(
- &manager_));
+ EXPECT_EQ(
+ num_packets,
+ QuicSentPacketManagerPeer::GetNumRetransmittablePackets(&manager_));
for (size_t i = 0; i < num_packets; ++i) {
EXPECT_TRUE(manager_.HasRetransmittableFrames(packets[i]))
<< " packets[" << i << "]:" << packets[i];
@@ -107,8 +107,10 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
}
void ExpectAck(QuicPacketNumber largest_observed) {
- EXPECT_CALL(*send_algorithm_, OnCongestionEvent(
- true, _, ElementsAre(Pair(largest_observed, _)), IsEmpty()));
+ EXPECT_CALL(
+ *send_algorithm_,
+ OnCongestionEvent(true, _, ElementsAre(Pair(largest_observed, _)),
+ IsEmpty()));
EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
EXPECT_CALL(*network_change_visitor_, OnRttChange());
}
@@ -123,9 +125,10 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
void ExpectAckAndLoss(bool rtt_updated,
QuicPacketNumber largest_observed,
QuicPacketNumber lost_packet) {
- EXPECT_CALL(*send_algorithm_, OnCongestionEvent(
- rtt_updated, _, ElementsAre(Pair(largest_observed, _)),
- ElementsAre(Pair(lost_packet, _))));
+ EXPECT_CALL(*send_algorithm_,
+ OnCongestionEvent(rtt_updated, _,
+ ElementsAre(Pair(largest_observed, _)),
+ ElementsAre(Pair(lost_packet, _))));
EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
EXPECT_CALL(*network_change_visitor_, OnRttChange());
}
@@ -144,12 +147,12 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
for (size_t i = 0; i < num_packets_lost; ++i) {
lost_vector.push_back(packets_lost[i]);
}
- EXPECT_CALL(*send_algorithm_,
- OnCongestionEvent(rtt_updated, _,
- Pointwise(KeyEq(), ack_vector),
- Pointwise(KeyEq(), lost_vector)));
- EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()).
- Times(AnyNumber());
+ EXPECT_CALL(
+ *send_algorithm_,
+ OnCongestionEvent(rtt_updated, _, Pointwise(KeyEq(), ack_vector),
+ Pointwise(KeyEq(), lost_vector)));
+ EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange())
+ .Times(AnyNumber());
EXPECT_CALL(*network_change_visitor_, OnRttChange()).Times(AnyNumber());
}
@@ -161,8 +164,7 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
QuicSentPacketManager::PendingRetransmission next_retransmission =
manager_.NextPendingRetransmission();
EXPECT_EQ(old_packet_number, next_retransmission.packet_number);
- EXPECT_EQ(TLP_RETRANSMISSION,
- next_retransmission.transmission_type);
+ EXPECT_EQ(TLP_RETRANSMISSION, next_retransmission.transmission_type);
EXPECT_CALL(*send_algorithm_,
OnPacketSent(_, BytesInFlight(), new_packet_number,
@@ -207,9 +209,8 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
.Times(1)
.WillOnce(Return(true));
SerializedPacket packet(CreateDataPacket(packet_number));
- manager_.OnPacketSent(&packet, 0, clock_.Now(),
- packet.packet->length(), NOT_RETRANSMISSION,
- HAS_RETRANSMITTABLE_DATA);
+ manager_.OnPacketSent(&packet, 0, clock_.Now(), packet.packet->length(),
+ NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA);
}
void SendCryptoPacket(QuicPacketNumber packet_number) {
@@ -221,9 +222,8 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
SerializedPacket packet(CreateDataPacket(packet_number));
packet.retransmittable_frames->AddFrame(
QuicFrame(new QuicStreamFrame(1, false, 0, StringPiece())));
- manager_.OnPacketSent(&packet, 0, clock_.Now(),
- packet.packet->length(), NOT_RETRANSMISSION,
- HAS_RETRANSMITTABLE_DATA);
+ manager_.OnPacketSent(&packet, 0, clock_.Now(), packet.packet->length(),
+ NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA);
}
void SendFecPacket(QuicPacketNumber packet_number) {
@@ -233,9 +233,8 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
.Times(1)
.WillOnce(Return(true));
SerializedPacket packet(CreateFecPacket(packet_number));
- manager_.OnPacketSent(&packet, 0, clock_.Now(),
- packet.packet->length(), NOT_RETRANSMISSION,
- NO_RETRANSMITTABLE_DATA);
+ manager_.OnPacketSent(&packet, 0, clock_.Now(), packet.packet->length(),
+ NOT_RETRANSMISSION, NO_RETRANSMITTABLE_DATA);
}
void SendAckPacket(QuicPacketNumber packet_number) {
@@ -245,9 +244,8 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
.Times(1)
.WillOnce(Return(false));
SerializedPacket packet(CreatePacket(packet_number, false));
- manager_.OnPacketSent(&packet, 0, clock_.Now(),
- packet.packet->length(), NOT_RETRANSMISSION,
- NO_RETRANSMITTABLE_DATA);
+ manager_.OnPacketSent(&packet, 0, clock_.Now(), packet.packet->length(),
+ NOT_RETRANSMISSION, NO_RETRANSMITTABLE_DATA);
}
// Based on QuicConnection's WritePendingRetransmissions.
@@ -316,8 +314,8 @@ TEST_F(QuicSentPacketManagerTest, RetransmitThenAck) {
TEST_F(QuicSentPacketManagerTest, RetransmitThenAckBeforeSend) {
SendDataPacket(1);
- QuicSentPacketManagerPeer::MarkForRetransmission(
- &manager_, 1, TLP_RETRANSMISSION);
+ QuicSentPacketManagerPeer::MarkForRetransmission(&manager_, 1,
+ TLP_RETRANSMISSION);
EXPECT_TRUE(manager_.HasPendingRetransmissions());
// Ack 1.
@@ -447,8 +445,9 @@ TEST_F(QuicSentPacketManagerTest,
TEST_F(QuicSentPacketManagerTest, RetransmitTwiceThenAckFirst) {
StrictMock<MockDebugDelegate> debug_delegate;
- EXPECT_CALL(debug_delegate, OnSpuriousPacketRetransmission(
- TLP_RETRANSMISSION, kDefaultLength)).Times(2);
+ EXPECT_CALL(debug_delegate, OnSpuriousPacketRetransmission(TLP_RETRANSMISSION,
+ kDefaultLength))
+ .Times(2);
manager_.set_debug_delegate(&debug_delegate);
SendDataPacket(1);
@@ -656,8 +655,7 @@ TEST_F(QuicSentPacketManagerTest, AckAckAndUpdateRtt) {
// Now ack the ack and expect an RTT update.
QuicAckFrame ack_frame;
ack_frame.largest_observed = 2;
- ack_frame.delta_time_largest_observed =
- QuicTime::Delta::FromMilliseconds(5);
+ ack_frame.delta_time_largest_observed = QuicTime::Delta::FromMilliseconds(5);
ExpectAck(1);
manager_.OnIncomingAck(ack_frame, clock_.Now());
@@ -679,8 +677,7 @@ TEST_F(QuicSentPacketManagerTest, Rtt) {
ExpectAck(packet_number);
QuicAckFrame ack_frame;
ack_frame.largest_observed = packet_number;
- ack_frame.delta_time_largest_observed =
- QuicTime::Delta::FromMilliseconds(5);
+ ack_frame.delta_time_largest_observed = QuicTime::Delta::FromMilliseconds(5);
manager_.OnIncomingAck(ack_frame, clock_.Now());
EXPECT_EQ(expected_rtt,
QuicSentPacketManagerPeer::GetRttStats(&manager_)->latest_rtt());
@@ -698,8 +695,7 @@ TEST_F(QuicSentPacketManagerTest, RttWithInvalidDelta) {
ExpectAck(packet_number);
QuicAckFrame ack_frame;
ack_frame.largest_observed = packet_number;
- ack_frame.delta_time_largest_observed =
- QuicTime::Delta::FromMilliseconds(11);
+ ack_frame.delta_time_largest_observed = QuicTime::Delta::FromMilliseconds(11);
manager_.OnIncomingAck(ack_frame, clock_.Now());
EXPECT_EQ(expected_rtt,
QuicSentPacketManagerPeer::GetRttStats(&manager_)->latest_rtt());
@@ -764,8 +760,8 @@ TEST_F(QuicSentPacketManagerTest, TailLossProbeTimeout) {
manager_.MaybeRetransmitTailLossProbe();
EXPECT_TRUE(manager_.HasPendingRetransmissions());
RetransmitNextPacket(3);
- EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return(
- QuicTime::Delta::Infinite()));
+ EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
+ .WillOnce(Return(QuicTime::Delta::Infinite()));
EXPECT_EQ(QuicTime::Delta::Infinite(),
manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
EXPECT_FALSE(manager_.HasPendingRetransmissions());
@@ -811,8 +807,8 @@ TEST_F(QuicSentPacketManagerTest, TailLossProbeThenRTO) {
manager_.MaybeRetransmitTailLossProbe();
EXPECT_TRUE(manager_.HasPendingRetransmissions());
RetransmitNextPacket(101);
- EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return(
- QuicTime::Delta::Infinite()));
+ EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
+ .WillOnce(Return(QuicTime::Delta::Infinite()));
EXPECT_EQ(QuicTime::Delta::Infinite(),
manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
EXPECT_FALSE(manager_.HasPendingRetransmissions());
@@ -826,8 +822,8 @@ TEST_F(QuicSentPacketManagerTest, TailLossProbeThenRTO) {
EXPECT_TRUE(manager_.MaybeRetransmitTailLossProbe());
EXPECT_TRUE(manager_.HasPendingRetransmissions());
RetransmitNextPacket(102);
- EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return(
- QuicTime::Delta::Infinite()));
+ EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
+ .WillOnce(Return(QuicTime::Delta::Infinite()));
EXPECT_EQ(QuicTime::Delta::Infinite(),
manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
@@ -1260,8 +1256,8 @@ TEST_F(QuicSentPacketManagerTest, GetTransmissionTimeTailLossProbe) {
EXPECT_TRUE(manager_.MaybeRetransmitTailLossProbe());
EXPECT_TRUE(manager_.HasPendingRetransmissions());
RetransmitNextPacket(3);
- EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return(
- QuicTime::Delta::Infinite()));
+ EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
+ .WillOnce(Return(QuicTime::Delta::Infinite()));
EXPECT_EQ(QuicTime::Delta::Infinite(),
manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
EXPECT_FALSE(manager_.HasPendingRetransmissions());
@@ -1271,10 +1267,9 @@ TEST_F(QuicSentPacketManagerTest, GetTransmissionTimeTailLossProbe) {
}
TEST_F(QuicSentPacketManagerTest, GetTransmissionTimeSpuriousRTO) {
- QuicSentPacketManagerPeer::GetRttStats(&manager_)->UpdateRtt(
- QuicTime::Delta::FromMilliseconds(100),
- QuicTime::Delta::Zero(),
- QuicTime::Zero());
+ QuicSentPacketManagerPeer::GetRttStats(&manager_)
+ ->UpdateRtt(QuicTime::Delta::FromMilliseconds(100),
+ QuicTime::Delta::Zero(), QuicTime::Zero());
SendDataPacket(1);
SendDataPacket(2);
@@ -1408,9 +1403,8 @@ TEST_F(QuicSentPacketManagerTest, GetLossDelay) {
}
TEST_F(QuicSentPacketManagerTest, NegotiateTimeLossDetectionFromOptions) {
- EXPECT_EQ(kNack,
- QuicSentPacketManagerPeer::GetLossAlgorithm(
- &manager_)->GetLossDetectionType());
+ EXPECT_EQ(kNack, QuicSentPacketManagerPeer::GetLossAlgorithm(&manager_)
+ ->GetLossDetectionType());
QuicConfig config;
QuicTagVector options;
@@ -1421,9 +1415,8 @@ TEST_F(QuicSentPacketManagerTest, NegotiateTimeLossDetectionFromOptions) {
EXPECT_CALL(*network_change_visitor_, OnRttChange());
manager_.SetFromConfig(config);
- EXPECT_EQ(kTime,
- QuicSentPacketManagerPeer::GetLossAlgorithm(
- &manager_)->GetLossDetectionType());
+ EXPECT_EQ(kTime, QuicSentPacketManagerPeer::GetLossAlgorithm(&manager_)
+ ->GetLossDetectionType());
}
TEST_F(QuicSentPacketManagerTest, NegotiateCongestionControlFromOptions) {
@@ -1436,10 +1429,10 @@ TEST_F(QuicSentPacketManagerTest, NegotiateCongestionControlFromOptions) {
EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
EXPECT_CALL(*network_change_visitor_, OnRttChange());
manager_.SetFromConfig(config);
- EXPECT_EQ(kReno, QuicSentPacketManagerPeer::GetSendAlgorithm(
- manager_)->GetCongestionControlType());
+ EXPECT_EQ(kReno, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
+ ->GetCongestionControlType());
- // TODO(rtenneti): Enable the following code after BBR code is checked in.
+// TODO(rtenneti): Enable the following code after BBR code is checked in.
#if 0
options.clear();
options.push_back(kTBBR);
@@ -1643,8 +1636,8 @@ TEST_F(QuicSentPacketManagerTest, ReceiveWindowLimited) {
// Ensure the smaller send window only allows 256 * 0.95 packets to be sent.
for (QuicPacketNumber i = 1; i <= 244; ++i) {
- EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return(
- QuicTime::Delta::Zero()));
+ EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
+ .WillOnce(Return(QuicTime::Delta::Zero()));
EXPECT_EQ(QuicTime::Delta::Zero(),
manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, BytesInFlight(), i, 1024,
diff --git a/net/quic/quic_server_id.cc b/net/quic/quic_server_id.cc
index 25bac39..a79d677 100644
--- a/net/quic/quic_server_id.cc
+++ b/net/quic/quic_server_id.cc
@@ -19,8 +19,7 @@ QuicServerId::QuicServerId() : privacy_mode_(PRIVACY_MODE_DISABLED) {}
QuicServerId::QuicServerId(const HostPortPair& host_port_pair,
PrivacyMode privacy_mode)
- : host_port_pair_(host_port_pair),
- privacy_mode_(privacy_mode) {}
+ : host_port_pair_(host_port_pair), privacy_mode_(privacy_mode) {}
QuicServerId::QuicServerId(const string& host, uint16 port)
: host_port_pair_(host, port), privacy_mode_(PRIVACY_MODE_DISABLED) {}
@@ -28,8 +27,7 @@ QuicServerId::QuicServerId(const string& host, uint16 port)
QuicServerId::QuicServerId(const string& host,
uint16 port,
PrivacyMode privacy_mode)
- : host_port_pair_(host, port),
- privacy_mode_(privacy_mode) {}
+ : host_port_pair_(host, port), privacy_mode_(privacy_mode) {}
QuicServerId::~QuicServerId() {}
diff --git a/net/quic/quic_server_id.h b/net/quic/quic_server_id.h
index 4e3f067..609c3b7 100644
--- a/net/quic/quic_server_id.h
+++ b/net/quic/quic_server_id.h
@@ -18,12 +18,9 @@ namespace net {
class NET_EXPORT_PRIVATE QuicServerId {
public:
QuicServerId();
- QuicServerId(const HostPortPair& host_port_pair,
- PrivacyMode privacy_mode);
+ QuicServerId(const HostPortPair& host_port_pair, PrivacyMode privacy_mode);
QuicServerId(const std::string& host, uint16 port);
- QuicServerId(const std::string& host,
- uint16 port,
- PrivacyMode privacy_mode);
+ QuicServerId(const std::string& host, uint16 port, PrivacyMode privacy_mode);
~QuicServerId();
// Needed to be an element of std::set.
diff --git a/net/quic/quic_server_id_test.cc b/net/quic/quic_server_id_test.cc
index e23d816..5c88067 100644
--- a/net/quic/quic_server_id_test.cc
+++ b/net/quic/quic_server_id_test.cc
@@ -42,7 +42,7 @@ TEST(QuicServerIdTest, LessThan) {
// Test combinations of host, port, and privacy being same on left and
// right side of less than.
EXPECT_FALSE(a_10_https < a_10_https);
- EXPECT_TRUE(a_10_https < a_10_https_private);
+ EXPECT_TRUE(a_10_https < a_10_https_private);
EXPECT_FALSE(a_10_https_private < a_10_https);
EXPECT_FALSE(a_10_https_private < a_10_https_private);
diff --git a/net/quic/quic_session.cc b/net/quic/quic_session.cc
index 445792b..08753fd 100644
--- a/net/quic/quic_session.cc
+++ b/net/quic/quic_session.cc
@@ -253,8 +253,8 @@ void QuicSession::OnCanWrite() {
return;
}
- QuicConnection::ScopedPacketBundler ack_bundler(
- connection_.get(), QuicConnection::NO_ACK);
+ QuicConnection::ScopedPacketBundler ack_bundler(connection_.get(),
+ QuicConnection::NO_ACK);
for (size_t i = 0; i < num_writes; ++i) {
if (!(write_blocked_streams_.HasWriteBlockedCryptoOrHeadersStream() ||
write_blocked_streams_.HasWriteBlockedDataStreams())) {
@@ -341,8 +341,7 @@ void QuicSession::CloseStream(QuicStreamId stream_id) {
CloseStreamInner(stream_id, false);
}
-void QuicSession::CloseStreamInner(QuicStreamId stream_id,
- bool locally_reset) {
+void QuicSession::CloseStreamInner(QuicStreamId stream_id, bool locally_reset) {
DVLOG(1) << ENDPOINT << "Closing stream " << stream_id;
StreamMap::iterator it = dynamic_stream_map_.find(stream_id);
@@ -390,7 +389,8 @@ void QuicSession::CloseStreamInner(QuicStreamId stream_id,
}
void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset(
- QuicStreamId stream_id, QuicStreamOffset final_byte_offset) {
+ QuicStreamId stream_id,
+ QuicStreamOffset final_byte_offset) {
map<QuicStreamId, QuicStreamOffset>::iterator it =
locally_closed_streams_highest_offset_.find(stream_id);
if (it == locally_closed_streams_highest_offset_.end()) {
@@ -435,9 +435,8 @@ void QuicSession::OnConfigNegotiated() {
// when FIN/RSTs for old streams are lost or arrive out of order.
// Use a minimum number of additional streams, or a percentage increase,
// whichever is larger.
- max_streams =
- max(max_streams + kMaxStreamsMinimumIncrement,
- static_cast<uint32>(max_streams * kMaxStreamsMultiplier));
+ max_streams = max(max_streams + kMaxStreamsMinimumIncrement,
+ static_cast<uint32>(max_streams * kMaxStreamsMultiplier));
if (config_.HasReceivedConnectionOptions()) {
if (ContainsQuicTag(config_.ReceivedConnectionOptions(), kAFCW)) {
@@ -565,8 +564,8 @@ void QuicSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) {
break;
case HANDSHAKE_CONFIRMED:
- LOG_IF(DFATAL, !config_.negotiated()) << ENDPOINT
- << "Handshake confirmed without parameter negotiation.";
+ LOG_IF(DFATAL, !config_.negotiated())
+ << ENDPOINT << "Handshake confirmed without parameter negotiation.";
// Discard originally encrypted packets, since they can't be decrypted by
// the peer.
connection_->NeuterUnencryptedPackets();
@@ -673,8 +672,7 @@ ReliableQuicStream* QuicSession::GetOrCreateDynamicStream(
CloseConnection(QUIC_TOO_MANY_AVAILABLE_STREAMS);
return nullptr;
}
- for (QuicStreamId id = largest_peer_created_stream_id_ + 2;
- id < stream_id;
+ for (QuicStreamId id = largest_peer_created_stream_id_ + 2; id < stream_id;
id += 2) {
available_streams_.insert(id);
}
diff --git a/net/quic/quic_session.h b/net/quic/quic_session.h
index 200dd38..619cf5a0 100644
--- a/net/quic/quic_session.h
+++ b/net/quic/quic_session.h
@@ -146,9 +146,7 @@ class NET_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface {
QuicConnection* connection() { return connection_.get(); }
const QuicConnection* connection() const { return connection_.get(); }
size_t num_active_requests() const { return dynamic_stream_map_.size(); }
- const IPEndPoint& peer_address() const {
- return connection_->peer_address();
- }
+ const IPEndPoint& peer_address() const { return connection_->peer_address(); }
QuicConnectionId connection_id() const {
return connection_->connection_id();
}
@@ -289,7 +287,8 @@ class NET_EXPORT_PRIVATE QuicSession : public QuicConnectionVisitorInterface {
// When this data arrives (via stream frame w. FIN, or RST) this method
// is called, and correctly updates the connection level flow controller.
void UpdateFlowControlOnFinalReceivedByteOffset(
- QuicStreamId id, QuicStreamOffset final_byte_offset);
+ QuicStreamId id,
+ QuicStreamOffset final_byte_offset);
// Called in OnConfigNegotiated when we receive a new stream level flow
// control window in a negotiated config. Closes the connection if invalid.
diff --git a/net/quic/quic_session_test.cc b/net/quic/quic_session_test.cc
index 9e4eea2..bda96ae 100644
--- a/net/quic/quic_session_test.cc
+++ b/net/quic/quic_session_test.cc
@@ -51,9 +51,7 @@ const SpdyPriority kHighestPriority = kV3HighestPriority;
class TestCryptoStream : public QuicCryptoStream {
public:
- explicit TestCryptoStream(QuicSession* session)
- : QuicCryptoStream(session) {
- }
+ explicit TestCryptoStream(QuicSession* session) : QuicCryptoStream(session) {}
void OnHandshakeMessage(const CryptoHandshakeMessage& /*message*/) override {
encryption_established_ = true;
@@ -65,8 +63,8 @@ class TestCryptoStream : public QuicCryptoStream {
session()->config()->SetInitialSessionFlowControlWindowToSend(
kInitialSessionFlowControlWindowForTest);
session()->config()->ToHandshakeMessage(&msg);
- const QuicErrorCode error = session()->config()->ProcessPeerHello(
- msg, CLIENT, &error_details);
+ const QuicErrorCode error =
+ session()->config()->ProcessPeerHello(msg, CLIENT, &error_details);
EXPECT_EQ(QUIC_NO_ERROR, error);
session()->OnConfigNegotiated();
session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED);
@@ -103,9 +101,7 @@ class TestStream : public QuicSpdyStream {
class StreamBlocker {
public:
StreamBlocker(QuicSession* session, QuicStreamId stream_id)
- : session_(session),
- stream_id_(stream_id) {
- }
+ : session_(session), stream_id_(stream_id) {}
void MarkConnectionLevelWriteBlocked() {
session_->MarkConnectionLevelWriteBlocked(stream_id_, kDefaultPriority);
@@ -523,8 +519,8 @@ TEST_P(QuicSessionTestServer, OnCanWriteBundlesStreams) {
session_.MarkConnectionLevelWriteBlocked(stream6->id(), kDefaultPriority);
session_.MarkConnectionLevelWriteBlocked(stream4->id(), kDefaultPriority);
- EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _, _)).WillRepeatedly(
- Return(QuicTime::Delta::Zero()));
+ EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _, _))
+ .WillRepeatedly(Return(QuicTime::Delta::Zero()));
EXPECT_CALL(*send_algorithm, GetCongestionWindow())
.WillRepeatedly(Return(kMaxPacketSize * 10));
EXPECT_CALL(*stream2, OnCanWrite())
@@ -539,11 +535,10 @@ TEST_P(QuicSessionTestServer, OnCanWriteBundlesStreams) {
// Expect that we only send one packet, the writes from different streams
// should be bundled together.
- MockPacketWriter* writer =
- static_cast<MockPacketWriter*>(
- QuicConnectionPeer::GetWriter(session_.connection()));
- EXPECT_CALL(*writer, WritePacket(_, _, _, _)).WillOnce(
- Return(WriteResult(WRITE_STATUS_OK, 0)));
+ MockPacketWriter* writer = static_cast<MockPacketWriter*>(
+ QuicConnectionPeer::GetWriter(session_.connection()));
+ EXPECT_CALL(*writer, WritePacket(_, _, _, _))
+ .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0)));
EXPECT_CALL(*send_algorithm, OnPacketSent(_, _, _, _, _));
session_.OnCanWrite();
EXPECT_FALSE(session_.WillingAndAbleToWrite());
@@ -565,29 +560,29 @@ TEST_P(QuicSessionTestServer, OnCanWriteCongestionControlBlocks) {
session_.MarkConnectionLevelWriteBlocked(stream4->id(), kDefaultPriority);
StreamBlocker stream2_blocker(&session_, stream2->id());
- EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _, _)).WillOnce(Return(
- QuicTime::Delta::Zero()));
+ EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _, _))
+ .WillOnce(Return(QuicTime::Delta::Zero()));
EXPECT_CALL(*stream2, OnCanWrite());
- EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _, _)).WillOnce(Return(
- QuicTime::Delta::Zero()));
+ EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _, _))
+ .WillOnce(Return(QuicTime::Delta::Zero()));
EXPECT_CALL(*stream6, OnCanWrite());
- EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _, _)).WillOnce(Return(
- QuicTime::Delta::Infinite()));
+ EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _, _))
+ .WillOnce(Return(QuicTime::Delta::Infinite()));
// stream4->OnCanWrite is not called.
session_.OnCanWrite();
EXPECT_TRUE(session_.WillingAndAbleToWrite());
// Still congestion-control blocked.
- EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _, _)).WillOnce(Return(
- QuicTime::Delta::Infinite()));
+ EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _, _))
+ .WillOnce(Return(QuicTime::Delta::Infinite()));
session_.OnCanWrite();
EXPECT_TRUE(session_.WillingAndAbleToWrite());
// stream4->OnCanWrite is called once the connection stops being
// congestion-control blocked.
- EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _, _)).WillOnce(Return(
- QuicTime::Delta::Zero()));
+ EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _, _))
+ .WillOnce(Return(QuicTime::Delta::Zero()));
EXPECT_CALL(*stream4, OnCanWrite());
session_.OnCanWrite();
EXPECT_FALSE(session_.WillingAndAbleToWrite());
@@ -859,8 +854,8 @@ TEST_P(QuicSessionTestServer,
EXPECT_FALSE(session_.IsConnectionFlowControlBlocked());
EXPECT_FALSE(session_.IsStreamFlowControlBlocked());
headers["header"] = base::Uint64ToString(base::RandUint64()) +
- base::Uint64ToString(base::RandUint64()) +
- base::Uint64ToString(base::RandUint64());
+ base::Uint64ToString(base::RandUint64()) +
+ base::Uint64ToString(base::RandUint64());
headers_stream->WriteHeaders(stream_id, headers, true, 0, nullptr);
stream_id += 2;
}
diff --git a/net/quic/quic_socket_address_coder.cc b/net/quic/quic_socket_address_coder.cc
index 5dba821..3d0031d 100644
--- a/net/quic/quic_socket_address_coder.cc
+++ b/net/quic/quic_socket_address_coder.cc
@@ -19,15 +19,12 @@ const uint16 kIPv6 = 10;
} // namespace
-QuicSocketAddressCoder::QuicSocketAddressCoder() {
-}
+QuicSocketAddressCoder::QuicSocketAddressCoder() {}
QuicSocketAddressCoder::QuicSocketAddressCoder(const IPEndPoint& address)
- : address_(address) {
-}
+ : address_(address) {}
-QuicSocketAddressCoder::~QuicSocketAddressCoder() {
-}
+QuicSocketAddressCoder::~QuicSocketAddressCoder() {}
string QuicSocketAddressCoder::Encode() const {
string serialized;
diff --git a/net/quic/quic_socket_address_coder.h b/net/quic/quic_socket_address_coder.h
index 36ad1d03..852682e 100644
--- a/net/quic/quic_socket_address_coder.h
+++ b/net/quic/quic_socket_address_coder.h
@@ -26,13 +26,9 @@ class NET_EXPORT_PRIVATE QuicSocketAddressCoder {
bool Decode(const char* data, size_t length);
- IPAddressNumber ip() const {
- return address_.address();
- }
+ IPAddressNumber ip() const { return address_.address(); }
- uint16 port() const {
- return address_.port();
- }
+ uint16 port() const { return address_.port(); }
private:
IPEndPoint address_;
diff --git a/net/quic/quic_socket_address_coder_test.cc b/net/quic/quic_socket_address_coder_test.cc
index f8b7884..aeba0d1 100644
--- a/net/quic/quic_socket_address_coder_test.cc
+++ b/net/quic/quic_socket_address_coder_test.cc
@@ -26,10 +26,12 @@ TEST(QuicSocketAddressCoderTest, EncodeIPv6) {
ASSERT_TRUE(ParseIPLiteralToNumber("2001:700:300:1800::f", &ip));
QuicSocketAddressCoder coder(IPEndPoint(ip, 0x5678));
string serialized = coder.Encode();
- string expected("\x0a\x00"
- "\x20\x01\x07\x00\x03\x00\x18\x00"
- "\x00\x00\x00\x00\x00\x00\x00\x0f"
- "\x78\x56", 20);
+ string expected(
+ "\x0a\x00"
+ "\x20\x01\x07\x00\x03\x00\x18\x00"
+ "\x00\x00\x00\x00\x00\x00\x00\x0f"
+ "\x78\x56",
+ 20);
EXPECT_EQ(expected, serialized);
}
@@ -44,24 +46,30 @@ TEST(QuicSocketAddressCoderTest, DecodeIPv4) {
}
TEST(QuicSocketAddressCoderTest, DecodeIPv6) {
- string serialized("\x0a\x00"
- "\x20\x01\x07\x00\x03\x00\x18\x00"
- "\x00\x00\x00\x00\x00\x00\x00\x0f"
- "\x78\x56", 20);
+ string serialized(
+ "\x0a\x00"
+ "\x20\x01\x07\x00\x03\x00\x18\x00"
+ "\x00\x00\x00\x00\x00\x00\x00\x0f"
+ "\x78\x56",
+ 20);
QuicSocketAddressCoder coder;
ASSERT_TRUE(coder.Decode(serialized.data(), serialized.length()));
EXPECT_EQ(AF_INET6, ConvertAddressFamily(GetAddressFamily(coder.ip())));
- string expected_addr("\x20\x01\x07\x00\x03\x00\x18\x00"
- "\x00\x00\x00\x00\x00\x00\x00\x0f", 16);
+ string expected_addr(
+ "\x20\x01\x07\x00\x03\x00\x18\x00"
+ "\x00\x00\x00\x00\x00\x00\x00\x0f",
+ 16);
EXPECT_EQ(expected_addr, IPAddressToPackedString(coder.ip()));
EXPECT_EQ(0x5678, coder.port());
}
TEST(QuicSocketAddressCoderTest, DecodeBad) {
- string serialized("\x0a\x00"
- "\x20\x01\x07\x00\x03\x00\x18\x00"
- "\x00\x00\x00\x00\x00\x00\x00\x0f"
- "\x78\x56", 20);
+ string serialized(
+ "\x0a\x00"
+ "\x20\x01\x07\x00\x03\x00\x18\x00"
+ "\x00\x00\x00\x00\x00\x00\x00\x0f"
+ "\x78\x56",
+ 20);
QuicSocketAddressCoder coder;
EXPECT_TRUE(coder.Decode(serialized.data(), serialized.length()));
// Append junk.
@@ -93,12 +101,12 @@ TEST(QuicSocketAddressCoderTest, EncodeAndDecode) {
const char* ip_literal;
uint16 port;
} test_case[] = {
- { "93.184.216.119", 0x1234 },
- { "199.204.44.194", 80 },
- { "149.20.4.69", 443 },
- { "127.0.0.1", 8080 },
- { "2001:700:300:1800::", 0x5678 },
- { "::1", 65534 },
+ {"93.184.216.119", 0x1234},
+ {"199.204.44.194", 80},
+ {"149.20.4.69", 443},
+ {"127.0.0.1", 8080},
+ {"2001:700:300:1800::", 0x5678},
+ {"::1", 65534},
};
for (size_t i = 0; i < arraysize(test_case); i++) {
diff --git a/net/quic/quic_spdy_session.cc b/net/quic/quic_spdy_session.cc
index a13c9e2..cdf2749 100644
--- a/net/quic/quic_spdy_session.cc
+++ b/net/quic/quic_spdy_session.cc
@@ -10,11 +10,9 @@ namespace net {
QuicSpdySession::QuicSpdySession(QuicConnection* connection,
const QuicConfig& config)
- : QuicSession(connection, config) {
-}
+ : QuicSession(connection, config) {}
-QuicSpdySession::~QuicSpdySession() {
-}
+QuicSpdySession::~QuicSpdySession() {}
void QuicSpdySession::Initialize() {
QuicSession::Initialize();
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc
index 2443381..0663160 100644
--- a/net/quic/quic_stream_factory.cc
+++ b/net/quic/quic_stream_factory.cc
@@ -798,9 +798,8 @@ void QuicStreamFactory::CreateAuxilaryJob(const QuicServerId server_id,
aux_job->GetWeakPtr()));
}
-bool QuicStreamFactory::OnResolution(
- const QuicServerId& server_id,
- const AddressList& address_list) {
+bool QuicStreamFactory::OnResolution(const QuicServerId& server_id,
+ const AddressList& address_list) {
DCHECK(!HasActiveSession(server_id));
if (disable_connection_pooling_) {
return false;
@@ -1166,8 +1165,7 @@ void QuicStreamFactory::OnCACertChanged(const X509Certificate* cert) {
CloseAllSessions(ERR_CERT_DATABASE_CHANGED);
}
-bool QuicStreamFactory::HasActiveSession(
- const QuicServerId& server_id) const {
+bool QuicStreamFactory::HasActiveSession(const QuicServerId& server_id) const {
// TODO(rtenneti): crbug.com/498823 - delete active_sessions_.empty() check.
if (active_sessions_.empty())
return false;
@@ -1186,8 +1184,7 @@ int QuicStreamFactory::CreateSession(const QuicServerId& server_id,
const BoundNetLog& net_log,
QuicChromiumClientSession** session) {
bool enable_port_selection = enable_port_selection_;
- if (enable_port_selection &&
- ContainsKey(gone_away_aliases_, server_id)) {
+ if (enable_port_selection && ContainsKey(gone_away_aliases_, server_id)) {
// Disable port selection when the server is going away.
// There is no point in trying to return to the same server, if
// that server is no longer handling requests.
@@ -1199,13 +1196,13 @@ int QuicStreamFactory::CreateSession(const QuicServerId& server_id,
IPEndPoint addr = *address_list.begin();
scoped_refptr<PortSuggester> port_suggester =
new PortSuggester(server_id.host_port_pair(), port_seed_);
- DatagramSocket::BindType bind_type = enable_port_selection ?
- DatagramSocket::RANDOM_BIND : // Use our callback.
- DatagramSocket::DEFAULT_BIND; // Use OS to randomize.
+ DatagramSocket::BindType bind_type =
+ enable_port_selection ? DatagramSocket::RANDOM_BIND
+ : // Use our callback.
+ DatagramSocket::DEFAULT_BIND; // Use OS to randomize.
scoped_ptr<DatagramClientSocket> socket(
client_socket_factory_->CreateDatagramClientSocket(
- bind_type,
- base::Bind(&PortSuggester::SuggestPort, port_suggester),
+ bind_type, base::Bind(&PortSuggester::SuggestPort, port_suggester),
net_log.net_log(), net_log.source()));
if (enable_non_blocking_io_ &&
@@ -1307,9 +1304,8 @@ int QuicStreamFactory::CreateSession(const QuicServerId& server_id,
all_sessions_[*session] = server_id; // owning pointer
(*session)->Initialize();
- bool closed_during_initialize =
- !ContainsKey(all_sessions_, *session) ||
- !(*session)->connection()->connected();
+ bool closed_during_initialize = !ContainsKey(all_sessions_, *session) ||
+ !(*session)->connection()->connected();
UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ClosedDuringInitializeSession",
closed_during_initialize);
if (closed_during_initialize) {
diff --git a/net/quic/quic_stream_factory.h b/net/quic/quic_stream_factory.h
index 644fbc7..9eea419 100644
--- a/net/quic/quic_stream_factory.h
+++ b/net/quic/quic_stream_factory.h
@@ -222,9 +222,7 @@ class NET_EXPORT_PRIVATE QuicStreamFactory
void OnCertAdded(const X509Certificate* cert) override;
void OnCACertChanged(const X509Certificate* cert) override;
- bool require_confirmation() const {
- return require_confirmation_;
- }
+ bool require_confirmation() const { return require_confirmation_; }
void set_require_confirmation(bool require_confirmation);
diff --git a/net/quic/quic_stream_factory_test.cc b/net/quic/quic_stream_factory_test.cc
index c1390a4..de84d4e 100644
--- a/net/quic/quic_stream_factory_test.cc
+++ b/net/quic/quic_stream_factory_test.cc
@@ -190,8 +190,7 @@ class QuicStreamFactoryTest : public ::testing::TestWithParam<TestParams> {
return GetSourcePortForNewSessionInner(destination, false);
}
- int GetSourcePortForNewSessionAndGoAway(
- const HostPortPair& destination) {
+ int GetSourcePortForNewSessionAndGoAway(const HostPortPair& destination) {
return GetSourcePortForNewSessionInner(destination, true);
}
@@ -202,7 +201,7 @@ class QuicStreamFactoryTest : public ::testing::TestWithParam<TestParams> {
size_t socket_count = socket_factory_.udp_client_sockets().size();
MockRead reads[] = {
- MockRead(ASYNC, OK, 0) // EOF
+ MockRead(ASYNC, OK, 0) // EOF
};
DeterministicSocketData socket_data(reads, arraysize(reads), nullptr, 0);
socket_data.StopAfter(1);
@@ -228,8 +227,8 @@ class QuicStreamFactoryTest : public ::testing::TestWithParam<TestParams> {
}
IPEndPoint endpoint;
- socket_factory_.
- udp_client_sockets()[socket_count]->GetLocalAddress(&endpoint);
+ socket_factory_.udp_client_sockets()[socket_count]->GetLocalAddress(
+ &endpoint);
int port = endpoint.port();
if (goaway_received) {
QuicGoAwayFrame goaway(QUIC_NO_ERROR, 1, "");
@@ -321,7 +320,7 @@ TEST_P(QuicStreamFactoryTest, Create) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, OK, 0) // EOF
+ MockRead(ASYNC, OK, 0) // EOF
};
DeterministicSocketData socket_data(reads, arraysize(reads), nullptr, 0);
socket_factory_.AddSocketDataProvider(&socket_data);
@@ -349,7 +348,7 @@ TEST_P(QuicStreamFactoryTest, Create) {
/*cert_verify_flags=*/0, host_port_pair_.host(),
"GET", net_log_, callback_.callback()));
stream = request2.ReleaseStream(); // Will reset stream 5.
- stream.reset(); // Will reset stream 7.
+ stream.reset(); // Will reset stream 7.
EXPECT_TRUE(socket_data.AllReadDataConsumed());
EXPECT_TRUE(socket_data.AllWriteDataConsumed());
@@ -359,7 +358,7 @@ TEST_P(QuicStreamFactoryTest, CreateZeroRtt) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, OK, 0) // EOF
+ MockRead(ASYNC, OK, 0) // EOF
};
DeterministicSocketData socket_data(reads, arraysize(reads), nullptr, 0);
socket_factory_.AddSocketDataProvider(&socket_data);
@@ -386,7 +385,7 @@ TEST_P(QuicStreamFactoryTest, CreateZeroRttPost) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, OK, 0) // EOF
+ MockRead(ASYNC, OK, 0) // EOF
};
DeterministicSocketData socket_data(reads, arraysize(reads), nullptr, 0);
socket_factory_.AddSocketDataProvider(&socket_data);
@@ -486,7 +485,7 @@ TEST_P(QuicStreamFactoryTest, Pooling) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, OK, 0) // EOF
+ MockRead(ASYNC, OK, 0) // EOF
};
DeterministicSocketData socket_data(reads, arraysize(reads), nullptr, 0);
socket_factory_.AddSocketDataProvider(&socket_data);
@@ -494,10 +493,10 @@ TEST_P(QuicStreamFactoryTest, Pooling) {
HostPortPair server2("mail.google.com", kDefaultServerPort);
host_resolver_.set_synchronous_mode(true);
- host_resolver_.rules()->AddIPLiteralRule(
- kDefaultServerHostName, "192.168.0.1", "");
- host_resolver_.rules()->AddIPLiteralRule(
- "mail.google.com", "192.168.0.1", "");
+ host_resolver_.rules()->AddIPLiteralRule(kDefaultServerHostName,
+ "192.168.0.1", "");
+ host_resolver_.rules()->AddIPLiteralRule("mail.google.com", "192.168.0.1",
+ "");
QuicStreamRequest request(factory_.get());
EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_,
@@ -527,7 +526,7 @@ TEST_P(QuicStreamFactoryTest, NoPoolingIfDisabled) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, OK, 0) // EOF
+ MockRead(ASYNC, OK, 0) // EOF
};
DeterministicSocketData socket_data1(reads, arraysize(reads), nullptr, 0);
DeterministicSocketData socket_data2(reads, arraysize(reads), nullptr, 0);
@@ -538,10 +537,10 @@ TEST_P(QuicStreamFactoryTest, NoPoolingIfDisabled) {
HostPortPair server2("mail.google.com", kDefaultServerPort);
host_resolver_.set_synchronous_mode(true);
- host_resolver_.rules()->AddIPLiteralRule(
- kDefaultServerHostName, "192.168.0.1", "");
- host_resolver_.rules()->AddIPLiteralRule(
- "mail.google.com", "192.168.0.1", "");
+ host_resolver_.rules()->AddIPLiteralRule(kDefaultServerHostName,
+ "192.168.0.1", "");
+ host_resolver_.rules()->AddIPLiteralRule("mail.google.com", "192.168.0.1",
+ "");
QuicStreamRequest request(factory_.get());
EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_,
@@ -572,7 +571,7 @@ TEST_P(QuicStreamFactoryTest, NoPoolingAfterGoAway) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, OK, 0) // EOF
+ MockRead(ASYNC, OK, 0) // EOF
};
DeterministicSocketData socket_data1(reads, arraysize(reads), nullptr, 0);
DeterministicSocketData socket_data2(reads, arraysize(reads), nullptr, 0);
@@ -583,10 +582,10 @@ TEST_P(QuicStreamFactoryTest, NoPoolingAfterGoAway) {
HostPortPair server2("mail.google.com", kDefaultServerPort);
host_resolver_.set_synchronous_mode(true);
- host_resolver_.rules()->AddIPLiteralRule(
- kDefaultServerHostName, "192.168.0.1", "");
- host_resolver_.rules()->AddIPLiteralRule(
- "mail.google.com", "192.168.0.1", "");
+ host_resolver_.rules()->AddIPLiteralRule(kDefaultServerHostName,
+ "192.168.0.1", "");
+ host_resolver_.rules()->AddIPLiteralRule("mail.google.com", "192.168.0.1",
+ "");
QuicStreamRequest request(factory_.get());
EXPECT_EQ(OK, request.Request(host_port_pair_, privacy_mode_,
@@ -629,7 +628,7 @@ TEST_P(QuicStreamFactoryTest, NoPoolingAfterGoAway) {
TEST_P(QuicStreamFactoryTest, HttpsPooling) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, OK, 0) // EOF
+ MockRead(ASYNC, OK, 0) // EOF
};
DeterministicSocketData socket_data(reads, arraysize(reads), nullptr, 0);
socket_factory_.AddSocketDataProvider(&socket_data);
@@ -672,7 +671,7 @@ TEST_P(QuicStreamFactoryTest, NoHttpsPoolingIfDisabled) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, OK, 0) // EOF
+ MockRead(ASYNC, OK, 0) // EOF
};
DeterministicSocketData socket_data1(reads, arraysize(reads), nullptr, 0);
DeterministicSocketData socket_data2(reads, arraysize(reads), nullptr, 0);
@@ -792,7 +791,7 @@ TEST_P(QuicAlternativeServiceCertificateValidationPooling, Invalid) {
TEST_P(QuicStreamFactoryTest, HttpsPoolingWithMatchingPins) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, OK, 0) // EOF
+ MockRead(ASYNC, OK, 0) // EOF
};
DeterministicSocketData socket_data(reads, arraysize(reads), nullptr, 0);
socket_factory_.AddSocketDataProvider(&socket_data);
@@ -841,7 +840,7 @@ TEST_P(QuicStreamFactoryTest, NoHttpsPoolingWithMatchingPinsIfDisabled) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, OK, 0) // EOF
+ MockRead(ASYNC, OK, 0) // EOF
};
DeterministicSocketData socket_data1(reads, arraysize(reads), nullptr, 0);
DeterministicSocketData socket_data2(reads, arraysize(reads), nullptr, 0);
@@ -893,7 +892,7 @@ TEST_P(QuicStreamFactoryTest, NoHttpsPoolingWithMatchingPinsIfDisabled) {
TEST_P(QuicStreamFactoryTest, NoHttpsPoolingWithDifferentPins) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, OK, 0) // EOF
+ MockRead(ASYNC, OK, 0) // EOF
};
DeterministicSocketData socket_data1(reads, arraysize(reads), nullptr, 0);
DeterministicSocketData socket_data2(reads, arraysize(reads), nullptr, 0);
@@ -951,7 +950,7 @@ TEST_P(QuicStreamFactoryTest, NoHttpsPoolingWithDifferentPins) {
TEST_P(QuicStreamFactoryTest, Goaway) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, OK, 0) // EOF
+ MockRead(ASYNC, OK, 0) // EOF
};
DeterministicSocketData socket_data(reads, arraysize(reads), nullptr, 0);
socket_data.StopAfter(1);
@@ -1022,8 +1021,8 @@ TEST_P(QuicStreamFactoryTest, MaxOpenStream) {
MockRead(ASYNC, server_rst->data(), server_rst->length(), 1),
MockRead(ASYNC, OK, 2) // EOF
};
- DeterministicSocketData socket_data(reads, arraysize(reads),
- writes, arraysize(writes));
+ DeterministicSocketData socket_data(reads, arraysize(reads), writes,
+ arraysize(writes));
socket_factory_.AddSocketDataProvider(&socket_data);
socket_data.StopAfter(2);
@@ -1044,8 +1043,8 @@ TEST_P(QuicStreamFactoryTest, MaxOpenStream) {
}
scoped_ptr<QuicHttpStream> stream = request.ReleaseStream();
EXPECT_TRUE(stream);
- EXPECT_EQ(OK, stream->InitializeStream(
- &request_info, DEFAULT_PRIORITY, net_log_, CompletionCallback()));
+ EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY,
+ net_log_, CompletionCallback()));
streams.push_back(stream.release());
}
@@ -1055,8 +1054,9 @@ TEST_P(QuicStreamFactoryTest, MaxOpenStream) {
"GET", net_log_, CompletionCallback()));
scoped_ptr<QuicHttpStream> stream = request.ReleaseStream();
EXPECT_TRUE(stream);
- EXPECT_EQ(ERR_IO_PENDING, stream->InitializeStream(
- &request_info, DEFAULT_PRIORITY, net_log_, callback_.callback()));
+ EXPECT_EQ(ERR_IO_PENDING,
+ stream->InitializeStream(&request_info, DEFAULT_PRIORITY, net_log_,
+ callback_.callback()));
// Close the first stream.
streams.front()->Close(false);
@@ -1122,7 +1122,7 @@ TEST_P(QuicStreamFactoryTest, ConnectErrorInCreate) {
TEST_P(QuicStreamFactoryTest, CancelCreate) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, OK, 0) // EOF
+ MockRead(ASYNC, OK, 0) // EOF
};
DeterministicSocketData socket_data(reads, arraysize(reads), nullptr, 0);
socket_factory_.AddSocketDataProvider(&socket_data);
@@ -1166,8 +1166,7 @@ TEST_P(QuicStreamFactoryTest, GoAwayDisablesConsistentEphemeralPort) {
Initialize();
// Get a session to the host using the port suggester.
- int original_port =
- GetSourcePortForNewSessionAndGoAway(host_port_pair_);
+ int original_port = GetSourcePortForNewSessionAndGoAway(host_port_pair_);
// Verify that the port is different after the goaway.
EXPECT_NE(original_port, GetSourcePortForNewSession(host_port_pair_));
// Since the previous session did not goaway we should see the original port.
@@ -1177,19 +1176,19 @@ TEST_P(QuicStreamFactoryTest, GoAwayDisablesConsistentEphemeralPort) {
TEST_P(QuicStreamFactoryTest, CloseAllSessions) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, 0, 0) // EOF
+ MockRead(ASYNC, 0, 0) // EOF
};
scoped_ptr<QuicEncryptedPacket> rst(ConstructRstPacket());
std::vector<MockWrite> writes;
writes.push_back(MockWrite(ASYNC, rst->data(), rst->length(), 1));
DeterministicSocketData socket_data(reads, arraysize(reads),
- writes.empty() ? nullptr : &writes[0],
+ writes.empty() ? nullptr : &writes[0],
writes.size());
socket_factory_.AddSocketDataProvider(&socket_data);
socket_data.StopAfter(1);
MockRead reads2[] = {
- MockRead(ASYNC, 0, 0) // EOF
+ MockRead(ASYNC, 0, 0) // EOF
};
DeterministicSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0);
socket_factory_.AddSocketDataProvider(&socket_data2);
@@ -1204,8 +1203,7 @@ TEST_P(QuicStreamFactoryTest, CloseAllSessions) {
EXPECT_EQ(OK, callback_.WaitForResult());
scoped_ptr<QuicHttpStream> stream = request.ReleaseStream();
HttpRequestInfo request_info;
- EXPECT_EQ(OK, stream->InitializeStream(&request_info,
- DEFAULT_PRIORITY,
+ EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY,
net_log_, CompletionCallback()));
// Close the session and verify that stream saw the error.
@@ -1237,19 +1235,19 @@ TEST_P(QuicStreamFactoryTest, OnIPAddressChanged) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, 0, 0) // EOF
+ MockRead(ASYNC, 0, 0) // EOF
};
scoped_ptr<QuicEncryptedPacket> rst(ConstructRstPacket());
std::vector<MockWrite> writes;
writes.push_back(MockWrite(ASYNC, rst->data(), rst->length(), 1));
DeterministicSocketData socket_data(reads, arraysize(reads),
- writes.empty() ? nullptr : &writes[0],
+ writes.empty() ? nullptr : &writes[0],
writes.size());
socket_factory_.AddSocketDataProvider(&socket_data);
socket_data.StopAfter(1);
MockRead reads2[] = {
- MockRead(ASYNC, 0, 0) // EOF
+ MockRead(ASYNC, 0, 0) // EOF
};
DeterministicSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0);
socket_factory_.AddSocketDataProvider(&socket_data2);
@@ -1264,8 +1262,7 @@ TEST_P(QuicStreamFactoryTest, OnIPAddressChanged) {
EXPECT_EQ(OK, callback_.WaitForResult());
scoped_ptr<QuicHttpStream> stream = request.ReleaseStream();
HttpRequestInfo request_info;
- EXPECT_EQ(OK, stream->InitializeStream(&request_info,
- DEFAULT_PRIORITY,
+ EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY,
net_log_, CompletionCallback()));
// Change the IP address and verify that stream saw the error.
@@ -1353,19 +1350,19 @@ TEST_P(QuicStreamFactoryTest, OnSSLConfigChanged) {
TEST_P(QuicStreamFactoryTest, OnCertAdded) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, 0, 0) // EOF
+ MockRead(ASYNC, 0, 0) // EOF
};
scoped_ptr<QuicEncryptedPacket> rst(ConstructRstPacket());
std::vector<MockWrite> writes;
writes.push_back(MockWrite(ASYNC, rst->data(), rst->length(), 1));
DeterministicSocketData socket_data(reads, arraysize(reads),
- writes.empty() ? nullptr : &writes[0],
+ writes.empty() ? nullptr : &writes[0],
writes.size());
socket_factory_.AddSocketDataProvider(&socket_data);
socket_data.StopAfter(1);
MockRead reads2[] = {
- MockRead(ASYNC, 0, 0) // EOF
+ MockRead(ASYNC, 0, 0) // EOF
};
DeterministicSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0);
socket_factory_.AddSocketDataProvider(&socket_data2);
@@ -1380,8 +1377,7 @@ TEST_P(QuicStreamFactoryTest, OnCertAdded) {
EXPECT_EQ(OK, callback_.WaitForResult());
scoped_ptr<QuicHttpStream> stream = request.ReleaseStream();
HttpRequestInfo request_info;
- EXPECT_EQ(OK, stream->InitializeStream(&request_info,
- DEFAULT_PRIORITY,
+ EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY,
net_log_, CompletionCallback()));
// Add a cert and verify that stream saw the event.
@@ -1412,19 +1408,19 @@ TEST_P(QuicStreamFactoryTest, OnCertAdded) {
TEST_P(QuicStreamFactoryTest, OnCACertChanged) {
Initialize();
MockRead reads[] = {
- MockRead(ASYNC, 0, 0) // EOF
+ MockRead(ASYNC, 0, 0) // EOF
};
scoped_ptr<QuicEncryptedPacket> rst(ConstructRstPacket());
std::vector<MockWrite> writes;
writes.push_back(MockWrite(ASYNC, rst->data(), rst->length(), 1));
DeterministicSocketData socket_data(reads, arraysize(reads),
- writes.empty() ? nullptr : &writes[0],
+ writes.empty() ? nullptr : &writes[0],
writes.size());
socket_factory_.AddSocketDataProvider(&socket_data);
socket_data.StopAfter(1);
MockRead reads2[] = {
- MockRead(ASYNC, 0, 0) // EOF
+ MockRead(ASYNC, 0, 0) // EOF
};
DeterministicSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0);
socket_factory_.AddSocketDataProvider(&socket_data2);
@@ -1439,8 +1435,7 @@ TEST_P(QuicStreamFactoryTest, OnCACertChanged) {
EXPECT_EQ(OK, callback_.WaitForResult());
scoped_ptr<QuicHttpStream> stream = request.ReleaseStream();
HttpRequestInfo request_info;
- EXPECT_EQ(OK, stream->InitializeStream(&request_info,
- DEFAULT_PRIORITY,
+ EXPECT_EQ(OK, stream->InitializeStream(&request_info, DEFAULT_PRIORITY,
net_log_, CompletionCallback()));
// Change the CA cert and verify that stream saw the event.
diff --git a/net/quic/quic_stream_sequencer_test.cc b/net/quic/quic_stream_sequencer_test.cc
index d2b2b61..3fb6bda 100644
--- a/net/quic/quic_stream_sequencer_test.cc
+++ b/net/quic/quic_stream_sequencer_test.cc
@@ -407,9 +407,7 @@ class QuicSequencerRandomTest : public QuicStreamSequencerTest {
}
}
- QuicSequencerRandomTest() {
- CreateFrames();
- }
+ QuicSequencerRandomTest() { CreateFrames(); }
int OneToN(int n) { return base::RandInt(1, n); }
diff --git a/net/quic/quic_sustained_bandwidth_recorder.h b/net/quic/quic_sustained_bandwidth_recorder.h
index 11685d28..1e6b43a 100644
--- a/net/quic/quic_sustained_bandwidth_recorder.h
+++ b/net/quic/quic_sustained_bandwidth_recorder.h
@@ -34,9 +34,7 @@ class NET_EXPORT_PRIVATE QuicSustainedBandwidthRecorder {
QuicWallTime wall_time,
QuicTime::Delta srtt);
- bool HasEstimate() const {
- return has_estimate_;
- }
+ bool HasEstimate() const { return has_estimate_; }
QuicBandwidth BandwidthEstimate() const {
DCHECK(has_estimate_);
diff --git a/net/quic/quic_time_test.cc b/net/quic/quic_time_test.cc
index a2e3550..602de36 100644
--- a/net/quic/quic_time_test.cc
+++ b/net/quic/quic_time_test.cc
@@ -77,15 +77,14 @@ class QuicTimeTest : public ::testing::Test {
TEST_F(QuicTimeTest, Initialized) {
EXPECT_FALSE(QuicTime::Zero().IsInitialized());
- EXPECT_TRUE(QuicTime::Zero().Add(
- QuicTime::Delta::FromMicroseconds(1)).IsInitialized());
+ EXPECT_TRUE(QuicTime::Zero()
+ .Add(QuicTime::Delta::FromMicroseconds(1))
+ .IsInitialized());
}
TEST_F(QuicTimeTest, Add) {
- QuicTime time_1 = QuicTime::Zero().Add(
- QuicTime::Delta::FromMilliseconds(1));
- QuicTime time_2 = QuicTime::Zero().Add(
- QuicTime::Delta::FromMilliseconds(2));
+ QuicTime time_1 = QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(1));
+ QuicTime time_2 = QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(2));
QuicTime::Delta diff = time_2.Subtract(time_1);
@@ -95,26 +94,21 @@ TEST_F(QuicTimeTest, Add) {
}
TEST_F(QuicTimeTest, Subtract) {
- QuicTime time_1 = QuicTime::Zero().Add(
- QuicTime::Delta::FromMilliseconds(1));
- QuicTime time_2 = QuicTime::Zero().Add(
- QuicTime::Delta::FromMilliseconds(2));
+ QuicTime time_1 = QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(1));
+ QuicTime time_2 = QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(2));
EXPECT_EQ(QuicTime::Delta::FromMilliseconds(1), time_2.Subtract(time_1));
}
TEST_F(QuicTimeTest, SubtractDelta) {
- QuicTime time = QuicTime::Zero().Add(
- QuicTime::Delta::FromMilliseconds(2));
+ QuicTime time = QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(2));
EXPECT_EQ(QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(1)),
time.Subtract(QuicTime::Delta::FromMilliseconds(1)));
}
TEST_F(QuicTimeTest, Max) {
- QuicTime time_1 = QuicTime::Zero().Add(
- QuicTime::Delta::FromMilliseconds(1));
- QuicTime time_2 = QuicTime::Zero().Add(
- QuicTime::Delta::FromMilliseconds(2));
+ QuicTime time_1 = QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(1));
+ QuicTime time_2 = QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(2));
EXPECT_EQ(time_2, QuicTime::Max(time_1, time_2));
}
@@ -138,7 +132,7 @@ TEST_F(QuicTimeTest, MockClock) {
TEST_F(QuicTimeTest, LE) {
const QuicTime zero = QuicTime::Zero();
- const QuicTime one = zero.Add(QuicTime::Delta::FromSeconds(1));
+ const QuicTime one = zero.Add(QuicTime::Delta::FromSeconds(1));
EXPECT_TRUE(zero <= zero);
EXPECT_TRUE(zero <= one);
EXPECT_TRUE(one <= one);
diff --git a/net/quic/quic_types.cc b/net/quic/quic_types.cc
index cdfb36d..3b982f1 100644
--- a/net/quic/quic_types.cc
+++ b/net/quic/quic_types.cc
@@ -8,11 +8,8 @@ using std::ostream;
namespace net {
-QuicConsumedData::QuicConsumedData(size_t bytes_consumed,
- bool fin_consumed)
- : bytes_consumed(bytes_consumed),
- fin_consumed(fin_consumed) {
-}
+QuicConsumedData::QuicConsumedData(size_t bytes_consumed, bool fin_consumed)
+ : bytes_consumed(bytes_consumed), fin_consumed(fin_consumed) {}
ostream& operator<<(ostream& os, const QuicConsumedData& s) {
os << "bytes_consumed: " << s.bytes_consumed
@@ -20,15 +17,9 @@ ostream& operator<<(ostream& os, const QuicConsumedData& s) {
return os;
}
-WriteResult::WriteResult()
- : status(WRITE_STATUS_ERROR),
- bytes_written(0) {
-}
+WriteResult::WriteResult() : status(WRITE_STATUS_ERROR), bytes_written(0) {}
-WriteResult::WriteResult(WriteStatus status,
- int bytes_written_or_error_code)
- : status(status),
- bytes_written(bytes_written_or_error_code) {
-}
+WriteResult::WriteResult(WriteStatus status, int bytes_written_or_error_code)
+ : status(status), bytes_written(bytes_written_or_error_code) {}
} // namespace net
diff --git a/net/quic/quic_types.h b/net/quic/quic_types.h
index 01415bc3..2854a17 100644
--- a/net/quic/quic_types.h
+++ b/net/quic/quic_types.h
@@ -24,8 +24,8 @@ struct NET_EXPORT_PRIVATE QuicConsumedData {
// member causes this object to have padding bytes, which causes the
// default gtest object printer to read uninitialize memory. So we need
// to teach gtest how to print this object.
- NET_EXPORT_PRIVATE friend std::ostream& operator<<(
- std::ostream& os, const QuicConsumedData& s);
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os,
+ const QuicConsumedData& s);
// How many bytes were consumed.
size_t bytes_consumed;
@@ -60,7 +60,7 @@ struct NET_EXPORT_PRIVATE WriteResult {
WriteStatus status;
union {
int bytes_written; // only valid when status is WRITE_STATUS_OK
- int error_code; // only valid when status is WRITE_STATUS_ERROR
+ int error_code; // only valid when status is WRITE_STATUS_ERROR
};
};
diff --git a/net/quic/quic_unacked_packet_map.cc b/net/quic/quic_unacked_packet_map.cc
index be3e8ee..ae0e0ed 100644
--- a/net/quic/quic_unacked_packet_map.cc
+++ b/net/quic/quic_unacked_packet_map.cc
@@ -397,8 +397,8 @@ bool QuicUnackedPacketMap::HasPendingCryptoPackets() const {
}
bool QuicUnackedPacketMap::HasUnackedRetransmittableFrames() const {
- for (UnackedPacketMap::const_reverse_iterator it =
- unacked_packets_.rbegin(); it != unacked_packets_.rend(); ++it) {
+ for (UnackedPacketMap::const_reverse_iterator it = unacked_packets_.rbegin();
+ it != unacked_packets_.rend(); ++it) {
if (it->in_flight && it->retransmittable_frames) {
return true;
}
diff --git a/net/quic/quic_unacked_packet_map.h b/net/quic/quic_unacked_packet_map.h
index 1c33fb1..1622264 100644
--- a/net/quic/quic_unacked_packet_map.h
+++ b/net/quic/quic_unacked_packet_map.h
@@ -87,9 +87,7 @@ class NET_EXPORT_PRIVATE QuicUnackedPacketMap {
}
// Returns the sum of bytes from all packets in flight.
- QuicByteCount bytes_in_flight() const {
- return bytes_in_flight_;
- }
+ QuicByteCount bytes_in_flight() const { return bytes_in_flight_; }
// Returns the smallest packet number of a serialized packet which has not
// been acked by the peer. If there are no unacked packets, returns 0.
diff --git a/net/quic/quic_unacked_packet_map_test.cc b/net/quic/quic_unacked_packet_map_test.cc
index adbca84..b58a16d 100644
--- a/net/quic/quic_unacked_packet_map_test.cc
+++ b/net/quic/quic_unacked_packet_map_test.cc
@@ -27,9 +27,7 @@ class QuicUnackedPacketMapTest : public ::testing::Test {
: unacked_packets_(),
now_(QuicTime::Zero().Add(QuicTime::Delta::FromMilliseconds(1000))) {}
- ~QuicUnackedPacketMapTest() override {
- STLDeleteElements(&packets_);
- }
+ ~QuicUnackedPacketMapTest() override { STLDeleteElements(&packets_); }
SerializedPacket CreateRetransmittablePacket(QuicPacketNumber packet_number) {
packets_.push_back(new QuicEncryptedPacket(nullptr, kDefaultLength));
diff --git a/net/quic/quic_utils.cc b/net/quic/quic_utils.cc
index 9d0d0ebd..57c4adc 100644
--- a/net/quic/quic_utils.cc
+++ b/net/quic/quic_utils.cc
@@ -13,9 +13,9 @@
#include "base/basictypes.h"
#include "base/containers/adapters.h"
#include "base/logging.h"
-#include "base/strings/stringprintf.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
+#include "base/strings/stringprintf.h"
#include "net/quic/quic_write_blocked_list.h"
using base::StringPiece;
@@ -69,7 +69,7 @@ uint128 QuicUtils::IncrementalHash(uint128 hash, const char* data, size_t len) {
const uint128 kPrime(16777216, 315);
const uint8* octets = reinterpret_cast<const uint8*>(data);
for (size_t i = 0; i < len; ++i) {
- hash = hash ^ uint128(0, octets[i]);
+ hash = hash ^ uint128(0, octets[i]);
hash = hash * kPrime;
}
return hash;
@@ -132,8 +132,8 @@ void QuicUtils::SerializeUint128Short(uint128 v, uint8* out) {
}
#define RETURN_STRING_LITERAL(x) \
-case x: \
-return #x;
+ case x: \
+ return #x;
// static
const char* QuicUtils::StreamErrorToString(QuicRstStreamErrorCode error) {
@@ -313,10 +313,10 @@ QuicTagVector QuicUtils::ParseQuicConnectionOptions(
// static
string QuicUtils::StringToHexASCIIDump(StringPiece in_buffer) {
int offset = 0;
- const int kBytesPerLine = 16; // Max bytes dumped per line
+ const int kBytesPerLine = 16; // Max bytes dumped per line
const char* buf = in_buffer.data();
int bytes_remaining = in_buffer.size();
- string s; // our output
+ string s; // our output
const char* p = buf;
while (bytes_remaining > 0) {
const int line_bytes = std::min(bytes_remaining, kBytesPerLine);
@@ -325,13 +325,14 @@ string QuicUtils::StringToHexASCIIDump(StringPiece in_buffer) {
if (i < line_bytes) {
base::StringAppendF(&s, "%02x", static_cast<unsigned char>(p[i]));
} else {
- s += " "; // two-space filler instead of two-space hex digits
+ s += " "; // two-space filler instead of two-space hex digits
}
- if (i % 2) s += ' ';
+ if (i % 2)
+ s += ' ';
}
s += ' ';
for (int i = 0; i < line_bytes; ++i) { // Do the ASCII dump
- s+= (p[i] > 32 && p[i] < 127) ? p[i] : '.';
+ s += (p[i] > 32 && p[i] < 127) ? p[i] : '.';
}
bytes_remaining -= line_bytes;
diff --git a/net/quic/quic_utils_chromium.h b/net/quic/quic_utils_chromium.h
index 0229d1d..037d54d 100644
--- a/net/quic/quic_utils_chromium.h
+++ b/net/quic/quic_utils_chromium.h
@@ -32,9 +32,9 @@ namespace net {
// This version assumes the key is printable, and includes it in the fatal log
// message.
template <class Collection>
-const typename Collection::value_type::second_type&
-FindOrDie(const Collection& collection,
- const typename Collection::value_type::first_type& key) {
+const typename Collection::value_type::second_type& FindOrDie(
+ const Collection& collection,
+ const typename Collection::value_type::first_type& key) {
typename Collection::const_iterator it = collection.find(key);
CHECK(it != collection.end()) << "Map key not found: " << key;
return it->second;
@@ -42,9 +42,9 @@ FindOrDie(const Collection& collection,
// Same as above, but returns a non-const reference.
template <class Collection>
-typename Collection::value_type::second_type&
-FindOrDie(Collection& collection, // NOLINT
- const typename Collection::value_type::first_type& key) {
+typename Collection::value_type::second_type& FindOrDie(
+ Collection& collection, // NOLINT
+ const typename Collection::value_type::first_type& key) {
typename Collection::iterator it = collection.find(key);
CHECK(it != collection.end()) << "Map key not found: " << key;
return it->second;
@@ -53,9 +53,9 @@ FindOrDie(Collection& collection, // NOLINT
// Returns a pointer to the const value associated with the given key if it
// exists, or NULL otherwise.
template <class Collection>
-const typename Collection::value_type::second_type*
-FindOrNull(const Collection& collection,
- const typename Collection::value_type::first_type& key) {
+const typename Collection::value_type::second_type* FindOrNull(
+ const Collection& collection,
+ const typename Collection::value_type::first_type& key) {
typename Collection::const_iterator it = collection.find(key);
if (it == collection.end()) {
return 0;
@@ -65,9 +65,9 @@ FindOrNull(const Collection& collection,
// Same as above but returns a pointer to the non-const value.
template <class Collection>
-typename Collection::value_type::second_type*
-FindOrNull(Collection& collection, // NOLINT
- const typename Collection::value_type::first_type& key) {
+typename Collection::value_type::second_type* FindOrNull(
+ Collection& collection, // NOLINT
+ const typename Collection::value_type::first_type& key) {
typename Collection::iterator it = collection.find(key);
if (it == collection.end()) {
return 0;
diff --git a/net/quic/quic_utils_test.cc b/net/quic/quic_utils_test.cc
index 1a3a1e5..4108bd7 100644
--- a/net/quic/quic_utils_test.cc
+++ b/net/quic/quic_utils_test.cc
@@ -16,18 +16,15 @@ namespace {
// A test string and a hex+ASCII dump of the same string.
const unsigned char kString[] = {
- 0x00, 0x90, 0x69, 0xbd, 0x54, 0x00, 0x00, 0x0d,
- 0x61, 0x0f, 0x01, 0x89, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x1c, 0xfb, 0x98, 0x40, 0x00, 0x40, 0x01,
- 0x7e, 0x18, 0xd8, 0xef, 0x23, 0x01, 0x45, 0x5d,
- 0x7f, 0xe2, 0x08, 0x00, 0x6b, 0xcb, 0x0b, 0xc6,
- 0x80, 0x6e
-};
+ 0x00, 0x90, 0x69, 0xbd, 0x54, 0x00, 0x00, 0x0d, 0x61, 0x0f, 0x01,
+ 0x89, 0x08, 0x00, 0x45, 0x00, 0x00, 0x1c, 0xfb, 0x98, 0x40, 0x00,
+ 0x40, 0x01, 0x7e, 0x18, 0xd8, 0xef, 0x23, 0x01, 0x45, 0x5d, 0x7f,
+ 0xe2, 0x08, 0x00, 0x6b, 0xcb, 0x0b, 0xc6, 0x80, 0x6e};
const unsigned char kHexDump[] =
-"0x0000: 0090 69bd 5400 000d 610f 0189 0800 4500 ..i.T...a.....E.\n"
-"0x0010: 001c fb98 4000 4001 7e18 d8ef 2301 455d ....@.@.~...#.E]\n"
-"0x0020: 7fe2 0800 6bcb 0bc6 806e ....k....n\n";
+ "0x0000: 0090 69bd 5400 000d 610f 0189 0800 4500 ..i.T...a.....E.\n"
+ "0x0010: 001c fb98 4000 4001 7e18 d8ef 2301 455d ....@.@.~...#.E]\n"
+ "0x0020: 7fe2 0800 6bcb 0bc6 806e ....k....n\n";
TEST(QuicUtilsTest, StreamErrorToString) {
EXPECT_STREQ("QUIC_BAD_APPLICATION_PAYLOAD",
@@ -35,8 +32,7 @@ TEST(QuicUtilsTest, StreamErrorToString) {
}
TEST(QuicUtilsTest, ErrorToString) {
- EXPECT_STREQ("QUIC_NO_ERROR",
- QuicUtils::ErrorToString(QUIC_NO_ERROR));
+ EXPECT_STREQ("QUIC_NO_ERROR", QuicUtils::ErrorToString(QUIC_NO_ERROR));
}
TEST(QuicUtilsTest, StringToHexASCIIDumpArgTypes) {
@@ -45,12 +41,22 @@ TEST(QuicUtilsTest, StringToHexASCIIDumpArgTypes) {
const string input;
const string expected;
} tests[] = {
- { "", "", },
- { "A", "0x0000: 41 A\n", },
- { "AB", "0x0000: 4142 AB\n", },
- { "ABC", "0x0000: 4142 43 ABC\n", },
- { "original",
- "0x0000: 6f72 6967 696e 616c original\n", },
+ {
+ "", "",
+ },
+ {
+ "A", "0x0000: 41 A\n",
+ },
+ {
+ "AB", "0x0000: 4142 AB\n",
+ },
+ {
+ "ABC", "0x0000: 4142 43 ABC\n",
+ },
+ {
+ "original",
+ "0x0000: 6f72 6967 696e 616c original\n",
+ },
};
for (size_t i = 0; i < arraysize(tests); ++i) {
@@ -65,19 +71,15 @@ TEST(QuicUtilsTest, StringToHexASCIIDumpArgTypes) {
TEST(QuicUtilsTest, StringToHexASCIIDumpSuccess) {
EXPECT_EQ(string(reinterpret_cast<const char*>(kHexDump)),
- QuicUtils::StringToHexASCIIDump(
- string(reinterpret_cast<const char*>(kString), sizeof(kString))));
+ QuicUtils::StringToHexASCIIDump(string(
+ reinterpret_cast<const char*>(kString), sizeof(kString))));
}
TEST(QuicUtilsTest, TagToString) {
- EXPECT_EQ("SCFG",
- QuicUtils::TagToString(kSCFG));
- EXPECT_EQ("SNO ",
- QuicUtils::TagToString(kServerNonceTag));
- EXPECT_EQ("CRT ",
- QuicUtils::TagToString(kCertificateTag));
- EXPECT_EQ("CHLO",
- QuicUtils::TagToString(MakeQuicTag('C', 'H', 'L', 'O')));
+ EXPECT_EQ("SCFG", QuicUtils::TagToString(kSCFG));
+ EXPECT_EQ("SNO ", QuicUtils::TagToString(kServerNonceTag));
+ EXPECT_EQ("CRT ", QuicUtils::TagToString(kCertificateTag));
+ EXPECT_EQ("CHLO", QuicUtils::TagToString(MakeQuicTag('C', 'H', 'L', 'O')));
// A tag that contains a non-printing character will be printed as a decimal
// number.
EXPECT_EQ("525092931",
diff --git a/net/quic/quic_write_blocked_list.h b/net/quic/quic_write_blocked_list.h
index 869782e..5e24b80 100644
--- a/net/quic/quic_write_blocked_list.h
+++ b/net/quic/quic_write_blocked_list.h
@@ -197,5 +197,4 @@ class NET_EXPORT_PRIVATE QuicWriteBlockedList {
} // namespace net
-
#endif // NET_QUIC_QUIC_WRITE_BLOCKED_LIST_H_
diff --git a/net/quic/reliable_quic_stream.cc b/net/quic/reliable_quic_stream.cc
index 2682d5b..399581e 100644
--- a/net/quic/reliable_quic_stream.cc
+++ b/net/quic/reliable_quic_stream.cc
@@ -48,8 +48,7 @@ ReliableQuicStream::PendingData::PendingData(
QuicAckListenerInterface* ack_listener_in)
: data(data_in), offset(0), ack_listener(ack_listener_in) {}
-ReliableQuicStream::PendingData::~PendingData() {
-}
+ReliableQuicStream::PendingData::~PendingData() {}
ReliableQuicStream::ReliableQuicStream(QuicStreamId id, QuicSession* session)
: queued_data_bytes_(0),
@@ -80,8 +79,7 @@ ReliableQuicStream::ReliableQuicStream(QuicStreamId id, QuicSession* session)
SetFromConfig();
}
-ReliableQuicStream::~ReliableQuicStream() {
-}
+ReliableQuicStream::~ReliableQuicStream() {}
void ReliableQuicStream::SetFromConfig() {
if (session_->config()->HasClientSentConnectionOption(kFSTR, perspective_)) {
diff --git a/net/quic/reliable_quic_stream.h b/net/quic/reliable_quic_stream.h
index 3ea970b..6040198 100644
--- a/net/quic/reliable_quic_stream.h
+++ b/net/quic/reliable_quic_stream.h
@@ -46,8 +46,7 @@ class QuicSession;
class NET_EXPORT_PRIVATE ReliableQuicStream {
public:
- ReliableQuicStream(QuicStreamId id,
- QuicSession* session);
+ ReliableQuicStream(QuicStreamId id, QuicSession* session);
virtual ~ReliableQuicStream();
diff --git a/net/quic/reliable_quic_stream_test.cc b/net/quic/reliable_quic_stream_test.cc
index 6f72281..daedd30 100644
--- a/net/quic/reliable_quic_stream_test.cc
+++ b/net/quic/reliable_quic_stream_test.cc
@@ -45,9 +45,7 @@ const bool kShouldNotProcessData = false;
class TestStream : public ReliableQuicStream {
public:
- TestStream(QuicStreamId id,
- QuicSession* session,
- bool should_process_data)
+ TestStream(QuicStreamId id, QuicSession* session, bool should_process_data)
: ReliableQuicStream(id, session),
should_process_data_(should_process_data) {}
@@ -244,8 +242,8 @@ TEST_F(ReliableQuicStreamTest, WriteOrBufferData) {
PACKET_6BYTE_PACKET_NUMBER, 0u, NOT_IN_FEC_GROUP);
connection_->SetMaxPacketLength(length);
- EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)).WillOnce(
- Return(QuicConsumedData(kDataLen - 1, false)));
+ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
+ .WillOnce(Return(QuicConsumedData(kDataLen - 1, false)));
stream_->WriteOrBufferData(kData1, false, nullptr);
EXPECT_TRUE(HasWriteBlockedStreams());
@@ -254,15 +252,15 @@ TEST_F(ReliableQuicStreamTest, WriteOrBufferData) {
// Make sure we get the tail of the first write followed by the bytes_consumed
InSequence s;
- EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)).
- WillOnce(Return(QuicConsumedData(1, false)));
- EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)).
- WillOnce(Return(QuicConsumedData(kDataLen - 2, false)));
+ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
+ .WillOnce(Return(QuicConsumedData(1, false)));
+ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
+ .WillOnce(Return(QuicConsumedData(kDataLen - 2, false)));
stream_->OnCanWrite();
// And finally the end of the bytes_consumed.
- EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _)).
- WillOnce(Return(QuicConsumedData(2, true)));
+ EXPECT_CALL(*session_, WritevData(_, _, _, _, _, _))
+ .WillOnce(Return(QuicConsumedData(2, true)));
stream_->OnCanWrite();
}
@@ -279,8 +277,8 @@ TEST_F(ReliableQuicStreamTest, WriteOrBufferDataWithFecProtectAlways) {
connection_->SetMaxPacketLength(length);
// Write first data onto stream, which will cause one session write.
- EXPECT_CALL(*session_, WritevData(_, _, _, _, MUST_FEC_PROTECT, _)).WillOnce(
- Return(QuicConsumedData(kDataLen - 1, false)));
+ EXPECT_CALL(*session_, WritevData(_, _, _, _, MUST_FEC_PROTECT, _))
+ .WillOnce(Return(QuicConsumedData(kDataLen - 1, false)));
stream_->WriteOrBufferData(kData1, false, nullptr);
EXPECT_TRUE(HasWriteBlockedStreams());
@@ -289,15 +287,15 @@ TEST_F(ReliableQuicStreamTest, WriteOrBufferDataWithFecProtectAlways) {
// Make sure we get the tail of the first write followed by the bytes_consumed
InSequence s;
- EXPECT_CALL(*session_, WritevData(_, _, _, _, MUST_FEC_PROTECT, _)).
- WillOnce(Return(QuicConsumedData(1, false)));
- EXPECT_CALL(*session_, WritevData(_, _, _, _, MUST_FEC_PROTECT, _)).
- WillOnce(Return(QuicConsumedData(kDataLen - 2, false)));
+ EXPECT_CALL(*session_, WritevData(_, _, _, _, MUST_FEC_PROTECT, _))
+ .WillOnce(Return(QuicConsumedData(1, false)));
+ EXPECT_CALL(*session_, WritevData(_, _, _, _, MUST_FEC_PROTECT, _))
+ .WillOnce(Return(QuicConsumedData(kDataLen - 2, false)));
stream_->OnCanWrite();
// And finally the end of the bytes_consumed.
- EXPECT_CALL(*session_, WritevData(_, _, _, _, MUST_FEC_PROTECT, _)).
- WillOnce(Return(QuicConsumedData(2, true)));
+ EXPECT_CALL(*session_, WritevData(_, _, _, _, MUST_FEC_PROTECT, _))
+ .WillOnce(Return(QuicConsumedData(2, true)));
stream_->OnCanWrite();
}
@@ -314,8 +312,8 @@ TEST_F(ReliableQuicStreamTest, WriteOrBufferDataWithFecProtectOptional) {
connection_->SetMaxPacketLength(length);
// Write first data onto stream, which will cause one session write.
- EXPECT_CALL(*session_, WritevData(_, _, _, _, MAY_FEC_PROTECT, _)).WillOnce(
- Return(QuicConsumedData(kDataLen - 1, false)));
+ EXPECT_CALL(*session_, WritevData(_, _, _, _, MAY_FEC_PROTECT, _))
+ .WillOnce(Return(QuicConsumedData(kDataLen - 1, false)));
stream_->WriteOrBufferData(kData1, false, nullptr);
EXPECT_TRUE(HasWriteBlockedStreams());
@@ -324,15 +322,15 @@ TEST_F(ReliableQuicStreamTest, WriteOrBufferDataWithFecProtectOptional) {
// Make sure we get the tail of the first write followed by the bytes_consumed
InSequence s;
- EXPECT_CALL(*session_, WritevData(_, _, _, _, MAY_FEC_PROTECT, _)).
- WillOnce(Return(QuicConsumedData(1, false)));
- EXPECT_CALL(*session_, WritevData(_, _, _, _, MAY_FEC_PROTECT, _)).
- WillOnce(Return(QuicConsumedData(kDataLen - 2, false)));
+ EXPECT_CALL(*session_, WritevData(_, _, _, _, MAY_FEC_PROTECT, _))
+ .WillOnce(Return(QuicConsumedData(1, false)));
+ EXPECT_CALL(*session_, WritevData(_, _, _, _, MAY_FEC_PROTECT, _))
+ .WillOnce(Return(QuicConsumedData(kDataLen - 2, false)));
stream_->OnCanWrite();
// And finally the end of the bytes_consumed.
- EXPECT_CALL(*session_, WritevData(_, _, _, _, MAY_FEC_PROTECT, _)).
- WillOnce(Return(QuicConsumedData(2, true)));
+ EXPECT_CALL(*session_, WritevData(_, _, _, _, MAY_FEC_PROTECT, _))
+ .WillOnce(Return(QuicConsumedData(2, true)));
stream_->OnCanWrite();
}
diff --git a/net/quic/test_tools/crypto_test_utils.cc b/net/quic/test_tools/crypto_test_utils.cc
index 5f3b728..de4360e 100644
--- a/net/quic/test_tools/crypto_test_utils.cc
+++ b/net/quic/test_tools/crypto_test_utils.cc
@@ -35,9 +35,7 @@ namespace {
// CryptoFramerVisitor is a framer visitor that records handshake messages.
class CryptoFramerVisitor : public CryptoFramerVisitorInterface {
public:
- CryptoFramerVisitor()
- : error_(false) {
- }
+ CryptoFramerVisitor() : error_(false) {}
void OnError(CryptoFramer* framer) override { error_ = true; }
@@ -45,13 +43,9 @@ class CryptoFramerVisitor : public CryptoFramerVisitorInterface {
messages_.push_back(message);
}
- bool error() const {
- return error_;
- }
+ bool error() const { return error_; }
- const vector<CryptoHandshakeMessage>& messages() const {
- return messages_;
- }
+ const vector<CryptoHandshakeMessage>& messages() const { return messages_; }
private:
bool error_;
@@ -173,7 +167,6 @@ int CryptoTestUtils::HandshakeWithFakeClient(
QuicCryptoClientConfig crypto_config(ProofVerifierForTesting());
AsyncTestChannelIDSource* async_channel_id_source = nullptr;
if (options.channel_id_enabled) {
-
ChannelIDSource* source = ChannelIDSourceForTesting();
if (options.channel_id_source_async) {
async_channel_id_source = new AsyncTestChannelIDSource(source);
@@ -296,10 +289,7 @@ string CryptoTestUtils::GetValueForTag(const CryptoHandshakeMessage& message,
class MockCommonCertSets : public CommonCertSets {
public:
MockCommonCertSets(StringPiece cert, uint64 hash, uint32 index)
- : cert_(cert.as_string()),
- hash_(hash),
- index_(index) {
- }
+ : cert_(cert.as_string()), hash_(hash), index_(index) {}
StringPiece GetCommonHashes() const override {
CHECK(false) << "not implemented";
@@ -443,38 +433,31 @@ void CryptoTestUtils::CompareClientAndServerKeys(
StringPiece server_subkey_secret =
server->crypto_negotiated_params().subkey_secret;
-
const char kSampleLabel[] = "label";
const char kSampleContext[] = "context";
const size_t kSampleOutputLength = 32;
string client_key_extraction;
string server_key_extraction;
- EXPECT_TRUE(client->ExportKeyingMaterial(kSampleLabel,
- kSampleContext,
+ EXPECT_TRUE(client->ExportKeyingMaterial(kSampleLabel, kSampleContext,
kSampleOutputLength,
&client_key_extraction));
- EXPECT_TRUE(server->ExportKeyingMaterial(kSampleLabel,
- kSampleContext,
+ EXPECT_TRUE(server->ExportKeyingMaterial(kSampleLabel, kSampleContext,
kSampleOutputLength,
&server_key_extraction));
- CompareCharArraysWithHexError("client write key",
- client_encrypter_key.data(),
+ CompareCharArraysWithHexError("client write key", client_encrypter_key.data(),
client_encrypter_key.length(),
server_decrypter_key.data(),
server_decrypter_key.length());
- CompareCharArraysWithHexError("client write IV",
- client_encrypter_iv.data(),
+ CompareCharArraysWithHexError("client write IV", client_encrypter_iv.data(),
client_encrypter_iv.length(),
server_decrypter_iv.data(),
server_decrypter_iv.length());
- CompareCharArraysWithHexError("server write key",
- server_encrypter_key.data(),
+ CompareCharArraysWithHexError("server write key", server_encrypter_key.data(),
server_encrypter_key.length(),
client_decrypter_key.data(),
client_decrypter_key.length());
- CompareCharArraysWithHexError("server write IV",
- server_encrypter_iv.data(),
+ CompareCharArraysWithHexError("server write IV", server_encrypter_iv.data(),
server_encrypter_iv.length(),
client_decrypter_iv.data(),
client_decrypter_iv.length());
@@ -498,16 +481,14 @@ void CryptoTestUtils::CompareClientAndServerKeys(
server_forward_secure_encrypter_iv.length(),
client_forward_secure_decrypter_iv.data(),
client_forward_secure_decrypter_iv.length());
- CompareCharArraysWithHexError("subkey secret",
- client_subkey_secret.data(),
+ CompareCharArraysWithHexError("subkey secret", client_subkey_secret.data(),
client_subkey_secret.length(),
server_subkey_secret.data(),
server_subkey_secret.length());
- CompareCharArraysWithHexError("sample key extraction",
- client_key_extraction.data(),
- client_key_extraction.length(),
- server_key_extraction.data(),
- server_key_extraction.length());
+ CompareCharArraysWithHexError(
+ "sample key extraction", client_key_extraction.data(),
+ client_key_extraction.length(), server_key_extraction.data(),
+ server_key_extraction.length());
}
// static
@@ -518,7 +499,7 @@ QuicTag CryptoTestUtils::ParseTag(const char* tagstr) {
QuicTag tag = 0;
if (tagstr[0] == '#') {
- CHECK_EQ(static_cast<size_t>(1 + 2*4), len);
+ CHECK_EQ(static_cast<size_t>(1 + 2 * 4), len);
tagstr++;
for (size_t i = 0; i < 8; i++) {
@@ -579,18 +560,18 @@ CryptoHandshakeMessage CryptoTestUtils::Message(const char* message_tag, ...) {
len--;
CHECK_EQ(0u, len % 2);
- scoped_ptr<uint8[]> buf(new uint8[len/2]);
+ scoped_ptr<uint8[]> buf(new uint8[len / 2]);
- for (size_t i = 0; i < len/2; i++) {
+ for (size_t i = 0; i < len / 2; i++) {
uint8 v = 0;
- CHECK(HexChar(valuestr[i*2], &v));
+ CHECK(HexChar(valuestr[i * 2], &v));
buf[i] = v << 4;
- CHECK(HexChar(valuestr[i*2 + 1], &v));
+ CHECK(HexChar(valuestr[i * 2 + 1], &v));
buf[i] |= v;
}
msg.SetStringPiece(
- tag, StringPiece(reinterpret_cast<char*>(buf.get()), len/2));
+ tag, StringPiece(reinterpret_cast<char*>(buf.get()), len / 2));
continue;
}
diff --git a/net/quic/test_tools/crypto_test_utils_openssl.cc b/net/quic/test_tools/crypto_test_utils_openssl.cc
index 64d215d..a7f968d 100644
--- a/net/quic/test_tools/crypto_test_utils_openssl.cc
+++ b/net/quic/test_tools/crypto_test_utils_openssl.cc
@@ -69,8 +69,8 @@ class TestChannelIDKey : public ChannelIDKey {
return false;
}
- *out_signature = string(reinterpret_cast<char*>(signature.get()),
- kSignatureLength);
+ *out_signature =
+ string(reinterpret_cast<char*>(signature.get()), kSignatureLength);
return true;
}
diff --git a/net/quic/test_tools/delayed_verify_strike_register_client.cc b/net/quic/test_tools/delayed_verify_strike_register_client.cc
index b14a118..f971cac 100644
--- a/net/quic/test_tools/delayed_verify_strike_register_client.cc
+++ b/net/quic/test_tools/delayed_verify_strike_register_client.cc
@@ -17,10 +17,12 @@ DelayedVerifyStrikeRegisterClient::DelayedVerifyStrikeRegisterClient(
uint32 window_secs,
const uint8 orbit[8],
StrikeRegister::StartupType startup)
- : LocalStrikeRegisterClient(max_entries, current_time_external,
- window_secs, orbit, startup),
- delay_verifications_(false) {
-}
+ : LocalStrikeRegisterClient(max_entries,
+ current_time_external,
+ window_secs,
+ orbit,
+ startup),
+ delay_verifications_(false) {}
DelayedVerifyStrikeRegisterClient::~DelayedVerifyStrikeRegisterClient() {}
@@ -43,9 +45,10 @@ void DelayedVerifyStrikeRegisterClient::RunPendingVerifications() {
vector<VerifyArgs> pending;
pending_verifications_.swap(pending);
for (vector<VerifyArgs>::const_iterator it = pending.begin(),
- end = pending.end(); it != end; ++it) {
- LocalStrikeRegisterClient::VerifyNonceIsValidAndUnique(
- it->nonce, it->now, it->cb);
+ end = pending.end();
+ it != end; ++it) {
+ LocalStrikeRegisterClient::VerifyNonceIsValidAndUnique(it->nonce, it->now,
+ it->cb);
}
}
diff --git a/net/quic/test_tools/delayed_verify_strike_register_client.h b/net/quic/test_tools/delayed_verify_strike_register_client.h
index 6d5002b..33d13f8 100644
--- a/net/quic/test_tools/delayed_verify_strike_register_client.h
+++ b/net/quic/test_tools/delayed_verify_strike_register_client.h
@@ -30,9 +30,7 @@ class DelayedVerifyStrikeRegisterClient : public LocalStrikeRegisterClient {
ResultCallback* cb) override;
// Start queueing verifications instead of executing them immediately.
- void StartDelayingVerification() {
- delay_verifications_ = true;
- }
+ void StartDelayingVerification() { delay_verifications_ = true; }
// Number of verifications that are queued.
int PendingVerifications() const;
// Run all pending verifications.
@@ -43,10 +41,7 @@ class DelayedVerifyStrikeRegisterClient : public LocalStrikeRegisterClient {
VerifyArgs(base::StringPiece in_nonce,
QuicWallTime in_now,
ResultCallback* in_cb)
- : nonce(in_nonce.as_string()),
- now(in_now),
- cb(in_cb) {
- }
+ : nonce(in_nonce.as_string()), now(in_now), cb(in_cb) {}
std::string nonce;
QuicWallTime now;
diff --git a/net/quic/test_tools/mock_clock.cc b/net/quic/test_tools/mock_clock.cc
index 47f2380..63e088a 100644
--- a/net/quic/test_tools/mock_clock.cc
+++ b/net/quic/test_tools/mock_clock.cc
@@ -6,11 +6,9 @@
namespace net {
-MockClock::MockClock() : now_(QuicTime::Zero()) {
-}
+MockClock::MockClock() : now_(QuicTime::Zero()) {}
-MockClock::~MockClock() {
-}
+MockClock::~MockClock() {}
void MockClock::AdvanceTime(QuicTime::Delta delta) {
now_ = now_.Add(delta);
@@ -32,7 +30,7 @@ QuicWallTime MockClock::WallNow() const {
base::TimeTicks MockClock::NowInTicks() const {
base::TimeTicks ticks;
return ticks + base::TimeDelta::FromMicroseconds(
- now_.Subtract(QuicTime::Zero()).ToMicroseconds());
+ now_.Subtract(QuicTime::Zero()).ToMicroseconds());
}
} // namespace net
diff --git a/net/quic/test_tools/mock_crypto_client_stream.cc b/net/quic/test_tools/mock_crypto_client_stream.cc
index c54ccff..0b0b1d8 100644
--- a/net/quic/test_tools/mock_crypto_client_stream.cc
+++ b/net/quic/test_tools/mock_crypto_client_stream.cc
@@ -23,11 +23,9 @@ MockCryptoClientStream::MockCryptoClientStream(
const ProofVerifyDetails* proof_verify_details)
: QuicCryptoClientStream(server_id, session, verify_context, crypto_config),
handshake_mode_(handshake_mode),
- proof_verify_details_(proof_verify_details) {
-}
+ proof_verify_details_(proof_verify_details) {}
-MockCryptoClientStream::~MockCryptoClientStream() {
-}
+MockCryptoClientStream::~MockCryptoClientStream() {}
void MockCryptoClientStream::OnHandshakeMessage(
const CryptoHandshakeMessage& message) {
@@ -89,7 +87,7 @@ void MockCryptoClientStream::SendOnCryptoHandshakeEvent(
void MockCryptoClientStream::SetConfigNegotiated() {
ASSERT_FALSE(session()->config()->negotiated());
QuicTagVector cgst;
- // TODO(rtenneti): Enable the following code after BBR code is checked in.
+// TODO(rtenneti): Enable the following code after BBR code is checked in.
#if 0
cgst.push_back(kTBBR);
#endif
diff --git a/net/quic/test_tools/mock_crypto_client_stream.h b/net/quic/test_tools/mock_crypto_client_stream.h
index d0bda38..6de68dd 100644
--- a/net/quic/test_tools/mock_crypto_client_stream.h
+++ b/net/quic/test_tools/mock_crypto_client_stream.h
@@ -35,13 +35,12 @@ class MockCryptoClientStream : public QuicCryptoClientStream {
COLD_START,
};
- MockCryptoClientStream(
- const QuicServerId& server_id,
- QuicClientSessionBase* session,
- ProofVerifyContext* verify_context,
- QuicCryptoClientConfig* crypto_config,
- HandshakeMode handshake_mode,
- const ProofVerifyDetails* proof_verify_details_);
+ MockCryptoClientStream(const QuicServerId& server_id,
+ QuicClientSessionBase* session,
+ ProofVerifyContext* verify_context,
+ QuicCryptoClientConfig* crypto_config,
+ HandshakeMode handshake_mode,
+ const ProofVerifyDetails* proof_verify_details_);
~MockCryptoClientStream() override;
// CryptoFramerVisitorInterface implementation.
diff --git a/net/quic/test_tools/mock_crypto_client_stream_factory.cc b/net/quic/test_tools/mock_crypto_client_stream_factory.cc
index e341fe8..77ddbd7 100644
--- a/net/quic/test_tools/mock_crypto_client_stream_factory.cc
+++ b/net/quic/test_tools/mock_crypto_client_stream_factory.cc
@@ -13,13 +13,11 @@ using std::string;
namespace net {
-MockCryptoClientStreamFactory::~MockCryptoClientStreamFactory() {
-}
+MockCryptoClientStreamFactory::~MockCryptoClientStreamFactory() {}
MockCryptoClientStreamFactory::MockCryptoClientStreamFactory()
: handshake_mode_(MockCryptoClientStream::CONFIRM_HANDSHAKE),
- last_stream_(nullptr) {
-}
+ last_stream_(nullptr) {}
QuicCryptoClientStream*
MockCryptoClientStreamFactory::CreateQuicCryptoClientStream(
diff --git a/net/quic/test_tools/mock_crypto_client_stream_factory.h b/net/quic/test_tools/mock_crypto_client_stream_factory.h
index 6ccc420..207e28a 100644
--- a/net/quic/test_tools/mock_crypto_client_stream_factory.h
+++ b/net/quic/test_tools/mock_crypto_client_stream_factory.h
@@ -16,7 +16,7 @@ namespace net {
class QuicServerId;
-class MockCryptoClientStreamFactory : public QuicCryptoClientStreamFactory {
+class MockCryptoClientStreamFactory : public QuicCryptoClientStreamFactory {
public:
MockCryptoClientStreamFactory();
~MockCryptoClientStreamFactory() override;
@@ -36,9 +36,7 @@ class MockCryptoClientStreamFactory : public QuicCryptoClientStreamFactory {
proof_verify_details_queue_.push(proof_verify_details);
}
- MockCryptoClientStream* last_stream() const {
- return last_stream_;
- }
+ MockCryptoClientStream* last_stream() const { return last_stream_; }
private:
MockCryptoClientStream::HandshakeMode handshake_mode_;
diff --git a/net/quic/test_tools/mock_quic_dispatcher.cc b/net/quic/test_tools/mock_quic_dispatcher.cc
index ecbdcbd..aceb7ff 100644
--- a/net/quic/test_tools/mock_quic_dispatcher.cc
+++ b/net/quic/test_tools/mock_quic_dispatcher.cc
@@ -18,11 +18,9 @@ MockQuicDispatcher::MockQuicDispatcher(
crypto_config,
QuicSupportedVersions(),
packet_writer_factory,
- helper) {
-}
+ helper) {}
-MockQuicDispatcher::~MockQuicDispatcher() {
-}
+MockQuicDispatcher::~MockQuicDispatcher() {}
} // namespace test
} // namespace net
diff --git a/net/quic/test_tools/mock_quic_dispatcher.h b/net/quic/test_tools/mock_quic_dispatcher.h
index e402df2..1c0c4f8 100644
--- a/net/quic/test_tools/mock_quic_dispatcher.h
+++ b/net/quic/test_tools/mock_quic_dispatcher.h
@@ -24,9 +24,10 @@ class MockQuicDispatcher : public tools::QuicDispatcher {
~MockQuicDispatcher() override;
- MOCK_METHOD3(ProcessPacket, void(const IPEndPoint& server_address,
- const IPEndPoint& client_address,
- const QuicEncryptedPacket& packet));
+ MOCK_METHOD3(ProcessPacket,
+ void(const IPEndPoint& server_address,
+ const IPEndPoint& client_address,
+ const QuicEncryptedPacket& packet));
private:
DISALLOW_COPY_AND_ASSIGN(MockQuicDispatcher);
diff --git a/net/quic/test_tools/mock_random.cc b/net/quic/test_tools/mock_random.cc
index ddda948..a8a8e53 100644
--- a/net/quic/test_tools/mock_random.cc
+++ b/net/quic/test_tools/mock_random.cc
@@ -7,15 +7,9 @@
namespace net {
namespace test {
-MockRandom::MockRandom()
- : base_(0xDEADBEEF),
- increment_(0) {
-}
+MockRandom::MockRandom() : base_(0xDEADBEEF), increment_(0) {}
-MockRandom::MockRandom(uint32 base)
- : base_(base),
- increment_(0) {
-}
+MockRandom::MockRandom(uint32 base) : base_(base), increment_(0) {}
void MockRandom::RandBytes(void* data, size_t len) {
memset(data, 'r' + increment_, len);
@@ -25,8 +19,7 @@ uint64 MockRandom::RandUint64() {
return base_ + increment_;
}
-void MockRandom::Reseed(const void* additional_entropy, size_t entropy_len) {
-}
+void MockRandom::Reseed(const void* additional_entropy, size_t entropy_len) {}
void MockRandom::ChangeValue() {
increment_++;
diff --git a/net/quic/test_tools/quic_ack_notifier_manager_peer.cc b/net/quic/test_tools/quic_ack_notifier_manager_peer.cc
index 12e1096..5ccaab0 100644
--- a/net/quic/test_tools/quic_ack_notifier_manager_peer.cc
+++ b/net/quic/test_tools/quic_ack_notifier_manager_peer.cc
@@ -1,4 +1,3 @@
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
diff --git a/net/quic/test_tools/quic_ack_notifier_manager_peer.h b/net/quic/test_tools/quic_ack_notifier_manager_peer.h
index 12e1096..5ccaab0 100644
--- a/net/quic/test_tools/quic_ack_notifier_manager_peer.h
+++ b/net/quic/test_tools/quic_ack_notifier_manager_peer.h
@@ -1,4 +1,3 @@
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
diff --git a/net/quic/test_tools/quic_connection_peer.h b/net/quic/test_tools/quic_connection_peer.h
index 6cabf65..4f591ac 100644
--- a/net/quic/test_tools/quic_connection_peer.h
+++ b/net/quic/test_tools/quic_connection_peer.h
@@ -44,8 +44,7 @@ class QuicConnectionPeer {
static void PopulateStopWaitingFrame(QuicConnection* connection,
QuicStopWaitingFrame* stop_waiting);
- static QuicConnectionVisitorInterface* GetVisitor(
- QuicConnection* connection);
+ static QuicConnectionVisitorInterface* GetVisitor(QuicConnection* connection);
static QuicPacketCreator* GetPacketCreator(QuicConnection* connection);
diff --git a/net/quic/test_tools/quic_flow_controller_peer.cc b/net/quic/test_tools/quic_flow_controller_peer.cc
index 602aaf8..0e32fed 100644
--- a/net/quic/test_tools/quic_flow_controller_peer.cc
+++ b/net/quic/test_tools/quic_flow_controller_peer.cc
@@ -28,8 +28,8 @@ void QuicFlowControllerPeer::SetReceiveWindowOffset(
// static
void QuicFlowControllerPeer::SetMaxReceiveWindow(
- QuicFlowController* flow_controller,
- QuicByteCount window_size) {
+ QuicFlowController* flow_controller,
+ QuicByteCount window_size) {
flow_controller->receive_window_size_ = window_size;
}
diff --git a/net/quic/test_tools/quic_framer_peer.cc b/net/quic/test_tools/quic_framer_peer.cc
index c5ad257..10eac7a 100644
--- a/net/quic/test_tools/quic_framer_peer.cc
+++ b/net/quic/test_tools/quic_framer_peer.cc
@@ -21,7 +21,8 @@ QuicPacketNumber QuicFramerPeer::CalculatePacketNumberFromWire(
// static
void QuicFramerPeer::SetLastSerializedConnectionId(
- QuicFramer* framer, QuicConnectionId connection_id) {
+ QuicFramer* framer,
+ QuicConnectionId connection_id) {
framer->last_serialized_connection_id_ = connection_id;
}
@@ -49,13 +50,11 @@ void QuicFramerPeer::SwapCrypters(QuicFramer* framer1, QuicFramer* framer2) {
framer2->decrypter_level_ = framer1->decrypter_level_;
framer1->decrypter_level_ = framer2_level;
framer2_level = framer2->alternative_decrypter_level_;
- framer2->alternative_decrypter_level_ =
- framer1->alternative_decrypter_level_;
+ framer2->alternative_decrypter_level_ = framer1->alternative_decrypter_level_;
framer1->alternative_decrypter_level_ = framer2_level;
const bool framer2_latch = framer2->alternative_decrypter_latch_;
- framer2->alternative_decrypter_latch_ =
- framer1->alternative_decrypter_latch_;
+ framer2->alternative_decrypter_latch_ = framer1->alternative_decrypter_latch_;
framer1->alternative_decrypter_latch_ = framer2_latch;
}
diff --git a/net/quic/test_tools/quic_sent_packet_manager_peer.cc b/net/quic/test_tools/quic_sent_packet_manager_peer.cc
index b834977..a5f63fc 100644
--- a/net/quic/test_tools/quic_sent_packet_manager_peer.cc
+++ b/net/quic/test_tools/quic_sent_packet_manager_peer.cc
@@ -53,8 +53,7 @@ void QuicSentPacketManagerPeer::SetPerspective(
}
// static
-const SendAlgorithmInterface*
- QuicSentPacketManagerPeer::GetSendAlgorithm(
+const SendAlgorithmInterface* QuicSentPacketManagerPeer::GetSendAlgorithm(
const QuicSentPacketManager& sent_packet_manager) {
return sent_packet_manager.send_algorithm_.get();
}
@@ -166,8 +165,8 @@ QuicByteCount QuicSentPacketManagerPeer::GetBytesInFlight(
// static
QuicSentPacketManager::NetworkChangeVisitor*
- QuicSentPacketManagerPeer::GetNetworkChangeVisitor(
- const QuicSentPacketManager* sent_packet_manager) {
+QuicSentPacketManagerPeer::GetNetworkChangeVisitor(
+ const QuicSentPacketManager* sent_packet_manager) {
return sent_packet_manager->network_change_visitor_;
}
diff --git a/net/quic/test_tools/quic_sent_packet_manager_peer.h b/net/quic/test_tools/quic_sent_packet_manager_peer.h
index 10d5ebc..deb6c47 100644
--- a/net/quic/test_tools/quic_sent_packet_manager_peer.h
+++ b/net/quic/test_tools/quic_sent_packet_manager_peer.h
@@ -19,8 +19,8 @@ class QuicSentPacketManagerPeer {
static size_t GetMaxTailLossProbes(
QuicSentPacketManager* sent_packet_manager);
- static void SetMaxTailLossProbes(
- QuicSentPacketManager* sent_packet_manager, size_t max_tail_loss_probes);
+ static void SetMaxTailLossProbes(QuicSentPacketManager* sent_packet_manager,
+ size_t max_tail_loss_probes);
static bool GetEnableHalfRttTailLossProbe(
QuicSentPacketManager* sent_packet_manager);
diff --git a/net/quic/test_tools/quic_test_packet_maker.cc b/net/quic/test_tools/quic_test_packet_maker.cc
index 2119f25..91d1a60 100644
--- a/net/quic/test_tools/quic_test_packet_maker.cc
+++ b/net/quic/test_tools/quic_test_packet_maker.cc
@@ -25,11 +25,9 @@ QuicTestPacketMaker::QuicTestPacketMaker(QuicVersion version,
clock_(clock),
host_(host),
spdy_request_framer_(HTTP2),
- spdy_response_framer_(HTTP2) {
-}
+ spdy_response_framer_(HTTP2) {}
-QuicTestPacketMaker::~QuicTestPacketMaker() {
-}
+QuicTestPacketMaker::~QuicTestPacketMaker() {}
void QuicTestPacketMaker::set_hostname(const std::string& host) {
host_.assign(host);
diff --git a/net/quic/test_tools/quic_test_packet_maker.h b/net/quic/test_tools/quic_test_packet_maker.h
index 6609f51..7806ec4 100644
--- a/net/quic/test_tools/quic_test_packet_maker.h
+++ b/net/quic/test_tools/quic_test_packet_maker.h
@@ -108,9 +108,8 @@ class QuicTestPacketMaker {
SpdyHeaderBlock GetResponseHeaders(const std::string& status);
private:
- scoped_ptr<QuicEncryptedPacket> MakePacket(
- const QuicPacketHeader& header,
- const QuicFrame& frame);
+ scoped_ptr<QuicEncryptedPacket> MakePacket(const QuicPacketHeader& header,
+ const QuicFrame& frame);
void InitializeHeader(QuicPacketNumber packet_number,
bool should_include_version);
diff --git a/net/quic/test_tools/quic_test_utils.cc b/net/quic/test_tools/quic_test_utils.cc
index 7bb892f..37e2995 100644
--- a/net/quic/test_tools/quic_test_utils.cc
+++ b/net/quic/test_tools/quic_test_utils.cc
@@ -36,9 +36,7 @@ namespace {
// No-op alarm implementation used by MockConnectionHelper.
class TestAlarm : public QuicAlarm {
public:
- explicit TestAlarm(QuicAlarm::Delegate* delegate)
- : QuicAlarm(delegate) {
- }
+ explicit TestAlarm(QuicAlarm::Delegate* delegate) : QuicAlarm(delegate) {}
void SetImpl() override {}
void CancelImpl() override {}
@@ -115,29 +113,22 @@ MockFramerVisitor::MockFramerVisitor() {
ON_CALL(*this, OnUnauthenticatedPublicHeader(_))
.WillByDefault(testing::Return(true));
- ON_CALL(*this, OnPacketHeader(_))
- .WillByDefault(testing::Return(true));
+ ON_CALL(*this, OnPacketHeader(_)).WillByDefault(testing::Return(true));
- ON_CALL(*this, OnStreamFrame(_))
- .WillByDefault(testing::Return(true));
+ ON_CALL(*this, OnStreamFrame(_)).WillByDefault(testing::Return(true));
- ON_CALL(*this, OnAckFrame(_))
- .WillByDefault(testing::Return(true));
+ ON_CALL(*this, OnAckFrame(_)).WillByDefault(testing::Return(true));
- ON_CALL(*this, OnStopWaitingFrame(_))
- .WillByDefault(testing::Return(true));
+ ON_CALL(*this, OnStopWaitingFrame(_)).WillByDefault(testing::Return(true));
- ON_CALL(*this, OnPingFrame(_))
- .WillByDefault(testing::Return(true));
+ ON_CALL(*this, OnPingFrame(_)).WillByDefault(testing::Return(true));
- ON_CALL(*this, OnRstStreamFrame(_))
- .WillByDefault(testing::Return(true));
+ ON_CALL(*this, OnRstStreamFrame(_)).WillByDefault(testing::Return(true));
ON_CALL(*this, OnConnectionCloseFrame(_))
.WillByDefault(testing::Return(true));
- ON_CALL(*this, OnGoAwayFrame(_))
- .WillByDefault(testing::Return(true));
+ ON_CALL(*this, OnGoAwayFrame(_)).WillByDefault(testing::Return(true));
}
MockFramerVisitor::~MockFramerVisitor() {}
@@ -168,8 +159,7 @@ bool NoOpFramerVisitor::OnAckFrame(const QuicAckFrame& frame) {
return true;
}
-bool NoOpFramerVisitor::OnStopWaitingFrame(
- const QuicStopWaitingFrame& frame) {
+bool NoOpFramerVisitor::OnStopWaitingFrame(const QuicStopWaitingFrame& frame) {
return true;
}
@@ -177,8 +167,7 @@ bool NoOpFramerVisitor::OnPingFrame(const QuicPingFrame& frame) {
return true;
}
-bool NoOpFramerVisitor::OnRstStreamFrame(
- const QuicRstStreamFrame& frame) {
+bool NoOpFramerVisitor::OnRstStreamFrame(const QuicRstStreamFrame& frame) {
return true;
}
@@ -310,9 +299,9 @@ void PacketSavingConnection::SendOrQueuePacket(QueuedPacket packet) {
encrypted_packets_.push_back(packet.serialized_packet.packet);
// Transfer ownership of the packet to the SentPacketManager and the
// ack notifier to the AckNotifierManager.
- sent_packet_manager_.OnPacketSent(
- &packet.serialized_packet, 0, QuicTime::Zero(), 1000,
- NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA);
+ sent_packet_manager_.OnPacketSent(&packet.serialized_packet, 0,
+ QuicTime::Zero(), 1000, NOT_RETRANSMISSION,
+ HAS_RETRANSMITTABLE_DATA);
}
MockQuicSpdySession::MockQuicSpdySession(QuicConnection* connection)
@@ -394,8 +383,10 @@ MockNetworkChangeVisitor::~MockNetworkChangeVisitor() {}
namespace {
-string HexDumpWithMarks(const char* data, int length,
- const bool* marks, int mark_length) {
+string HexDumpWithMarks(const char* data,
+ int length,
+ const bool* marks,
+ int mark_length) {
static const char kHexChars[] = "0123456789abcdef";
static const int kColumns = 4;
@@ -407,9 +398,9 @@ string HexDumpWithMarks(const char* data, int length,
}
string hex;
- for (const char* row = data; length > 0;
+ for (const char *row = data; length > 0;
row += kColumns, length -= kColumns) {
- for (const char *p = row; p < row + 4; ++p) {
+ for (const char* p = row; p < row + 4; ++p) {
if (p < row + length) {
const bool mark =
(marks && (p - data) < mark_length && marks[p - data]);
@@ -434,11 +425,17 @@ string HexDumpWithMarks(const char* data, int length,
} // namespace
-IPAddressNumber TestPeerIPAddress() { return Loopback4(); }
+IPAddressNumber TestPeerIPAddress() {
+ return Loopback4();
+}
-QuicVersion QuicVersionMax() { return QuicSupportedVersions().front(); }
+QuicVersion QuicVersionMax() {
+ return QuicSupportedVersions().front();
+}
-QuicVersion QuicVersionMin() { return QuicSupportedVersions().back(); }
+QuicVersion QuicVersionMin() {
+ return QuicSupportedVersions().back();
+}
IPAddressNumber Loopback4() {
IPAddressNumber addr;
@@ -571,12 +568,11 @@ QuicEncryptedPacket* ConstructMisFramedEncryptedPacket(
return new QuicEncryptedPacket(buffer, encrypted_length, true);
}
-void CompareCharArraysWithHexError(
- const string& description,
- const char* actual,
- const int actual_len,
- const char* expected,
- const int expected_len) {
+void CompareCharArraysWithHexError(const string& description,
+ const char* actual,
+ const int actual_len,
+ const char* expected,
+ const int expected_len) {
EXPECT_EQ(actual_len, expected_len);
const int min_len = min(actual_len, expected_len);
const int max_len = max(actual_len, expected_len);
@@ -593,14 +589,13 @@ void CompareCharArraysWithHexError(
for (int i = min_len; i < max_len; ++i) {
marks[i] = true;
}
- if (identical) return;
- ADD_FAILURE()
- << "Description:\n"
- << description
- << "\n\nExpected:\n"
- << HexDumpWithMarks(expected, expected_len, marks.get(), max_len)
- << "\nActual:\n"
- << HexDumpWithMarks(actual, actual_len, marks.get(), max_len);
+ if (identical)
+ return;
+ ADD_FAILURE() << "Description:\n" << description << "\n\nExpected:\n"
+ << HexDumpWithMarks(expected, expected_len, marks.get(),
+ max_len)
+ << "\nActual:\n"
+ << HexDumpWithMarks(actual, actual_len, marks.get(), max_len);
}
bool DecodeHexString(const base::StringPiece& hex, std::string* bytes) {
@@ -739,9 +734,7 @@ TestWriterFactory::PerConnectionPacketWriter::PerConnectionPacketWriter(
TestWriterFactory* factory,
QuicPacketWriter* writer,
QuicConnection* connection)
- : QuicPerConnectionPacketWriter(writer, connection),
- factory_(factory) {
-}
+ : QuicPerConnectionPacketWriter(writer, connection), factory_(factory) {}
TestWriterFactory::PerConnectionPacketWriter::~PerConnectionPacketWriter() {
factory_->Unregister(this);
diff --git a/net/quic/test_tools/quic_test_utils.h b/net/quic/test_tools/quic_test_utils.h
index fe44402..05b3ac6 100644
--- a/net/quic/test_tools/quic_test_utils.h
+++ b/net/quic/test_tools/quic_test_utils.h
@@ -160,17 +160,13 @@ QuicPacket* BuildUnsizedDataPacket(QuicFramer* framer,
const QuicFrames& frames,
size_t packet_size);
-template<typename SaveType>
+template <typename SaveType>
class ValueRestore {
public:
- ValueRestore(SaveType* name, SaveType value)
- : name_(name),
- value_(*name) {
+ ValueRestore(SaveType* name, SaveType value) : name_(name), value_(*name) {
*name_ = value;
}
- ~ValueRestore() {
- *name_ = value_;
- }
+ ~ValueRestore() { *name_ = value_; }
private:
SaveType* name_;
@@ -214,8 +210,8 @@ class MockFramerVisitor : public QuicFramerVisitorInterface {
// The constructor sets this up to return true by default.
MOCK_METHOD1(OnUnauthenticatedHeader, bool(const QuicPacketHeader& header));
// The constructor sets this up to return true by default.
- MOCK_METHOD1(OnUnauthenticatedPublicHeader, bool(
- const QuicPacketPublicHeader& header));
+ MOCK_METHOD1(OnUnauthenticatedPublicHeader,
+ bool(const QuicPacketPublicHeader& header));
MOCK_METHOD1(OnDecryptedPacket, void(EncryptionLevel level));
MOCK_METHOD1(OnPacketHeader, bool(const QuicPacketHeader& header));
MOCK_METHOD1(OnFecProtectedPayload, void(base::StringPiece payload));
@@ -355,24 +351,26 @@ class MockConnection : public QuicConnection {
// will advance the time of the MockClock.
void AdvanceTime(QuicTime::Delta delta);
- MOCK_METHOD3(ProcessUdpPacket, void(const IPEndPoint& self_address,
- const IPEndPoint& peer_address,
- const QuicEncryptedPacket& packet));
+ MOCK_METHOD3(ProcessUdpPacket,
+ void(const IPEndPoint& self_address,
+ const IPEndPoint& peer_address,
+ const QuicEncryptedPacket& packet));
MOCK_METHOD1(SendConnectionClose, void(QuicErrorCode error));
MOCK_METHOD2(SendConnectionCloseWithDetails,
void(QuicErrorCode error, const std::string& details));
MOCK_METHOD2(SendConnectionClosePacket,
void(QuicErrorCode error, const std::string& details));
- MOCK_METHOD3(SendRstStream, void(QuicStreamId id,
- QuicRstStreamErrorCode error,
- QuicStreamOffset bytes_written));
+ MOCK_METHOD3(SendRstStream,
+ void(QuicStreamId id,
+ QuicRstStreamErrorCode error,
+ QuicStreamOffset bytes_written));
MOCK_METHOD3(SendGoAway,
void(QuicErrorCode error,
QuicStreamId last_good_stream_id,
const std::string& reason));
MOCK_METHOD1(SendBlocked, void(QuicStreamId id));
- MOCK_METHOD2(SendWindowUpdate, void(QuicStreamId id,
- QuicStreamOffset byte_offset));
+ MOCK_METHOD2(SendWindowUpdate,
+ void(QuicStreamId id, QuicStreamOffset byte_offset));
MOCK_METHOD0(OnCanWrite, void());
MOCK_METHOD1(OnSendConnectionState, void(const CachedNetworkParameters&));
@@ -390,9 +388,7 @@ class MockConnection : public QuicConnection {
QuicConnection::ProcessUdpPacket(self_address, peer_address, packet);
}
- bool OnProtocolVersionMismatch(QuicVersion version) override {
- return false;
- }
+ bool OnProtocolVersionMismatch(QuicVersion version) override { return false; }
void ReallySendGoAway(QuicErrorCode error,
QuicStreamId last_good_stream_id,
@@ -446,13 +442,12 @@ class MockQuicSpdySession : public QuicSpdySession {
QuicRstStreamErrorCode error,
QuicStreamOffset bytes_written));
- MOCK_METHOD2(OnStreamHeaders, void(QuicStreamId stream_id,
- base::StringPiece headers_data));
+ MOCK_METHOD2(OnStreamHeaders,
+ void(QuicStreamId stream_id, base::StringPiece headers_data));
MOCK_METHOD2(OnStreamHeadersPriority,
void(QuicStreamId stream_id, SpdyPriority priority));
- MOCK_METHOD3(OnStreamHeadersComplete, void(QuicStreamId stream_id,
- bool fin,
- size_t frame_len));
+ MOCK_METHOD3(OnStreamHeadersComplete,
+ void(QuicStreamId stream_id, bool fin, size_t frame_len));
MOCK_METHOD0(IsCryptoHandshakeConfirmed, bool());
MOCK_METHOD5(WriteHeaders,
size_t(QuicStreamId id,
@@ -552,15 +547,15 @@ class MockSendAlgorithm : public SendAlgorithmInterface {
~MockSendAlgorithm() override;
MOCK_METHOD2(SetFromConfig,
- void(const QuicConfig& config,
- Perspective perspective));
+ void(const QuicConfig& config, Perspective perspective));
MOCK_METHOD1(SetNumEmulatedConnections, void(int num_connections));
MOCK_METHOD1(SetMaxCongestionWindow,
void(QuicByteCount max_congestion_window));
- MOCK_METHOD4(OnCongestionEvent, void(bool rtt_updated,
- QuicByteCount bytes_in_flight,
- const CongestionVector& acked_packets,
- const CongestionVector& lost_packets));
+ MOCK_METHOD4(OnCongestionEvent,
+ void(bool rtt_updated,
+ QuicByteCount bytes_in_flight,
+ const CongestionVector& acked_packets,
+ const CongestionVector& lost_packets));
MOCK_METHOD5(OnPacketSent,
bool(QuicTime,
QuicByteCount,
@@ -613,8 +608,8 @@ class MockLossAlgorithm : public LossDetectionInterface {
DISALLOW_COPY_AND_ASSIGN(MockLossAlgorithm);
};
-class TestEntropyCalculator :
- public QuicReceivedEntropyHashCalculatorInterface {
+class TestEntropyCalculator
+ : public QuicReceivedEntropyHashCalculatorInterface {
public:
TestEntropyCalculator();
~TestEntropyCalculator() override;
@@ -655,8 +650,8 @@ class MockAckListener : public QuicAckListenerInterface {
DISALLOW_COPY_AND_ASSIGN(MockAckListener);
};
-class MockNetworkChangeVisitor :
- public QuicSentPacketManager::NetworkChangeVisitor {
+class MockNetworkChangeVisitor
+ : public QuicSentPacketManager::NetworkChangeVisitor {
public:
MockNetworkChangeVisitor();
~MockNetworkChangeVisitor() override;
diff --git a/net/quic/test_tools/simple_quic_framer.cc b/net/quic/test_tools/simple_quic_framer.cc
index a8ce332..1fc893d 100644
--- a/net/quic/test_tools/simple_quic_framer.cc
+++ b/net/quic/test_tools/simple_quic_framer.cc
@@ -17,9 +17,7 @@ namespace test {
class SimpleFramerVisitor : public QuicFramerVisitorInterface {
public:
- SimpleFramerVisitor()
- : error_(QUIC_NO_ERROR) {
- }
+ SimpleFramerVisitor() : error_(QUIC_NO_ERROR) {}
~SimpleFramerVisitor() override {
STLDeleteElements(&stream_frames_);
@@ -36,8 +34,7 @@ class SimpleFramerVisitor : public QuicFramerVisitorInterface {
}
void OnVersionNegotiationPacket(
const QuicVersionNegotiationPacket& packet) override {
- version_negotiation_packet_.reset(
- new QuicVersionNegotiationPacket(packet));
+ version_negotiation_packet_.reset(new QuicVersionNegotiationPacket(packet));
}
void OnRevivedPacket() override {}
@@ -132,9 +129,7 @@ class SimpleFramerVisitor : public QuicFramerVisitorInterface {
const vector<QuicStopWaitingFrame>& stop_waiting_frames() const {
return stop_waiting_frames_;
}
- const vector<QuicPingFrame>& ping_frames() const {
- return ping_frames_;
- }
+ const vector<QuicPingFrame>& ping_frames() const { return ping_frames_; }
StringPiece fec_data() const { return fec_redundancy_; }
const QuicVersionNegotiationPacket* version_negotiation_packet() const {
return version_negotiation_packet_.get();
@@ -164,15 +159,12 @@ class SimpleFramerVisitor : public QuicFramerVisitorInterface {
SimpleQuicFramer::SimpleQuicFramer()
: framer_(QuicSupportedVersions(),
QuicTime::Zero(),
- Perspective::IS_SERVER) {
-}
+ Perspective::IS_SERVER) {}
SimpleQuicFramer::SimpleQuicFramer(const QuicVersionVector& supported_versions)
- : framer_(supported_versions, QuicTime::Zero(), Perspective::IS_SERVER) {
-}
+ : framer_(supported_versions, QuicTime::Zero(), Perspective::IS_SERVER) {}
-SimpleQuicFramer::~SimpleQuicFramer() {
-}
+SimpleQuicFramer::~SimpleQuicFramer() {}
bool SimpleQuicFramer::ProcessPacket(const QuicEncryptedPacket& packet) {
visitor_.reset(new SimpleFramerVisitor);
@@ -202,21 +194,18 @@ QuicFramer* SimpleQuicFramer::framer() {
}
size_t SimpleQuicFramer::num_frames() const {
- return ack_frames().size() +
- goaway_frames().size() +
- rst_stream_frames().size() +
- stop_waiting_frames().size() +
- stream_frames().size() +
- ping_frames().size() +
- connection_close_frames().size();
+ return ack_frames().size() + goaway_frames().size() +
+ rst_stream_frames().size() + stop_waiting_frames().size() +
+ stream_frames().size() + ping_frames().size() +
+ connection_close_frames().size();
}
const vector<QuicAckFrame>& SimpleQuicFramer::ack_frames() const {
return visitor_->ack_frames();
}
-const vector<QuicStopWaitingFrame>&
-SimpleQuicFramer::stop_waiting_frames() const {
+const vector<QuicStopWaitingFrame>& SimpleQuicFramer::stop_waiting_frames()
+ const {
return visitor_->stop_waiting_frames();
}
@@ -232,8 +221,7 @@ const vector<QuicRstStreamFrame>& SimpleQuicFramer::rst_stream_frames() const {
return visitor_->rst_stream_frames();
}
-const vector<QuicGoAwayFrame>&
-SimpleQuicFramer::goaway_frames() const {
+const vector<QuicGoAwayFrame>& SimpleQuicFramer::goaway_frames() const {
return visitor_->goaway_frames();
}
diff --git a/net/quic/test_tools/test_task_runner.cc b/net/quic/test_tools/test_task_runner.cc
index 385fd5d..5e6e647 100644
--- a/net/quic/test_tools/test_task_runner.cc
+++ b/net/quic/test_tools/test_task_runner.cc
@@ -12,20 +12,16 @@
namespace net {
namespace test {
-TestTaskRunner::TestTaskRunner(MockClock* clock)
- : clock_(clock) {
-}
+TestTaskRunner::TestTaskRunner(MockClock* clock) : clock_(clock) {}
-TestTaskRunner::~TestTaskRunner() {
-}
+TestTaskRunner::~TestTaskRunner() {}
bool TestTaskRunner::PostDelayedTask(const tracked_objects::Location& from_here,
const base::Closure& task,
base::TimeDelta delay) {
EXPECT_GE(delay, base::TimeDelta());
- tasks_.push_back(
- PostedTask(from_here, task, clock_->NowInTicks(), delay,
- base::TestPendingTask::NESTABLE));
+ tasks_.push_back(PostedTask(from_here, task, clock_->NowInTicks(), delay,
+ base::TestPendingTask::NESTABLE));
return false;
}
@@ -60,8 +56,8 @@ struct ShouldRunBeforeLessThan {
} // namespace
std::vector<PostedTask>::iterator TestTaskRunner::FindNextTask() {
- return std::min_element(
- tasks_.begin(), tasks_.end(), ShouldRunBeforeLessThan());
+ return std::min_element(tasks_.begin(), tasks_.end(),
+ ShouldRunBeforeLessThan());
}
} // namespace test
diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc
index 4fcc582..26caccf 100644
--- a/net/tools/quic/end_to_end_test.cc
+++ b/net/tools/quic/end_to_end_test.cc
@@ -3,8 +3,8 @@
// found in the LICENSE file.
#include <stddef.h>
-#include <string>
#include <sys/epoll.h>
+#include <string>
#include <vector>
#include "base/basictypes.h"
@@ -329,8 +329,7 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
void set_server_initial_stream_flow_control_receive_window(uint32 window) {
CHECK(server_thread_.get() == nullptr);
- DVLOG(1) << "Setting server initial stream flow control window: "
- << window;
+ DVLOG(1) << "Setting server initial stream flow control window: " << window;
server_config_.SetInitialStreamFlowControlWindowToSend(window);
}
@@ -341,8 +340,8 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
server_config_.SetInitialSessionFlowControlWindowToSend(window);
}
- const QuicSentPacketManager *
- GetSentPacketManagerFromFirstServerSession() const {
+ const QuicSentPacketManager* GetSentPacketManagerFromFirstServerSession()
+ const {
QuicDispatcher* dispatcher =
QuicServerPeer::GetDispatcher(server_thread_->server());
QuicSession* session = dispatcher->session_map().begin()->second;
@@ -411,8 +410,8 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
server_thread_->server()->SetChloMultiplier(chlo_multiplier_);
}
server_thread_->Initialize();
- server_address_ = IPEndPoint(server_address_.address(),
- server_thread_->GetPort());
+ server_address_ =
+ IPEndPoint(server_address_.address(), server_thread_->GetPort());
QuicDispatcher* dispatcher =
QuicServerPeer::GetDispatcher(server_thread_->server());
TestWriterFactory* packet_writer_factory = new TestWriterFactory();
@@ -1001,10 +1000,10 @@ TEST_P(EndToEndTest, CorrectlyConfiguredFec) {
server_thread_->Resume();
// Verify that client's FEC configuration is correct.
- EXPECT_EQ(expected_policy, QuicSpdySessionPeer::GetHeadersStream(
- client_->client()->session())->fec_policy());
EXPECT_EQ(expected_policy,
- client_->GetOrCreateStream()->fec_policy());
+ QuicSpdySessionPeer::GetHeadersStream(client_->client()->session())
+ ->fec_policy());
+ EXPECT_EQ(expected_policy, client_->GetOrCreateStream()->fec_policy());
}
TEST_P(EndToEndTest, LargePostSmallBandwidthLargeBuffer) {
@@ -1131,8 +1130,8 @@ TEST_P(EndToEndTest, DISABLED_MultipleTermination) {
// By default the stream protects itself from writes after terminte is set.
// Override this to test the server handling buggy clients.
- ReliableQuicStreamPeer::SetWriteSideClosed(
- false, client_->GetOrCreateStream());
+ ReliableQuicStreamPeer::SetWriteSideClosed(false,
+ client_->GetOrCreateStream());
EXPECT_DFATAL(client_->SendData("eep", true), "Fin already buffered");
}
@@ -1205,7 +1204,7 @@ TEST_P(EndToEndTest, NegotiateCongestionControl) {
EXPECT_EQ(expected_congestion_control_type,
QuicSentPacketManagerPeer::GetSendAlgorithm(
*GetSentPacketManagerFromFirstServerSession())
- ->GetCongestionControlType());
+ ->GetCongestionControlType());
}
TEST_P(EndToEndTest, LimitMaxOpenStreams) {
@@ -1249,8 +1248,8 @@ TEST_P(EndToEndTest, ClientSuggestsRTT) {
TEST_P(EndToEndTest, MaxInitialRTT) {
// Client tries to suggest twice the server's max initial rtt and the server
// uses the max.
- client_config_.SetInitialRoundTripTimeUsToSend(
- 2 * kMaxInitialRoundTripTimeUs);
+ client_config_.SetInitialRoundTripTimeUsToSend(2 *
+ kMaxInitialRoundTripTimeUs);
ASSERT_TRUE(Initialize());
client_->client()->WaitForCryptoHandshakeConfirmed();
@@ -1638,7 +1637,7 @@ TEST_P(EndToEndTest, HeadersAndCryptoStreamsNoConnectionFlowControl) {
QuicFlowController* server_connection_flow_controller =
session->flow_controller();
EXPECT_EQ(kSessionIFCW, QuicFlowControllerPeer::ReceiveWindowSize(
- server_connection_flow_controller));
+ server_connection_flow_controller));
server_thread_->Resume();
}
@@ -1690,8 +1689,8 @@ TEST_P(EndToEndTest, RequestWithNoBodyWillNeverSendStreamFrameWithFIN) {
QuicDispatcher* dispatcher =
QuicServerPeer::GetDispatcher(server_thread_->server());
QuicSession* session = dispatcher->session_map().begin()->second;
- EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(
- session).size());
+ EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(session)
+ .size());
server_thread_->Resume();
}
@@ -1904,21 +1903,9 @@ TEST_P(EndToEndTest, BadPacketHeaderFlags) {
// invalid public flags
0xFF,
// connection_id
- 0x10,
- 0x32,
- 0x54,
- 0x76,
- 0x98,
- 0xBA,
- 0xDC,
- 0xFE,
+ 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC, 0xFE,
// packet sequence number
- 0xBC,
- 0x9A,
- 0x78,
- 0x56,
- 0x34,
- 0x12,
+ 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12,
// private flags
0x00,
};
diff --git a/net/tools/quic/quic_client.cc b/net/tools/quic/quic_client.cc
index 2365c84..48d8a4e 100644
--- a/net/tools/quic/quic_client.cc
+++ b/net/tools/quic/quic_client.cc
@@ -169,10 +169,9 @@ bool QuicClient::CreateUDPSocket() {
sockaddr_storage raw_addr;
socklen_t raw_addr_len = sizeof(raw_addr);
CHECK(client_address_.ToSockAddr(reinterpret_cast<sockaddr*>(&raw_addr),
- &raw_addr_len));
- rc = bind(fd_,
- reinterpret_cast<const sockaddr*>(&raw_addr),
- sizeof(raw_addr));
+ &raw_addr_len));
+ rc =
+ bind(fd_, reinterpret_cast<const sockaddr*>(&raw_addr), sizeof(raw_addr));
if (rc < 0) {
LOG(ERROR) << "Bind failed: " << strerror(errno);
return false;
@@ -319,12 +318,12 @@ void QuicClient::MaybeAddQuicDataToResend(QuicDataToResend* data_to_resend) {
data_sent_before_handshake_.push_back(data_to_resend);
}
-void QuicClient::SendRequestAndWaitForResponse(
- const BalsaHeaders& headers,
- StringPiece body,
- bool fin) {
+void QuicClient::SendRequestAndWaitForResponse(const BalsaHeaders& headers,
+ StringPiece body,
+ bool fin) {
SendRequest(headers, body, fin);
- while (WaitForEvents()) {}
+ while (WaitForEvents()) {
+ }
}
void QuicClient::SendRequestsAndWaitForResponse(
@@ -334,7 +333,8 @@ void QuicClient::SendRequestsAndWaitForResponse(
headers.SetRequestFirstlineFromStringPieces("GET", url_list[i], "HTTP/1.1");
SendRequest(headers, "", true);
}
- while (WaitForEvents()) {}
+ while (WaitForEvents()) {
+ }
}
bool QuicClient::WaitForEvents() {
@@ -403,8 +403,8 @@ void QuicClient::OnClose(QuicSpdyStream* stream) {
&headers);
if (response_listener_.get() != nullptr) {
- response_listener_->OnCompleteResponse(
- stream->id(), headers, client_stream->data());
+ response_listener_->OnCompleteResponse(stream->id(), headers,
+ client_stream->data());
}
// Store response headers and body.
diff --git a/net/tools/quic/quic_client.h b/net/tools/quic/quic_client.h
index ff63e1c..21a7113 100644
--- a/net/tools/quic/quic_client.h
+++ b/net/tools/quic/quic_client.h
@@ -118,8 +118,7 @@ class QuicClient : public QuicClientBase,
// Sends a request simple GET for each URL in |args|, and then waits for
// each to complete.
- void SendRequestsAndWaitForResponse(
- const std::vector<std::string>& url_list);
+ void SendRequestsAndWaitForResponse(const std::vector<std::string>& url_list);
// Migrate to a new socket during an active connection.
bool MigrateSocket(const IPAddressNumber& new_host);
diff --git a/net/tools/quic/quic_client_bin.cc b/net/tools/quic/quic_client_bin.cc
index f8526ad..d9b987c 100644
--- a/net/tools/quic/quic_client_bin.cc
+++ b/net/tools/quic/quic_client_bin.cc
@@ -133,7 +133,7 @@ static bool DecodeHexString(const base::StringPiece& hex, std::string* bytes) {
return true;
};
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[]) {
base::CommandLine::Init(argc, argv);
base::CommandLine* line = base::CommandLine::ForCurrentProcess();
const base::CommandLine::StringVector& urls = line->GetArgs();
@@ -239,8 +239,8 @@ int main(int argc, char *argv[]) {
net::AddressList addresses;
int rv = net::tools::SynchronousHostResolver::Resolve(host, &addresses);
if (rv != net::OK) {
- LOG(ERROR) << "Unable to resolve '" << host << "' : "
- << net::ErrorToShortString(rv);
+ LOG(ERROR) << "Unable to resolve '" << host
+ << "' : " << net::ErrorToShortString(rv);
return 1;
}
ip_addr = addresses[0].address();
diff --git a/net/tools/quic/quic_client_session.cc b/net/tools/quic/quic_client_session.cc
index 4387a3b..4ae4851 100644
--- a/net/tools/quic/quic_client_session.cc
+++ b/net/tools/quic/quic_client_session.cc
@@ -24,8 +24,7 @@ QuicClientSession::QuicClientSession(const QuicConfig& config,
crypto_config_(crypto_config),
respect_goaway_(true) {}
-QuicClientSession::~QuicClientSession() {
-}
+QuicClientSession::~QuicClientSession() {}
void QuicClientSession::Initialize() {
crypto_stream_.reset(CreateQuicCryptoStream());
diff --git a/net/tools/quic/quic_client_session_test.cc b/net/tools/quic/quic_client_session_test.cc
index 6786357..e223734 100644
--- a/net/tools/quic/quic_client_session_test.cc
+++ b/net/tools/quic/quic_client_session_test.cc
@@ -80,7 +80,8 @@ class ToolsQuicClientSessionTest
scoped_ptr<QuicClientSession> session_;
};
-INSTANTIATE_TEST_CASE_P(Tests, ToolsQuicClientSessionTest,
+INSTANTIATE_TEST_CASE_P(Tests,
+ ToolsQuicClientSessionTest,
::testing::ValuesIn(QuicSupportedVersions()));
TEST_P(ToolsQuicClientSessionTest, CryptoConnect) {
@@ -197,8 +198,9 @@ TEST_P(ToolsQuicClientSessionTest, SetFecProtectionFromConfig) {
// Verify that headers stream is always protected and data streams are
// optionally protected.
- EXPECT_EQ(FEC_PROTECT_ALWAYS, QuicSpdySessionPeer::GetHeadersStream(
- session_.get())->fec_policy());
+ EXPECT_EQ(
+ FEC_PROTECT_ALWAYS,
+ QuicSpdySessionPeer::GetHeadersStream(session_.get())->fec_policy());
QuicSpdyClientStream* stream =
session_->CreateOutgoingDynamicStream(kDefaultPriority);
ASSERT_TRUE(stream);
diff --git a/net/tools/quic/quic_default_packet_writer.cc b/net/tools/quic/quic_default_packet_writer.cc
index e7b5088..c5e4875 100644
--- a/net/tools/quic/quic_default_packet_writer.cc
+++ b/net/tools/quic/quic_default_packet_writer.cc
@@ -10,8 +10,7 @@ namespace net {
namespace tools {
QuicDefaultPacketWriter::QuicDefaultPacketWriter(int fd)
- : fd_(fd),
- write_blocked_(false) {}
+ : fd_(fd), write_blocked_(false) {}
QuicDefaultPacketWriter::~QuicDefaultPacketWriter() {}
@@ -21,8 +20,8 @@ WriteResult QuicDefaultPacketWriter::WritePacket(
const IPAddressNumber& self_address,
const IPEndPoint& peer_address) {
DCHECK(!IsWriteBlocked());
- WriteResult result = QuicSocketUtils::WritePacket(
- fd_, buffer, buf_len, self_address, peer_address);
+ WriteResult result = QuicSocketUtils::WritePacket(fd_, buffer, buf_len,
+ self_address, peer_address);
if (result.status == WRITE_STATUS_BLOCKED) {
write_blocked_ = true;
}
diff --git a/net/tools/quic/quic_default_packet_writer.h b/net/tools/quic/quic_default_packet_writer.h
index f231dea..0b5e57f 100644
--- a/net/tools/quic/quic_default_packet_writer.h
+++ b/net/tools/quic/quic_default_packet_writer.h
@@ -34,9 +34,7 @@ class QuicDefaultPacketWriter : public QuicPacketWriter {
void set_fd(int fd) { fd_ = fd; }
protected:
- void set_write_blocked(bool is_blocked) {
- write_blocked_ = is_blocked;
- }
+ void set_write_blocked(bool is_blocked) { write_blocked_ = is_blocked; }
int fd() { return fd_; }
private:
diff --git a/net/tools/quic/quic_dispatcher.cc b/net/tools/quic/quic_dispatcher.cc
index bb4bd88..d42ad7f 100644
--- a/net/tools/quic/quic_dispatcher.cc
+++ b/net/tools/quic/quic_dispatcher.cc
@@ -27,8 +27,7 @@ namespace {
class DeleteSessionsAlarm : public QuicAlarm::Delegate {
public:
explicit DeleteSessionsAlarm(QuicDispatcher* dispatcher)
- : dispatcher_(dispatcher) {
- }
+ : dispatcher_(dispatcher) {}
QuicTime OnAlarm() override {
dispatcher_->DeleteSessions();
@@ -48,8 +47,7 @@ class DeleteSessionsAlarm : public QuicAlarm::Delegate {
class QuicDispatcher::QuicFramerVisitor : public QuicFramerVisitorInterface {
public:
explicit QuicFramerVisitor(QuicDispatcher* dispatcher)
- : dispatcher_(dispatcher),
- connection_id_(0) {}
+ : dispatcher_(dispatcher), connection_id_(0) {}
// QuicFramerVisitorInterface implementation
void OnPacket() override {}
@@ -157,9 +155,8 @@ QuicDispatcher::PacketWriterFactoryAdapter::~PacketWriterFactoryAdapter() {}
QuicPacketWriter* QuicDispatcher::PacketWriterFactoryAdapter::Create(
QuicConnection* connection) const {
- return dispatcher_->packet_writer_factory_->Create(
- dispatcher_->writer_.get(),
- connection);
+ return dispatcher_->packet_writer_factory_->Create(dispatcher_->writer_.get(),
+ connection);
}
QuicDispatcher::QuicDispatcher(const QuicConfig& config,
@@ -408,10 +405,9 @@ void QuicDispatcher::OnConnectionClosed(QuicConnectionId connection_id,
return;
}
- DVLOG_IF(1, error != QUIC_NO_ERROR) << "Closing connection ("
- << connection_id
- << ") due to error: "
- << QuicUtils::ErrorToString(error);
+ DVLOG_IF(1, error != QUIC_NO_ERROR)
+ << "Closing connection (" << connection_id
+ << ") due to error: " << QuicUtils::ErrorToString(error);
if (closed_session_list_.empty()) {
delete_sessions_alarm_->Cancel();
@@ -426,8 +422,8 @@ void QuicDispatcher::OnConnectionClosed(QuicConnectionId connection_id,
void QuicDispatcher::OnWriteBlocked(
QuicBlockedWriterInterface* blocked_writer) {
if (!writer_->IsWriteBlocked()) {
- LOG(DFATAL) <<
- "QuicDispatcher::OnWriteBlocked called when the writer is not blocked.";
+ LOG(DFATAL) << "QuicDispatcher::OnWriteBlocked called when the writer is "
+ "not blocked.";
// Return without adding the connection to the blocked list, to avoid
// infinite loops in OnCanWrite.
return;
diff --git a/net/tools/quic/quic_dispatcher.h b/net/tools/quic/quic_dispatcher.h
index 49a6d6d..95b0d82 100644
--- a/net/tools/quic/quic_dispatcher.h
+++ b/net/tools/quic/quic_dispatcher.h
@@ -175,15 +175,9 @@ class QuicDispatcher : public QuicServerSessionVisitor,
return supported_versions_;
}
- const IPEndPoint& current_server_address() {
- return current_server_address_;
- }
- const IPEndPoint& current_client_address() {
- return current_client_address_;
- }
- const QuicEncryptedPacket& current_packet() {
- return *current_packet_;
- }
+ const IPEndPoint& current_server_address() { return current_server_address_; }
+ const IPEndPoint& current_client_address() { return current_client_address_; }
+ const QuicEncryptedPacket& current_packet() { return *current_packet_; }
const QuicConfig& config() const { return config_; }
@@ -208,8 +202,8 @@ class QuicDispatcher : public QuicServerSessionVisitor,
// An adapter that creates packet writers using the dispatcher's
// PacketWriterFactory and shared writer. Essentially, it just curries the
// writer argument away from QuicDispatcher::PacketWriterFactory.
- class PacketWriterFactoryAdapter :
- public QuicConnection::PacketWriterFactory {
+ class PacketWriterFactoryAdapter
+ : public QuicConnection::PacketWriterFactory {
public:
explicit PacketWriterFactoryAdapter(QuicDispatcher* dispatcher);
~PacketWriterFactoryAdapter() override;
diff --git a/net/tools/quic/quic_dispatcher_test.cc b/net/tools/quic/quic_dispatcher_test.cc
index b66db91..2ce621a6 100644
--- a/net/tools/quic/quic_dispatcher_test.cc
+++ b/net/tools/quic/quic_dispatcher_test.cc
@@ -126,8 +126,8 @@ QuicServerSession* CreateSession(QuicDispatcher* dispatcher,
new MockServerConnection(connection_id, helper, dispatcher);
*session = new TestQuicSpdyServerSession(config, connection, crypto_config);
connection->set_visitor(*session);
- ON_CALL(*connection, SendConnectionClose(_)).WillByDefault(
- WithoutArgs(Invoke(
+ ON_CALL(*connection, SendConnectionClose(_))
+ .WillByDefault(WithoutArgs(Invoke(
connection, &MockServerConnection::UnregisterOnConnectionClosed)));
EXPECT_CALL(*reinterpret_cast<MockConnection*>((*session)->connection()),
ProcessUdpPacket(_, client_address, _));
@@ -236,9 +236,10 @@ TEST_F(QuicDispatcherTest, ProcessPackets) {
ProcessPacket(client_address, 2, true, "bar");
EXPECT_CALL(*reinterpret_cast<MockConnection*>(session1_->connection()),
- ProcessUdpPacket(_, _, _)).Times(1).
- WillOnce(testing::WithArgs<2>(Invoke(
- this, &QuicDispatcherTest::ValidatePacket)));
+ ProcessUdpPacket(_, _, _))
+ .Times(1)
+ .WillOnce(testing::WithArgs<2>(
+ Invoke(this, &QuicDispatcherTest::ValidatePacket)));
ProcessPacket(client_address, 1, false, "eep");
}
@@ -279,22 +280,24 @@ TEST_F(QuicDispatcherTest, TimeWaitListManager) {
packet.nonce_proof = 132232;
scoped_ptr<QuicEncryptedPacket> encrypted(
QuicFramer::BuildPublicResetPacket(packet));
- EXPECT_CALL(*session1_, OnConnectionClosed(QUIC_PUBLIC_RESET, true)).Times(1)
+ EXPECT_CALL(*session1_, OnConnectionClosed(QUIC_PUBLIC_RESET, true))
+ .Times(1)
.WillOnce(WithoutArgs(Invoke(
reinterpret_cast<MockServerConnection*>(session1_->connection()),
&MockServerConnection::UnregisterOnConnectionClosed)));
EXPECT_CALL(*reinterpret_cast<MockConnection*>(session1_->connection()),
ProcessUdpPacket(_, _, _))
- .WillOnce(Invoke(
- reinterpret_cast<MockConnection*>(session1_->connection()),
- &MockConnection::ReallyProcessUdpPacket));
+ .WillOnce(
+ Invoke(reinterpret_cast<MockConnection*>(session1_->connection()),
+ &MockConnection::ReallyProcessUdpPacket));
dispatcher_.ProcessPacket(IPEndPoint(), client_address, *encrypted);
EXPECT_TRUE(time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id));
// Dispatcher forwards subsequent packets for this connection_id to the time
// wait list manager.
EXPECT_CALL(*time_wait_list_manager_,
- ProcessPacket(_, _, connection_id, _, _)).Times(1);
+ ProcessPacket(_, _, connection_id, _, _))
+ .Times(1);
EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _))
.Times(0);
ProcessPacket(client_address, connection_id, true, "foo");
@@ -309,7 +312,8 @@ TEST_F(QuicDispatcherTest, NoVersionPacketToTimeWaitListManager) {
// list manager.
EXPECT_CALL(dispatcher_, CreateQuicSession(_, _)).Times(0);
EXPECT_CALL(*time_wait_list_manager_,
- ProcessPacket(_, _, connection_id, _, _)).Times(1);
+ ProcessPacket(_, _, connection_id, _, _))
+ .Times(1);
EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _))
.Times(1);
ProcessPacket(client_address, connection_id, false, "data");
@@ -460,7 +464,8 @@ TEST_F(QuicDispatcherTest, TooBigSeqNoPacketToTimeWaitListManager) {
// list manager.
EXPECT_CALL(dispatcher_, CreateQuicSession(_, _)).Times(0);
EXPECT_CALL(*time_wait_list_manager_,
- ProcessPacket(_, _, connection_id, _, _)).Times(1);
+ ProcessPacket(_, _, connection_id, _, _))
+ .Times(1);
EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _))
.Times(1);
// A packet whose packet number is one to large to be allowed to start a
@@ -507,7 +512,8 @@ TEST_P(QuicDispatcherStatelessRejectTest, ParameterizedBasicTest) {
if (ExpectStatelessReject()) {
// The second packet will be processed on the time-wait list.
EXPECT_CALL(*time_wait_list_manager_,
- ProcessPacket(_, _, connection_id, _, _)).Times(1);
+ ProcessPacket(_, _, connection_id, _, _))
+ .Times(1);
} else {
// The second packet will trigger a packet-validation
EXPECT_CALL(*reinterpret_cast<MockConnection*>(session1_->connection()),
@@ -537,7 +543,8 @@ TEST_P(QuicDispatcherTestStrayPacketConnectionId,
// Dispatcher drops this packet.
EXPECT_CALL(dispatcher_, CreateQuicSession(_, _)).Times(0);
EXPECT_CALL(*time_wait_list_manager_,
- ProcessPacket(_, _, connection_id, _, _)).Times(0);
+ ProcessPacket(_, _, connection_id, _, _))
+ .Times(0);
EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _))
.Times(0);
ProcessPacket(client_address, connection_id, true, "data",
@@ -602,9 +609,7 @@ class QuicDispatcherWriteBlockedListTest : public QuicDispatcherTest {
dispatcher_.Shutdown();
}
- void SetBlocked() {
- writer_->write_blocked_ = true;
- }
+ void SetBlocked() { writer_->write_blocked_ = true; }
void BlockConnection2() {
writer_->write_blocked_ = true;
@@ -700,8 +705,8 @@ TEST_F(QuicDispatcherWriteBlockedListTest, OnCanWriteHandleBlock) {
SetBlocked();
dispatcher_.OnWriteBlocked(connection1());
dispatcher_.OnWriteBlocked(connection2());
- EXPECT_CALL(*connection1(), OnCanWrite()).WillOnce(
- Invoke(this, &QuicDispatcherWriteBlockedListTest::SetBlocked));
+ EXPECT_CALL(*connection1(), OnCanWrite())
+ .WillOnce(Invoke(this, &QuicDispatcherWriteBlockedListTest::SetBlocked));
EXPECT_CALL(*connection2(), OnCanWrite()).Times(0);
dispatcher_.OnCanWrite();
@@ -718,8 +723,9 @@ TEST_F(QuicDispatcherWriteBlockedListTest, LimitedWrites) {
dispatcher_.OnWriteBlocked(connection1());
dispatcher_.OnWriteBlocked(connection2());
EXPECT_CALL(*connection1(), OnCanWrite());
- EXPECT_CALL(*connection2(), OnCanWrite()).WillOnce(
- Invoke(this, &QuicDispatcherWriteBlockedListTest::BlockConnection2));
+ EXPECT_CALL(*connection2(), OnCanWrite())
+ .WillOnce(
+ Invoke(this, &QuicDispatcherWriteBlockedListTest::BlockConnection2));
dispatcher_.OnCanWrite();
EXPECT_TRUE(dispatcher_.HasPendingWrites());
@@ -735,8 +741,8 @@ TEST_F(QuicDispatcherWriteBlockedListTest, TestWriteLimits) {
SetBlocked();
dispatcher_.OnWriteBlocked(connection1());
dispatcher_.OnWriteBlocked(connection2());
- EXPECT_CALL(*connection1(), OnCanWrite()).WillOnce(
- Invoke(this, &QuicDispatcherWriteBlockedListTest::SetBlocked));
+ EXPECT_CALL(*connection1(), OnCanWrite())
+ .WillOnce(Invoke(this, &QuicDispatcherWriteBlockedListTest::SetBlocked));
EXPECT_CALL(*connection2(), OnCanWrite()).Times(0);
dispatcher_.OnCanWrite();
EXPECT_TRUE(dispatcher_.HasPendingWrites());
diff --git a/net/tools/quic/quic_epoll_clock.cc b/net/tools/quic/quic_epoll_clock.cc
index 62cb6bd..bb60725 100644
--- a/net/tools/quic/quic_epoll_clock.cc
+++ b/net/tools/quic/quic_epoll_clock.cc
@@ -10,8 +10,7 @@ namespace net {
namespace tools {
QuicEpollClock::QuicEpollClock(EpollServer* epoll_server)
- : epoll_server_(epoll_server) {
-}
+ : epoll_server_(epoll_server) {}
QuicEpollClock::~QuicEpollClock() {}
diff --git a/net/tools/quic/quic_epoll_clock_test.cc b/net/tools/quic/quic_epoll_clock_test.cc
index 6fe7c0e..05b2d7a 100644
--- a/net/tools/quic/quic_epoll_clock_test.cc
+++ b/net/tools/quic/quic_epoll_clock_test.cc
@@ -37,12 +37,10 @@ TEST(QuicEpollClockTest, NowInUsec) {
QuicEpollClock clock(&epoll_server);
epoll_server.set_now_in_usec(1000000);
- EXPECT_EQ(1000000,
- clock.Now().Subtract(QuicTime::Zero()).ToMicroseconds());
+ EXPECT_EQ(1000000, clock.Now().Subtract(QuicTime::Zero()).ToMicroseconds());
epoll_server.AdvanceBy(5);
- EXPECT_EQ(1000005,
- clock.Now().Subtract(QuicTime::Zero()).ToMicroseconds());
+ EXPECT_EQ(1000005, clock.Now().Subtract(QuicTime::Zero()).ToMicroseconds());
}
} // namespace test
diff --git a/net/tools/quic/quic_epoll_connection_helper.cc b/net/tools/quic/quic_epoll_connection_helper.cc
index b763d82..5d412fe 100644
--- a/net/tools/quic/quic_epoll_connection_helper.cc
+++ b/net/tools/quic/quic_epoll_connection_helper.cc
@@ -21,8 +21,7 @@ namespace {
class QuicEpollAlarm : public QuicAlarm {
public:
- QuicEpollAlarm(EpollServer* epoll_server,
- QuicAlarm::Delegate* delegate)
+ QuicEpollAlarm(EpollServer* epoll_server, QuicAlarm::Delegate* delegate)
: QuicAlarm(delegate),
epoll_server_(epoll_server),
epoll_alarm_impl_(this) {}
@@ -65,11 +64,9 @@ class QuicEpollAlarm : public QuicAlarm {
QuicEpollConnectionHelper::QuicEpollConnectionHelper(EpollServer* epoll_server)
: epoll_server_(epoll_server),
clock_(epoll_server),
- random_generator_(QuicRandom::GetInstance()) {
-}
+ random_generator_(QuicRandom::GetInstance()) {}
-QuicEpollConnectionHelper::~QuicEpollConnectionHelper() {
-}
+QuicEpollConnectionHelper::~QuicEpollConnectionHelper() {}
const QuicClock* QuicEpollConnectionHelper::GetClock() const {
return &clock_;
diff --git a/net/tools/quic/quic_in_memory_cache.cc b/net/tools/quic/quic_in_memory_cache.cc
index fd77050..132d5d6 100644
--- a/net/tools/quic/quic_in_memory_cache.cc
+++ b/net/tools/quic/quic_in_memory_cache.cc
@@ -120,9 +120,7 @@ void QuicInMemoryCache::InitializeFromDirectory(const string& cache_directory) {
VLOG(1) << "Attempting to initialize QuicInMemoryCache from directory: "
<< cache_directory;
FilePath directory(FilePath::FromUTF8Unsafe(cache_directory));
- base::FileEnumerator file_list(directory,
- true,
- base::FileEnumerator::FILES);
+ base::FileEnumerator file_list(directory, true, base::FileEnumerator::FILES);
for (FilePath file_iter = file_list.Next(); !file_iter.empty();
file_iter = file_list.Next()) {
@@ -141,8 +139,8 @@ void QuicInMemoryCache::InitializeFromDirectory(const string& cache_directory) {
string file_contents;
base::ReadFileToString(file_iter, &file_contents);
int file_len = static_cast<int>(file_contents.length());
- int headers_end = HttpUtil::LocateEndOfHeaders(file_contents.data(),
- file_len);
+ int headers_end =
+ HttpUtil::LocateEndOfHeaders(file_contents.data(), file_len);
if (headers_end < 1) {
LOG(DFATAL) << "Headers invalid or empty, ignoring: " << file;
continue;
diff --git a/net/tools/quic/quic_in_memory_cache.h b/net/tools/quic/quic_in_memory_cache.h
index f6ef75b..fa3f520 100644
--- a/net/tools/quic/quic_in_memory_cache.h
+++ b/net/tools/quic/quic_in_memory_cache.h
@@ -21,7 +21,8 @@ using std::list;
namespace base {
-template <typename Type> struct DefaultSingletonTraits;
+template <typename Type>
+struct DefaultSingletonTraits;
} // namespace base
@@ -55,7 +56,7 @@ class QuicInMemoryCache {
enum SpecialResponseType {
REGULAR_RESPONSE, // Send the headers and body like a server should.
CLOSE_CONNECTION, // Close the connection (sending the close packet).
- IGNORE_REQUEST, // Do nothing, expect the client to time out.
+ IGNORE_REQUEST, // Do nothing, expect the client to time out.
};
// Container for response header/body pairs.
@@ -72,13 +73,9 @@ class QuicInMemoryCache {
void set_response_type(SpecialResponseType response_type) {
response_type_ = response_type;
}
- void set_headers(const SpdyHeaderBlock& headers) {
- headers_ = headers;
- }
+ void set_headers(const SpdyHeaderBlock& headers) { headers_ = headers; }
void set_trailers(const SpdyHeaderBlock& trailers) { trailers_ = trailers; }
- void set_body(base::StringPiece body) {
- body.CopyToString(&body_);
- }
+ void set_body(base::StringPiece body) { body.CopyToString(&body_); }
private:
SpecialResponseType response_type_;
diff --git a/net/tools/quic/quic_in_memory_cache_test.cc b/net/tools/quic/quic_in_memory_cache_test.cc
index dbfc1a7..227d615 100644
--- a/net/tools/quic/quic_in_memory_cache_test.cc
+++ b/net/tools/quic/quic_in_memory_cache_test.cc
@@ -33,9 +33,7 @@ typedef QuicInMemoryCache::ServerPushInfo ServerPushInfo;
class QuicInMemoryCacheTest : public ::testing::Test {
protected:
- QuicInMemoryCacheTest() {
- QuicInMemoryCachePeer::ResetForTests();
- }
+ QuicInMemoryCacheTest() { QuicInMemoryCachePeer::ResetForTests(); }
~QuicInMemoryCacheTest() override { QuicInMemoryCachePeer::ResetForTests(); }
@@ -47,8 +45,8 @@ class QuicInMemoryCacheTest : public ::testing::Test {
string CacheDirectory() {
base::FilePath path;
PathService::Get(base::DIR_SOURCE_ROOT, &path);
- path = path.AppendASCII("net").AppendASCII("data")
- .AppendASCII("quic_in_memory_cache_data");
+ path = path.AppendASCII("net").AppendASCII("data").AppendASCII(
+ "quic_in_memory_cache_data");
// The file path is known to be an ascii string.
return path.MaybeAsASCII();
}
diff --git a/net/tools/quic/quic_packet_reader.cc b/net/tools/quic/quic_packet_reader.cc
index 90f0587..a8948c7 100644
--- a/net/tools/quic/quic_packet_reader.cc
+++ b/net/tools/quic/quic_packet_reader.cc
@@ -54,8 +54,7 @@ void QuicPacketReader::Initialize() {
}
}
-QuicPacketReader::~QuicPacketReader() {
-}
+QuicPacketReader::~QuicPacketReader() {}
bool QuicPacketReader::ReadAndDispatchPackets(
int fd,
diff --git a/net/tools/quic/quic_per_connection_packet_writer.cc b/net/tools/quic/quic_per_connection_packet_writer.cc
index 0a7d77a..0d984ec 100644
--- a/net/tools/quic/quic_per_connection_packet_writer.cc
+++ b/net/tools/quic/quic_per_connection_packet_writer.cc
@@ -11,21 +11,16 @@ namespace tools {
QuicPerConnectionPacketWriter::QuicPerConnectionPacketWriter(
QuicPacketWriter* shared_writer,
QuicConnection* connection)
- : shared_writer_(shared_writer),
- connection_(connection) {
-}
+ : shared_writer_(shared_writer), connection_(connection) {}
-QuicPerConnectionPacketWriter::~QuicPerConnectionPacketWriter() {
-}
+QuicPerConnectionPacketWriter::~QuicPerConnectionPacketWriter() {}
WriteResult QuicPerConnectionPacketWriter::WritePacket(
const char* buffer,
size_t buf_len,
const IPAddressNumber& self_address,
const IPEndPoint& peer_address) {
- return shared_writer_->WritePacket(buffer,
- buf_len,
- self_address,
+ return shared_writer_->WritePacket(buffer, buf_len, self_address,
peer_address);
}
diff --git a/net/tools/quic/quic_per_connection_packet_writer.h b/net/tools/quic/quic_per_connection_packet_writer.h
index ae3175f..d79cb4b 100644
--- a/net/tools/quic/quic_per_connection_packet_writer.h
+++ b/net/tools/quic/quic_per_connection_packet_writer.h
@@ -37,7 +37,7 @@ class QuicPerConnectionPacketWriter : public QuicPacketWriter {
private:
QuicPacketWriter* shared_writer_; // Not owned.
- QuicConnection* connection_; // Not owned.
+ QuicConnection* connection_; // Not owned.
DISALLOW_COPY_AND_ASSIGN(QuicPerConnectionPacketWriter);
};
diff --git a/net/tools/quic/quic_server.cc b/net/tools/quic/quic_server.cc
index b68b7be..7fd2140 100644
--- a/net/tools/quic/quic_server.cc
+++ b/net/tools/quic/quic_server.cc
@@ -97,13 +97,11 @@ void QuicServer::Initialize() {
QuicEpollClock clock(&epoll_server_);
scoped_ptr<CryptoHandshakeMessage> scfg(
- crypto_config_.AddDefaultConfig(
- QuicRandom::GetInstance(), &clock,
- QuicCryptoServerConfig::ConfigOptions()));
+ crypto_config_.AddDefaultConfig(QuicRandom::GetInstance(), &clock,
+ QuicCryptoServerConfig::ConfigOptions()));
}
-QuicServer::~QuicServer() {
-}
+QuicServer::~QuicServer() {}
bool QuicServer::Listen(const IPEndPoint& address) {
port_ = address.port();
@@ -124,8 +122,8 @@ bool QuicServer::Listen(const IPEndPoint& address) {
}
int get_overflow = 1;
- rc = setsockopt(
- fd_, SOL_SOCKET, SO_RXQ_OVFL, &get_overflow, sizeof(get_overflow));
+ rc = setsockopt(fd_, SOL_SOCKET, SO_RXQ_OVFL, &get_overflow,
+ sizeof(get_overflow));
if (rc < 0) {
DLOG(WARNING) << "Socket overflow detection not supported";
@@ -149,9 +147,8 @@ bool QuicServer::Listen(const IPEndPoint& address) {
socklen_t raw_addr_len = sizeof(raw_addr);
CHECK(address.ToSockAddr(reinterpret_cast<sockaddr*>(&raw_addr),
&raw_addr_len));
- rc = bind(fd_,
- reinterpret_cast<const sockaddr*>(&raw_addr),
- sizeof(raw_addr));
+ rc =
+ bind(fd_, reinterpret_cast<const sockaddr*>(&raw_addr), sizeof(raw_addr));
if (rc < 0) {
LOG(ERROR) << "Bind failed: " << strerror(errno);
return false;
@@ -182,12 +179,9 @@ QuicDefaultPacketWriter* QuicServer::CreateWriter(int fd) {
}
QuicDispatcher* QuicServer::CreateQuicDispatcher() {
- return new QuicDispatcher(
- config_,
- &crypto_config_,
- supported_versions_,
- new QuicDispatcher::DefaultPacketWriterFactory(),
- new QuicEpollConnectionHelper(&epoll_server_));
+ return new QuicDispatcher(config_, &crypto_config_, supported_versions_,
+ new QuicDispatcher::DefaultPacketWriterFactory(),
+ new QuicEpollConnectionHelper(&epoll_server_));
}
void QuicServer::WaitForEvents() {
diff --git a/net/tools/quic/quic_server.h b/net/tools/quic/quic_server.h
index e3f4339..14912a4 100644
--- a/net/tools/quic/quic_server.h
+++ b/net/tools/quic/quic_server.h
@@ -78,9 +78,7 @@ class QuicServer : public EpollCallbackInterface {
virtual QuicDispatcher* CreateQuicDispatcher();
const QuicConfig& config() const { return config_; }
- const QuicCryptoServerConfig& crypto_config() const {
- return crypto_config_;
- }
+ const QuicCryptoServerConfig& crypto_config() const { return crypto_config_; }
const QuicVersionVector& supported_versions() const {
return supported_versions_;
}
diff --git a/net/tools/quic/quic_server_bin.cc b/net/tools/quic/quic_server_bin.cc
index 93e0fe21..651480c 100644
--- a/net/tools/quic/quic_server_bin.cc
+++ b/net/tools/quic/quic_server_bin.cc
@@ -29,7 +29,7 @@ net::ProofSource* CreateProofSource(const base::FilePath& cert_path,
return proof_source;
}
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[]) {
base::AtExitManager exit_manager;
base::MessageLoopForIO message_loop;
diff --git a/net/tools/quic/quic_server_session_test.cc b/net/tools/quic/quic_server_session_test.cc
index 33c8a64..6fb9f86 100644
--- a/net/tools/quic/quic_server_session_test.cc
+++ b/net/tools/quic/quic_server_session_test.cc
@@ -82,8 +82,7 @@ class QuicServerSessionTest : public ::testing::TestWithParam<QuicVersion> {
: crypto_config_(QuicCryptoServerConfig::TESTING,
QuicRandom::GetInstance(),
CryptoTestUtils::ProofSourceForTesting()) {
- config_.SetMaxStreamsPerConnection(kMaxStreamsForTest,
- kMaxStreamsForTest);
+ config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest);
config_.SetInitialStreamFlowControlWindowToSend(
kInitialStreamFlowControlWindowForTest);
config_.SetInitialSessionFlowControlWindowToSend(
@@ -115,19 +114,20 @@ class QuicServerSessionTest : public ::testing::TestWithParam<QuicVersion> {
MATCHER_P(EqualsProto, network_params, "") {
CachedNetworkParameters reference(network_params);
return (arg->bandwidth_estimate_bytes_per_second() ==
- reference.bandwidth_estimate_bytes_per_second() &&
+ reference.bandwidth_estimate_bytes_per_second() &&
arg->bandwidth_estimate_bytes_per_second() ==
- reference.bandwidth_estimate_bytes_per_second() &&
+ reference.bandwidth_estimate_bytes_per_second() &&
arg->max_bandwidth_estimate_bytes_per_second() ==
- reference.max_bandwidth_estimate_bytes_per_second() &&
+ reference.max_bandwidth_estimate_bytes_per_second() &&
arg->max_bandwidth_timestamp_seconds() ==
- reference.max_bandwidth_timestamp_seconds() &&
+ reference.max_bandwidth_timestamp_seconds() &&
arg->min_rtt_ms() == reference.min_rtt_ms() &&
arg->previous_connection_state() ==
- reference.previous_connection_state());
+ reference.previous_connection_state());
}
-INSTANTIATE_TEST_CASE_P(Tests, QuicServerSessionTest,
+INSTANTIATE_TEST_CASE_P(Tests,
+ QuicServerSessionTest,
::testing::ValuesIn(QuicSupportedVersions()));
TEST_P(QuicServerSessionTest, CloseStreamDueToReset) {
@@ -303,8 +303,9 @@ TEST_P(QuicServerSessionTest, SetFecProtectionFromConfig) {
// Verify that headers stream is always protected and data streams are
// optionally protected.
- EXPECT_EQ(FEC_PROTECT_ALWAYS, QuicSpdySessionPeer::GetHeadersStream(
- session_.get())->fec_policy());
+ EXPECT_EQ(
+ FEC_PROTECT_ALWAYS,
+ QuicSpdySessionPeer::GetHeadersStream(session_.get())->fec_policy());
ReliableQuicStream* stream = QuicServerSessionPeer::GetOrCreateDynamicStream(
session_.get(), kClientDataStreamId1);
ASSERT_TRUE(stream);
@@ -314,7 +315,8 @@ TEST_P(QuicServerSessionTest, SetFecProtectionFromConfig) {
class MockQuicCryptoServerStream : public QuicCryptoServerStream {
public:
explicit MockQuicCryptoServerStream(
- const QuicCryptoServerConfig* crypto_config, QuicSession* session)
+ const QuicCryptoServerConfig* crypto_config,
+ QuicSession* session)
: QuicCryptoServerStream(crypto_config, session) {}
~MockQuicCryptoServerStream() override {}
@@ -361,8 +363,9 @@ TEST_P(QuicServerSessionTest, BandwidthEstimates) {
// Seed an rtt measurement equal to the initial default rtt.
RttStats* rtt_stats =
QuicSentPacketManagerPeer::GetRttStats(sent_packet_manager);
- rtt_stats->UpdateRtt(QuicTime::Delta::FromMicroseconds(
- rtt_stats->initial_rtt_us()), QuicTime::Delta::Zero(), QuicTime::Zero());
+ rtt_stats->UpdateRtt(
+ QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us()),
+ QuicTime::Delta::Zero(), QuicTime::Zero());
QuicSustainedBandwidthRecorderPeer::SetBandwidthEstimate(
&bandwidth_recorder, bandwidth_estimate_kbytes_per_second);
QuicSustainedBandwidthRecorderPeer::SetMaxBandwidthEstimate(
@@ -444,9 +447,8 @@ TEST_P(QuicServerSessionTest, BandwidthResumptionExperiment) {
connection_->AdvanceTime(
QuicTime::Delta::FromSeconds(kNumSecondsPerHour + 1));
- QuicCryptoServerStream* crypto_stream =
- static_cast<QuicCryptoServerStream*>(
- QuicSessionPeer::GetCryptoStream(session_.get()));
+ QuicCryptoServerStream* crypto_stream = static_cast<QuicCryptoServerStream*>(
+ QuicSessionPeer::GetCryptoStream(session_.get()));
// No effect if no CachedNetworkParameters provided.
EXPECT_CALL(*connection_, ResumeConnectionState(_, _)).Times(0);
diff --git a/net/tools/quic/quic_simple_client.cc b/net/tools/quic/quic_simple_client.cc
index fc51d53..72da54c 100644
--- a/net/tools/quic/quic_simple_client.cc
+++ b/net/tools/quic/quic_simple_client.cc
@@ -65,8 +65,8 @@ QuicSimpleClient::QuicSimpleClient(IPEndPoint server_address,
QuicSimpleClient::~QuicSimpleClient() {
if (connected()) {
- session()->connection()->SendConnectionClosePacket(
- QUIC_PEER_GOING_AWAY, "");
+ session()->connection()->SendConnectionClosePacket(QUIC_PEER_GOING_AWAY,
+ "");
}
STLDeleteElements(&data_to_resend_on_connect_);
STLDeleteElements(&data_sent_before_handshake_);
@@ -98,10 +98,8 @@ QuicSimpleClient::QuicDataToResend::~QuicDataToResend() {
bool QuicSimpleClient::CreateUDPSocket() {
scoped_ptr<UDPClientSocket> socket(
- new UDPClientSocket(DatagramSocket::DEFAULT_BIND,
- RandIntCallback(),
- &net_log_,
- NetLog::Source()));
+ new UDPClientSocket(DatagramSocket::DEFAULT_BIND, RandIntCallback(),
+ &net_log_, NetLog::Source()));
int address_family = server_address_.GetSockAddrFamily();
if (bind_to_address_.size() != 0) {
@@ -286,7 +284,8 @@ void QuicSimpleClient::SendRequestAndWaitForResponse(
StringPiece body,
bool fin) {
SendRequest(request, body, fin);
- while (WaitForEvents()) {}
+ while (WaitForEvents()) {
+ }
}
void QuicSimpleClient::SendRequestsAndWaitForResponse(
@@ -298,7 +297,8 @@ void QuicSimpleClient::SendRequestsAndWaitForResponse(
SendRequest(request, "", true);
}
- while (WaitForEvents()) {}
+ while (WaitForEvents()) {
+ }
}
bool QuicSimpleClient::WaitForEvents() {
@@ -345,8 +345,8 @@ void QuicSimpleClient::OnClose(QuicSpdyStream* stream) {
HttpResponseInfo response;
SpdyHeadersToHttpResponse(client_stream->headers(), net::HTTP2, &response);
if (response_listener_.get() != nullptr) {
- response_listener_->OnCompleteResponse(
- stream->id(), *response.headers, client_stream->data());
+ response_listener_->OnCompleteResponse(stream->id(), *response.headers,
+ client_stream->data());
}
// Store response headers and body.
diff --git a/net/tools/quic/quic_simple_client_bin.cc b/net/tools/quic/quic_simple_client_bin.cc
index 0217fa5..39e80ba 100644
--- a/net/tools/quic/quic_simple_client_bin.cc
+++ b/net/tools/quic/quic_simple_client_bin.cc
@@ -133,7 +133,7 @@ static bool DecodeHexString(const base::StringPiece& hex, std::string* bytes) {
return true;
};
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[]) {
base::CommandLine::Init(argc, argv);
base::CommandLine* line = base::CommandLine::ForCurrentProcess();
const base::CommandLine::StringVector& urls = line->GetArgs();
@@ -241,8 +241,8 @@ int main(int argc, char *argv[]) {
net::AddressList addresses;
int rv = net::tools::SynchronousHostResolver::Resolve(host, &addresses);
if (rv != net::OK) {
- LOG(ERROR) << "Unable to resolve '" << host << "' : "
- << net::ErrorToShortString(rv);
+ LOG(ERROR) << "Unable to resolve '" << host
+ << "' : " << net::ErrorToShortString(rv);
return 1;
}
ip_addr = addresses[0].address();
diff --git a/net/tools/quic/quic_simple_per_connection_packet_writer.cc b/net/tools/quic/quic_simple_per_connection_packet_writer.cc
index 2bcaf4b..bc6e45f 100644
--- a/net/tools/quic/quic_simple_per_connection_packet_writer.cc
+++ b/net/tools/quic/quic_simple_per_connection_packet_writer.cc
@@ -15,11 +15,9 @@ QuicSimplePerConnectionPacketWriter::QuicSimplePerConnectionPacketWriter(
QuicConnection* connection)
: shared_writer_(shared_writer),
connection_(connection),
- weak_factory_(this){
-}
+ weak_factory_(this) {}
-QuicSimplePerConnectionPacketWriter::~QuicSimplePerConnectionPacketWriter() {
-}
+QuicSimplePerConnectionPacketWriter::~QuicSimplePerConnectionPacketWriter() {}
QuicPacketWriter* QuicSimplePerConnectionPacketWriter::shared_writer() const {
return shared_writer_;
@@ -31,10 +29,7 @@ WriteResult QuicSimplePerConnectionPacketWriter::WritePacket(
const IPAddressNumber& self_address,
const IPEndPoint& peer_address) {
return shared_writer_->WritePacketWithCallback(
- buffer,
- buf_len,
- self_address,
- peer_address,
+ buffer, buf_len, self_address, peer_address,
base::Bind(&QuicSimplePerConnectionPacketWriter::OnWriteComplete,
weak_factory_.GetWeakPtr()));
}
diff --git a/net/tools/quic/quic_simple_per_connection_packet_writer.h b/net/tools/quic/quic_simple_per_connection_packet_writer.h
index 1634e6b..c1441ba 100644
--- a/net/tools/quic/quic_simple_per_connection_packet_writer.h
+++ b/net/tools/quic/quic_simple_per_connection_packet_writer.h
@@ -44,7 +44,7 @@ class QuicSimplePerConnectionPacketWriter : public QuicPacketWriter {
void OnWriteComplete(WriteResult result);
QuicSimpleServerPacketWriter* shared_writer_; // Not owned.
- QuicConnection* connection_; // Not owned.
+ QuicConnection* connection_; // Not owned.
base::WeakPtrFactory<QuicSimplePerConnectionPacketWriter> weak_factory_;
diff --git a/net/tools/quic/quic_simple_server.cc b/net/tools/quic/quic_simple_server.cc
index 8788886..08f8572 100644
--- a/net/tools/quic/quic_simple_server.cc
+++ b/net/tools/quic/quic_simple_server.cc
@@ -61,7 +61,7 @@ class CustomPacketWriterFactory : public QuicDispatcher::PacketWriterFactory {
QuicSimpleServerPacketWriter* shared_writer_; // Not owned.
};
-} // namespace
+} // namespace
QuicSimpleServer::QuicSimpleServer(ProofSource* proof_source,
const QuicConfig& config,
@@ -107,8 +107,7 @@ void QuicSimpleServer::Initialize() {
QuicCryptoServerConfig::ConfigOptions()));
}
-QuicSimpleServer::~QuicSimpleServer() {
-}
+QuicSimpleServer::~QuicSimpleServer() {}
int QuicSimpleServer::Listen(const IPEndPoint& address) {
scoped_ptr<UDPServerSocket> socket(
@@ -151,9 +150,8 @@ int QuicSimpleServer::Listen(const IPEndPoint& address) {
CustomPacketWriterFactory* factory = new CustomPacketWriterFactory();
dispatcher_.reset(new QuicDispatcher(config_, &crypto_config_,
supported_versions_, factory, helper_));
- QuicSimpleServerPacketWriter* writer = new QuicSimpleServerPacketWriter(
- socket_.get(),
- dispatcher_.get());
+ QuicSimpleServerPacketWriter* writer =
+ new QuicSimpleServerPacketWriter(socket_.get(), dispatcher_.get());
factory->set_shared_writer(writer);
dispatcher_->InitializeWithWriter(writer);
@@ -178,9 +176,7 @@ void QuicSimpleServer::StartReading() {
read_pending_ = true;
int result = socket_->RecvFrom(
- read_buffer_.get(),
- read_buffer_->size(),
- &client_address_,
+ read_buffer_.get(), read_buffer_->size(), &client_address_,
base::Bind(&QuicSimpleServer::OnReadComplete, base::Unretained(this)));
if (result == ERR_IO_PENDING) {
diff --git a/net/tools/quic/quic_simple_server_bin.cc b/net/tools/quic/quic_simple_server_bin.cc
index d6f0c640..26b58b8 100644
--- a/net/tools/quic/quic_simple_server_bin.cc
+++ b/net/tools/quic/quic_simple_server_bin.cc
@@ -29,7 +29,7 @@ net::ProofSource* CreateProofSource(const base::FilePath& cert_path,
return proof_source;
}
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[]) {
base::AtExitManager exit_manager;
base::MessageLoopForIO message_loop;
diff --git a/net/tools/quic/quic_simple_server_packet_writer.cc b/net/tools/quic/quic_simple_server_packet_writer.cc
index 78ac16f..5754875 100644
--- a/net/tools/quic/quic_simple_server_packet_writer.cc
+++ b/net/tools/quic/quic_simple_server_packet_writer.cc
@@ -21,11 +21,9 @@ QuicSimpleServerPacketWriter::QuicSimpleServerPacketWriter(
: socket_(socket),
blocked_writer_(blocked_writer),
write_blocked_(false),
- weak_factory_(this) {
-}
+ weak_factory_(this) {}
-QuicSimpleServerPacketWriter::~QuicSimpleServerPacketWriter() {
-}
+QuicSimpleServerPacketWriter::~QuicSimpleServerPacketWriter() {}
WriteResult QuicSimpleServerPacketWriter::WritePacketWithCallback(
const char* buffer,
@@ -75,12 +73,9 @@ WriteResult QuicSimpleServerPacketWriter::WritePacket(
int rv;
if (buf_len <= static_cast<size_t>(std::numeric_limits<int>::max())) {
rv = socket_->SendTo(
- buf.get(),
- static_cast<int>(buf_len),
- peer_address,
- base::Bind(
- &QuicSimpleServerPacketWriter::OnWriteComplete,
- weak_factory_.GetWeakPtr()));
+ buf.get(), static_cast<int>(buf_len), peer_address,
+ base::Bind(&QuicSimpleServerPacketWriter::OnWriteComplete,
+ weak_factory_.GetWeakPtr()));
} else {
rv = ERR_MSG_TOO_BIG;
}
diff --git a/net/tools/quic/quic_simple_server_packet_writer.h b/net/tools/quic/quic_simple_server_packet_writer.h
index 613c11b..7bf934b 100644
--- a/net/tools/quic/quic_simple_server_packet_writer.h
+++ b/net/tools/quic/quic_simple_server_packet_writer.h
@@ -28,7 +28,7 @@ class QuicSimpleServerPacketWriter : public QuicPacketWriter {
typedef base::Callback<void(WriteResult)> WriteCallback;
QuicSimpleServerPacketWriter(UDPServerSocket* socket,
- QuicBlockedWriterInterface* blocked_writer);
+ QuicBlockedWriterInterface* blocked_writer);
~QuicSimpleServerPacketWriter() override;
// Use this method to write packets rather than WritePacket:
diff --git a/net/tools/quic/quic_simple_server_test.cc b/net/tools/quic/quic_simple_server_test.cc
index dea0a72..c941f44 100644
--- a/net/tools/quic/quic_simple_server_test.cc
+++ b/net/tools/quic/quic_simple_server_test.cc
@@ -44,17 +44,15 @@ class QuicChromeServerDispatchPacketTest : public ::testing::Test {
};
TEST_F(QuicChromeServerDispatchPacketTest, DispatchPacket) {
- unsigned char valid_packet[] = {
- // public flags (8 byte connection_id)
- 0x3C,
- // connection_id
- 0x10, 0x32, 0x54, 0x76,
- 0x98, 0xBA, 0xDC, 0xFE,
- // packet sequence number
- 0xBC, 0x9A, 0x78, 0x56,
- 0x34, 0x12,
- // private flags
- 0x00 };
+ unsigned char valid_packet[] = {// public flags (8 byte connection_id)
+ 0x3C,
+ // connection_id
+ 0x10, 0x32, 0x54, 0x76, 0x98, 0xBA, 0xDC,
+ 0xFE,
+ // packet sequence number
+ 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12,
+ // private flags
+ 0x00};
QuicEncryptedPacket encrypted_valid_packet(QuicUtils::AsChars(valid_packet),
arraysize(valid_packet), false);
diff --git a/net/tools/quic/quic_socket_utils.cc b/net/tools/quic/quic_socket_utils.cc
index c2d6540..262c608 100644
--- a/net/tools/quic/quic_socket_utils.cc
+++ b/net/tools/quic/quic_socket_utils.cc
@@ -25,17 +25,16 @@ namespace tools {
// static
IPAddressNumber QuicSocketUtils::GetAddressFromMsghdr(struct msghdr* hdr) {
if (hdr->msg_controllen > 0) {
- for (cmsghdr* cmsg = CMSG_FIRSTHDR(hdr);
- cmsg != nullptr;
+ for (cmsghdr* cmsg = CMSG_FIRSTHDR(hdr); cmsg != nullptr;
cmsg = CMSG_NXTHDR(hdr, cmsg)) {
const uint8* addr_data = nullptr;
int len = 0;
if (cmsg->cmsg_type == IPV6_PKTINFO) {
- in6_pktinfo* info = reinterpret_cast<in6_pktinfo*>CMSG_DATA(cmsg);
+ in6_pktinfo* info = reinterpret_cast<in6_pktinfo*> CMSG_DATA(cmsg);
addr_data = reinterpret_cast<const uint8*>(&info->ipi6_addr);
len = sizeof(in6_addr);
} else if (cmsg->cmsg_type == IP_PKTINFO) {
- in_pktinfo* info = reinterpret_cast<in_pktinfo*>CMSG_DATA(cmsg);
+ in_pktinfo* info = reinterpret_cast<in_pktinfo*> CMSG_DATA(cmsg);
addr_data = reinterpret_cast<const uint8*>(&info->ipi_addr);
len = sizeof(in_addr);
} else {
@@ -53,11 +52,10 @@ bool QuicSocketUtils::GetOverflowFromMsghdr(struct msghdr* hdr,
QuicPacketCount* dropped_packets) {
if (hdr->msg_controllen > 0) {
struct cmsghdr* cmsg;
- for (cmsg = CMSG_FIRSTHDR(hdr);
- cmsg != nullptr;
+ for (cmsg = CMSG_FIRSTHDR(hdr); cmsg != nullptr;
cmsg = CMSG_NXTHDR(hdr, cmsg)) {
if (cmsg->cmsg_type == SO_RXQ_OVFL) {
- *dropped_packets = *(reinterpret_cast<int*>CMSG_DATA(cmsg));
+ *dropped_packets = *(reinterpret_cast<int*> CMSG_DATA(cmsg));
return true;
}
}
@@ -68,11 +66,11 @@ bool QuicSocketUtils::GetOverflowFromMsghdr(struct msghdr* hdr,
// static
int QuicSocketUtils::SetGetAddressInfo(int fd, int address_family) {
int get_local_ip = 1;
- int rc = setsockopt(fd, IPPROTO_IP, IP_PKTINFO,
- &get_local_ip, sizeof(get_local_ip));
+ int rc = setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &get_local_ip,
+ sizeof(get_local_ip));
if (rc == 0 && address_family == AF_INET6) {
- rc = setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO,
- &get_local_ip, sizeof(get_local_ip));
+ rc = setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &get_local_ip,
+ sizeof(get_local_ip));
}
return rc;
}
@@ -96,7 +94,9 @@ bool QuicSocketUtils::SetReceiveBufferSize(int fd, size_t size) {
}
// static
-int QuicSocketUtils::ReadPacket(int fd, char* buffer, size_t buf_len,
+int QuicSocketUtils::ReadPacket(int fd,
+ char* buffer,
+ size_t buf_len,
QuicPacketCount* dropped_packets,
IPAddressNumber* self_address,
IPEndPoint* peer_address) {
@@ -183,8 +183,7 @@ WriteResult QuicSocketUtils::WritePacket(int fd,
sockaddr_storage raw_address;
socklen_t address_len = sizeof(raw_address);
CHECK(peer_address.ToSockAddr(
- reinterpret_cast<struct sockaddr*>(&raw_address),
- &address_len));
+ reinterpret_cast<struct sockaddr*>(&raw_address), &address_len));
iovec iov = {const_cast<char*>(buffer), buf_len};
msghdr hdr;
@@ -215,8 +214,10 @@ WriteResult QuicSocketUtils::WritePacket(int fd,
if (rc >= 0) {
return WriteResult(WRITE_STATUS_OK, rc);
}
- return WriteResult((errno == EAGAIN || errno == EWOULDBLOCK) ?
- WRITE_STATUS_BLOCKED : WRITE_STATUS_ERROR, errno);
+ return WriteResult((errno == EAGAIN || errno == EWOULDBLOCK)
+ ? WRITE_STATUS_BLOCKED
+ : WRITE_STATUS_ERROR,
+ errno);
}
} // namespace tools
diff --git a/net/tools/quic/quic_spdy_client_stream.cc b/net/tools/quic/quic_spdy_client_stream.cc
index 6e10696..a77cab7 100644
--- a/net/tools/quic/quic_spdy_client_stream.cc
+++ b/net/tools/quic/quic_spdy_client_stream.cc
@@ -28,8 +28,7 @@ QuicSpdyClientStream::QuicSpdyClientStream(QuicStreamId id,
header_bytes_written_(0),
allow_bidirectional_data_(false) {}
-QuicSpdyClientStream::~QuicSpdyClientStream() {
-}
+QuicSpdyClientStream::~QuicSpdyClientStream() {}
void QuicSpdyClientStream::OnStreamFrame(const QuicStreamFrame& frame) {
if (!allow_bidirectional_data_ && !write_side_closed()) {
@@ -117,8 +116,7 @@ size_t QuicSpdyClientStream::SendRequest(const SpdyHeaderBlock& headers,
bool fin) {
bool send_fin_with_headers = fin && body.empty();
size_t bytes_sent = body.size();
- header_bytes_written_ =
- WriteHeaders(headers, send_fin_with_headers, nullptr);
+ header_bytes_written_ = WriteHeaders(headers, send_fin_with_headers, nullptr);
bytes_sent += header_bytes_written_;
if (!body.empty()) {
diff --git a/net/tools/quic/quic_time_wait_list_manager.cc b/net/tools/quic/quic_time_wait_list_manager.cc
index c9405a5..9909420 100644
--- a/net/tools/quic/quic_time_wait_list_manager.cc
+++ b/net/tools/quic/quic_time_wait_list_manager.cc
@@ -32,8 +32,7 @@ class ConnectionIdCleanUpAlarm : public QuicAlarm::Delegate {
public:
explicit ConnectionIdCleanUpAlarm(
QuicTimeWaitListManager* time_wait_list_manager)
- : time_wait_list_manager_(time_wait_list_manager) {
- }
+ : time_wait_list_manager_(time_wait_list_manager) {}
QuicTime OnAlarm() override {
time_wait_list_manager_->CleanUpOldConnectionIds();
@@ -62,8 +61,7 @@ class QuicTimeWaitListManager::QueuedPacket {
QuicEncryptedPacket* packet)
: server_address_(server_address),
client_address_(client_address),
- packet_(packet) {
- }
+ packet_(packet) {}
const IPEndPoint& server_address() const { return server_address_; }
const IPEndPoint& client_address() const { return client_address_; }
@@ -95,8 +93,7 @@ QuicTimeWaitListManager::~QuicTimeWaitListManager() {
connection_id_clean_up_alarm_->Cancel();
STLDeleteElements(&pending_packets_queue_);
for (ConnectionIdMap::iterator it = connection_id_map_.begin();
- it != connection_id_map_.end();
- ++it) {
+ it != connection_id_map_.end(); ++it) {
STLDeleteElements(&it->second.termination_packets);
}
}
@@ -213,10 +210,8 @@ void QuicTimeWaitListManager::SendPublicReset(
// TODO(satyamshekhar): generate a valid nonce for this connection_id.
packet.nonce_proof = 1010101;
packet.client_address = client_address;
- QueuedPacket* queued_packet = new QueuedPacket(
- server_address,
- client_address,
- BuildPublicReset(packet));
+ QueuedPacket* queued_packet = new QueuedPacket(server_address, client_address,
+ BuildPublicReset(packet));
// Takes ownership of the packet.
SendOrQueuePacket(queued_packet);
}
@@ -243,8 +238,7 @@ bool QuicTimeWaitListManager::WriteToWire(QueuedPacket* queued_packet) {
return false;
}
WriteResult result = writer_->WritePacket(
- queued_packet->packet()->data(),
- queued_packet->packet()->length(),
+ queued_packet->packet()->data(), queued_packet->packet()->length(),
queued_packet->server_address().address(),
queued_packet->client_address());
if (result.status == WRITE_STATUS_BLOCKED) {
diff --git a/net/tools/quic/quic_time_wait_list_manager_test.cc b/net/tools/quic/quic_time_wait_list_manager_test.cc
index 0e925cb..f77c9b3 100644
--- a/net/tools/quic/quic_time_wait_list_manager_test.cc
+++ b/net/tools/quic/quic_time_wait_list_manager_test.cc
@@ -88,8 +88,8 @@ namespace {
class MockFakeTimeEpollServer : public FakeTimeEpollServer {
public:
- MOCK_METHOD2(RegisterAlarm, void(int64 timeout_in_us,
- EpollAlarmCallbackInterface* alarm));
+ MOCK_METHOD2(RegisterAlarm,
+ void(int64 timeout_in_us, EpollAlarmCallbackInterface* alarm));
};
class QuicTimeWaitListManagerTest : public ::testing::Test {
@@ -161,7 +161,7 @@ class QuicTimeWaitListManagerTest : public ::testing::Test {
};
class ValidatePublicResetPacketPredicate
- : public MatcherInterface<const std::tr1::tuple<const char*, int> > {
+ : public MatcherInterface<const std::tr1::tuple<const char*, int>> {
public:
explicit ValidatePublicResetPacketPredicate(QuicConnectionId connection_id,
QuicPacketNumber number)
@@ -229,8 +229,7 @@ TEST_F(QuicTimeWaitListManagerTest, SendConnectionClose) {
&termination_packets);
const int kRandomSequenceNumber = 1;
EXPECT_CALL(writer_, WritePacket(_, kConnectionCloseLength,
- server_address_.address(),
- client_address_))
+ server_address_.address(), client_address_))
.WillOnce(Return(WriteResult(WRITE_STATUS_OK, 1)));
ProcessPacket(connection_id_, kRandomSequenceNumber);
@@ -260,11 +259,10 @@ TEST_F(QuicTimeWaitListManagerTest, SendPublicReset) {
EXPECT_CALL(visitor_, OnConnectionAddedToTimeWaitList(connection_id_));
AddConnectionId(connection_id_);
const int kRandomSequenceNumber = 1;
- EXPECT_CALL(writer_, WritePacket(_, _,
- server_address_.address(),
- client_address_))
- .With(Args<0, 1>(PublicResetPacketEq(connection_id_,
- kRandomSequenceNumber)))
+ EXPECT_CALL(writer_,
+ WritePacket(_, _, server_address_.address(), client_address_))
+ .With(Args<0, 1>(
+ PublicResetPacketEq(connection_id_, kRandomSequenceNumber)))
.WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0)));
ProcessPacket(connection_id_, kRandomSequenceNumber);
@@ -334,7 +332,7 @@ TEST_F(QuicTimeWaitListManagerTest, CleanUpOldConnectionIds) {
// After all the old connection_ids are cleaned up, check the next alarm
// interval.
int64 next_alarm_time = epoll_server_.ApproximateNowInUsec() +
- time_wait_period.Subtract(offset).ToMicroseconds();
+ time_wait_period.Subtract(offset).ToMicroseconds();
EXPECT_CALL(epoll_server_, RegisterAlarm(next_alarm_time, _));
for (size_t connection_id = 1; connection_id <= kConnectionIdCount;
@@ -349,7 +347,7 @@ TEST_F(QuicTimeWaitListManagerTest, CleanUpOldConnectionIds) {
EXPECT_EQ(connection_id > kOldConnectionIdCount,
IsConnectionIdInTimeWait(connection_id))
<< "kOldConnectionIdCount: " << kOldConnectionIdCount
- << " connection_id: " << connection_id;
+ << " connection_id: " << connection_id;
}
EXPECT_EQ(kConnectionIdCount - kOldConnectionIdCount,
time_wait_list_manager_.num_connections());
@@ -388,8 +386,7 @@ TEST_F(QuicTimeWaitListManagerTest, SendQueuedPackets) {
QuicPacketNumber other_packet_number = 23423;
scoped_ptr<QuicEncryptedPacket> other_packet(
ConstructEncryptedPacket(other_connection_id, other_packet_number));
- EXPECT_CALL(writer_, WritePacket(_, _, _, _))
- .Times(0);
+ EXPECT_CALL(writer_, WritePacket(_, _, _, _)).Times(0);
EXPECT_CALL(visitor_, OnWriteBlocked(&time_wait_list_manager_));
ProcessPacket(other_connection_id, other_packet_number);
EXPECT_EQ(2u, time_wait_list_manager_.num_connections());
@@ -450,10 +447,8 @@ TEST_F(QuicTimeWaitListManagerTest, AddConnectionIdTwice) {
EXPECT_TRUE(IsConnectionIdInTimeWait(connection_id_));
EXPECT_EQ(1u, time_wait_list_manager_.num_connections());
- EXPECT_CALL(writer_, WritePacket(_,
- kConnectionCloseLength,
- server_address_.address(),
- client_address_))
+ EXPECT_CALL(writer_, WritePacket(_, kConnectionCloseLength,
+ server_address_.address(), client_address_))
.WillOnce(Return(WriteResult(WRITE_STATUS_OK, 1)));
const int kRandomSequenceNumber = 1;
@@ -466,8 +461,8 @@ TEST_F(QuicTimeWaitListManagerTest, AddConnectionIdTwice) {
// Now set the current time as time_wait_period + offset usecs.
epoll_server_.set_now_in_usec(time_wait_period.Add(offset).ToMicroseconds());
// After the connection_ids are cleaned up, check the next alarm interval.
- int64 next_alarm_time = epoll_server_.ApproximateNowInUsec() +
- time_wait_period.ToMicroseconds();
+ int64 next_alarm_time =
+ epoll_server_.ApproximateNowInUsec() + time_wait_period.ToMicroseconds();
EXPECT_CALL(epoll_server_, RegisterAlarm(next_alarm_time, _));
EXPECT_CALL(visitor_, OnConnectionRemovedFromTimeWaitList(connection_id_));
diff --git a/net/tools/quic/synchronous_host_resolver.cc b/net/tools/quic/synchronous_host_resolver.cc
index d0fc1c7..d8523e8 100644
--- a/net/tools/quic/synchronous_host_resolver.cc
+++ b/net/tools/quic/synchronous_host_resolver.cc
@@ -64,12 +64,11 @@ void ResolverThread::Run() {
SingleRequestHostResolver resolver(resolver_impl.get());
HostPortPair host_port_pair(host_, 80);
- rv_ = resolver.Resolve(
- HostResolver::RequestInfo(host_port_pair), DEFAULT_PRIORITY,
- addresses_,
- base::Bind(&ResolverThread::OnResolutionComplete,
- weak_factory_.GetWeakPtr()),
- BoundNetLog());
+ rv_ = resolver.Resolve(HostResolver::RequestInfo(host_port_pair),
+ DEFAULT_PRIORITY, addresses_,
+ base::Bind(&ResolverThread::OnResolutionComplete,
+ weak_factory_.GetWeakPtr()),
+ BoundNetLog());
if (rv_ != ERR_IO_PENDING)
return;
diff --git a/net/tools/quic/test_tools/http_message.cc b/net/tools/quic/test_tools/http_message.cc
index b152091..0d18cd1 100644
--- a/net/tools/quic/test_tools/http_message.cc
+++ b/net/tools/quic/test_tools/http_message.cc
@@ -20,31 +20,18 @@ namespace test {
namespace {
-//const char kContentEncoding[] = "content-encoding";
+// const char kContentEncoding[] = "content-encoding";
const char kContentLength[] = "content-length";
const char kTransferCoding[] = "transfer-encoding";
// Both kHTTPVersionString and kMethodString arrays are constructed to match
// the enum values defined in Version and Method of HTTPMessage.
-const char* const kHTTPVersionString[] = {
- "",
- "HTTP/0.9",
- "HTTP/1.0",
- "HTTP/1.1"
-};
+const char* const kHTTPVersionString[] = {"", "HTTP/0.9", "HTTP/1.0",
+ "HTTP/1.1"};
const char* const kMethodString[] = {
- "",
- "OPTIONS",
- "GET",
- "HEAD",
- "POST",
- "PUT",
- "DELETE",
- "TRACE",
- "CONNECT",
- "MKCOL",
- "UNLOCK",
+ "", "OPTIONS", "GET", "HEAD", "POST", "PUT",
+ "DELETE", "TRACE", "CONNECT", "MKCOL", "UNLOCK",
};
// Returns true if the message represents a complete request or response.
@@ -101,8 +88,7 @@ const char* HTTPMessage::VersionToString(Version version) {
return kHTTPVersionString[version];
}
-HTTPMessage::HTTPMessage()
- : is_request_(true) {
+HTTPMessage::HTTPMessage() : is_request_(true) {
InitializeFields();
}
@@ -116,8 +102,7 @@ HTTPMessage::HTTPMessage(Version ver, Method request, const string& path)
headers()->SetRequestUri(path);
}
-HTTPMessage::~HTTPMessage() {
-}
+HTTPMessage::~HTTPMessage() {}
void HTTPMessage::InitializeFields() {
has_complete_message_ = true;
@@ -156,10 +141,10 @@ void HTTPMessage::ValidateMessage() const {
headers()->GetAllOfHeader(kTransferCoding, &transfer_encodings);
CHECK_GE(1ul, transfer_encodings.size());
for (vector<StringPiece>::iterator it = transfer_encodings.begin();
- it != transfer_encodings.end();
- ++it) {
+ it != transfer_encodings.end(); ++it) {
CHECK(base::EqualsCaseInsensitiveASCII("identity", *it) ||
- base::EqualsCaseInsensitiveASCII("chunked", *it)) << *it;
+ base::EqualsCaseInsensitiveASCII("chunked", *it))
+ << *it;
}
vector<StringPiece> content_lengths;
diff --git a/net/tools/quic/test_tools/http_message.h b/net/tools/quic/test_tools/http_message.h
index 6b63daf..a31c5c9 100644
--- a/net/tools/quic/test_tools/http_message.h
+++ b/net/tools/quic/test_tools/http_message.h
@@ -18,12 +18,7 @@ namespace test {
class HttpConstants {
public:
- enum Version {
- HTTP_UNKNOWN = 0,
- HTTP_0_9,
- HTTP_1_0,
- HTTP_1_1
- };
+ enum Version { HTTP_UNKNOWN = 0, HTTP_0_9, HTTP_1_0, HTTP_1_1 };
enum Method {
UNKNOWN_METHOD = 0,
diff --git a/net/tools/quic/test_tools/mock_epoll_server.cc b/net/tools/quic/test_tools/mock_epoll_server.cc
index 4101c5e..2b4f467 100644
--- a/net/tools/quic/test_tools/mock_epoll_server.cc
+++ b/net/tools/quic/test_tools/mock_epoll_server.cc
@@ -8,33 +8,27 @@ namespace net {
namespace tools {
namespace test {
-FakeTimeEpollServer::FakeTimeEpollServer(): now_in_usec_(0) {
-}
+FakeTimeEpollServer::FakeTimeEpollServer() : now_in_usec_(0) {}
-FakeTimeEpollServer::~FakeTimeEpollServer() {
-}
+FakeTimeEpollServer::~FakeTimeEpollServer() {}
int64 FakeTimeEpollServer::NowInUsec() const {
return now_in_usec_;
}
-MockEpollServer::MockEpollServer() : until_in_usec_(-1) {
-}
+MockEpollServer::MockEpollServer() : until_in_usec_(-1) {}
-MockEpollServer::~MockEpollServer() {
-}
+MockEpollServer::~MockEpollServer() {}
int MockEpollServer::epoll_wait_impl(int epfd,
struct epoll_event* events,
int max_events,
int timeout_in_ms) {
int num_events = 0;
- while (!event_queue_.empty() &&
- num_events < max_events &&
+ while (!event_queue_.empty() && num_events < max_events &&
event_queue_.begin()->first <= NowInUsec() &&
((until_in_usec_ == -1) ||
- (event_queue_.begin()->first < until_in_usec_))
- ) {
+ (event_queue_.begin()->first < until_in_usec_))) {
int64 event_time_in_usec = event_queue_.begin()->first;
events[num_events] = event_queue_.begin()->second;
if (event_time_in_usec > NowInUsec()) {
@@ -43,7 +37,7 @@ int MockEpollServer::epoll_wait_impl(int epfd,
event_queue_.erase(event_queue_.begin());
++num_events;
}
- if (num_events == 0) { // then we'd have waited 'till the timeout.
+ if (num_events == 0) { // then we'd have waited 'till the timeout.
if (until_in_usec_ < 0) { // then we don't care what the final time is.
if (timeout_in_ms > 0) {
AdvanceBy(timeout_in_ms * 1000);
diff --git a/net/tools/quic/test_tools/packet_dropping_test_writer.cc b/net/tools/quic/test_tools/packet_dropping_test_writer.cc
index 7957380..59cc9f3 100644
--- a/net/tools/quic/test_tools/packet_dropping_test_writer.cc
+++ b/net/tools/quic/test_tools/packet_dropping_test_writer.cc
@@ -62,14 +62,12 @@ PacketDroppingTestWriter::PacketDroppingTestWriter()
PacketDroppingTestWriter::~PacketDroppingTestWriter() {}
-void PacketDroppingTestWriter::Initialize(
- QuicConnectionHelperInterface* helper,
- Delegate* on_can_write) {
+void PacketDroppingTestWriter::Initialize(QuicConnectionHelperInterface* helper,
+ Delegate* on_can_write) {
clock_ = helper->GetClock();
write_unblocked_alarm_.reset(
helper->CreateAlarm(new WriteUnblockedAlarm(this)));
- delay_alarm_.reset(
- helper->CreateAlarm(new DelayAlarm(this)));
+ delay_alarm_.reset(helper->CreateAlarm(new DelayAlarm(this)));
on_can_write_.reset(on_can_write);
}
@@ -118,14 +116,13 @@ WriteResult PacketDroppingTestWriter::WritePacket(
if (!fake_bandwidth_.IsZero()) {
// Calculate a time the bandwidth limit would impose.
QuicTime::Delta bandwidth_delay = QuicTime::Delta::FromMicroseconds(
- (buf_len * kNumMicrosPerSecond) /
- fake_bandwidth_.ToBytesPerSecond());
- send_time = delayed_packets_.empty() ?
- send_time.Add(bandwidth_delay) :
- delayed_packets_.back().send_time.Add(bandwidth_delay);
+ (buf_len * kNumMicrosPerSecond) / fake_bandwidth_.ToBytesPerSecond());
+ send_time = delayed_packets_.empty()
+ ? send_time.Add(bandwidth_delay)
+ : delayed_packets_.back().send_time.Add(bandwidth_delay);
}
- delayed_packets_.push_back(DelayedWrite(buffer, buf_len, self_address,
- peer_address, send_time));
+ delayed_packets_.push_back(
+ DelayedWrite(buffer, buf_len, self_address, peer_address, send_time));
cur_buffer_size_ += buf_len;
// Set the alarm if it's not yet set.
@@ -136,8 +133,8 @@ WriteResult PacketDroppingTestWriter::WritePacket(
return WriteResult(WRITE_STATUS_OK, buf_len);
}
- return QuicPacketWriterWrapper::WritePacket(
- buffer, buf_len, self_address, peer_address);
+ return QuicPacketWriterWrapper::WritePacket(buffer, buf_len, self_address,
+ peer_address);
}
bool PacketDroppingTestWriter::IsWriteBlocked() const {
@@ -175,9 +172,9 @@ QuicTime PacketDroppingTestWriter::ReleaseNextPacket() {
DVLOG(1) << "Releasing packet. " << (delayed_packets_.size() - 1)
<< " remaining.";
// Grab the next one off the queue and send it.
- QuicPacketWriterWrapper::WritePacket(
- iter->buffer.data(), iter->buffer.length(),
- iter->self_address, iter->peer_address);
+ QuicPacketWriterWrapper::WritePacket(iter->buffer.data(),
+ iter->buffer.length(),
+ iter->self_address, iter->peer_address);
DCHECK_GE(cur_buffer_size_, iter->buffer.length());
cur_buffer_size_ -= iter->buffer.length();
delayed_packets_.erase(iter);
diff --git a/net/tools/quic/test_tools/packet_dropping_test_writer.h b/net/tools/quic/test_tools/packet_dropping_test_writer.h
index 9a95bd8..716571c 100644
--- a/net/tools/quic/test_tools/packet_dropping_test_writer.h
+++ b/net/tools/quic/test_tools/packet_dropping_test_writer.h
@@ -80,7 +80,7 @@ class PacketDroppingTestWriter : public QuicPacketWriterWrapper {
int32 fake_blocked_socket_percentage) {
DCHECK(clock_);
base::AutoLock locked(config_mutex_);
- fake_blocked_socket_percentage_ = fake_blocked_socket_percentage;
+ fake_blocked_socket_percentage_ = fake_blocked_socket_percentage;
}
// The percent of time a packet is simulated as being reordered.
@@ -95,7 +95,7 @@ class PacketDroppingTestWriter : public QuicPacketWriterWrapper {
void set_fake_packet_delay(QuicTime::Delta fake_packet_delay) {
DCHECK(clock_);
base::AutoLock locked(config_mutex_);
- fake_packet_delay_ = fake_packet_delay;
+ fake_packet_delay_ = fake_packet_delay;
}
// The maximum bandwidth and buffer size of the connection. When these are
@@ -111,9 +111,7 @@ class PacketDroppingTestWriter : public QuicPacketWriterWrapper {
}
// Useful for reproducing very flaky issues.
- void set_seed(uint64 seed) {
- simple_random_.set_seed(seed);
- }
+ void set_seed(uint64 seed) { simple_random_.set_seed(seed); }
private:
// Writes out the next packet to the contained writer and returns the time
diff --git a/net/tools/quic/test_tools/quic_server_peer.cc b/net/tools/quic/test_tools/quic_server_peer.cc
index 293c788..eabebf8 100644
--- a/net/tools/quic/test_tools/quic_server_peer.cc
+++ b/net/tools/quic/test_tools/quic_server_peer.cc
@@ -15,8 +15,8 @@ namespace test {
// static
bool QuicServerPeer::SetSmallSocket(QuicServer* server) {
int size = 1024 * 10;
- return setsockopt(
- server->fd_, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)) != -1;
+ return setsockopt(server->fd_, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)) !=
+ -1;
}
// static
diff --git a/net/tools/quic/test_tools/quic_test_client.cc b/net/tools/quic/test_tools/quic_test_client.cc
index b16714a..ec65725 100644
--- a/net/tools/quic/test_tools/quic_test_client.cc
+++ b/net/tools/quic/test_tools/quic_test_client.cc
@@ -98,8 +98,7 @@ BalsaHeaders* MungeHeaders(const BalsaHeaders* const_headers) {
}
BalsaHeaders* headers = new BalsaHeaders;
headers->CopyFrom(*const_headers);
- if (!uri.starts_with("https://") &&
- !uri.starts_with("http://")) {
+ if (!uri.starts_with("https://") && !uri.starts_with("http://")) {
// If we have a relative URL, set some defaults.
string full_uri = "https://www.google.com";
full_uri.append(uri.as_string());
@@ -279,10 +278,8 @@ ssize_t QuicTestClient::SendMessage(const HTTPMessage& message) {
if (!connected()) {
GURL url(message.headers()->request_uri().as_string());
if (!url.host().empty()) {
- client_->set_server_id(
- QuicServerId(url.host(),
- url.EffectiveIntPort(),
- PRIVACY_MODE_DISABLED));
+ client_->set_server_id(QuicServerId(url.host(), url.EffectiveIntPort(),
+ PRIVACY_MODE_DISABLED));
}
}
@@ -386,7 +383,9 @@ QuicErrorCode QuicTestClient::connection_error() {
return client()->connection_error();
}
-MockableQuicClient* QuicTestClient::client() { return client_.get(); }
+MockableQuicClient* QuicTestClient::client() {
+ return client_.get();
+}
const string& QuicTestClient::cert_common_name() const {
return reinterpret_cast<RecordingProofVerifier*>(client_->proof_verifier())
@@ -457,10 +456,10 @@ void QuicTestClient::WaitForResponseForMs(int timeout_ms) {
epoll_server()->set_timeout_in_us(timeout_us);
}
const QuicClock* clock =
- QuicConnectionPeer::GetHelper(client()->session()->connection())->
- GetClock();
- QuicTime end_waiting_time = clock->Now().Add(
- QuicTime::Delta::FromMicroseconds(timeout_us));
+ QuicConnectionPeer::GetHelper(client()->session()->connection())
+ ->GetClock();
+ QuicTime end_waiting_time =
+ clock->Now().Add(QuicTime::Delta::FromMicroseconds(timeout_us));
while (stream_ != nullptr &&
!client_->session()->IsClosedStream(stream_->id()) &&
(timeout_us < 0 || clock->Now() < end_waiting_time)) {
@@ -478,10 +477,10 @@ void QuicTestClient::WaitForInitialResponseForMs(int timeout_ms) {
epoll_server()->set_timeout_in_us(timeout_us);
}
const QuicClock* clock =
- QuicConnectionPeer::GetHelper(client()->session()->connection())->
- GetClock();
- QuicTime end_waiting_time = clock->Now().Add(
- QuicTime::Delta::FromMicroseconds(timeout_us));
+ QuicConnectionPeer::GetHelper(client()->session()->connection())
+ ->GetClock();
+ QuicTime end_waiting_time =
+ clock->Now().Add(QuicTime::Delta::FromMicroseconds(timeout_us));
while (stream_ != nullptr &&
!client_->session()->IsClosedStream(stream_->id()) &&
stream_->stream_bytes_read() == 0 &&
@@ -493,7 +492,7 @@ void QuicTestClient::WaitForInitialResponseForMs(int timeout_ms) {
}
}
-ssize_t QuicTestClient::Send(const void *buffer, size_t size) {
+ssize_t QuicTestClient::Send(const void* buffer, size_t size) {
return SendData(string(static_cast<const char*>(buffer), size), false);
}
@@ -564,7 +563,7 @@ void QuicTestClient::UseConnectionId(QuicConnectionId connection_id) {
client_->UseConnectionId(connection_id);
}
-ssize_t QuicTestClient::SendAndWaitForResponse(const void *buffer,
+ssize_t QuicTestClient::SendAndWaitForResponse(const void* buffer,
size_t size) {
LOG(DFATAL) << "Not implemented";
return 0;
diff --git a/net/tools/quic/test_tools/simple_client.cc b/net/tools/quic/test_tools/simple_client.cc
index 46f5b9d..f6328ff 100644
--- a/net/tools/quic/test_tools/simple_client.cc
+++ b/net/tools/quic/test_tools/simple_client.cc
@@ -27,9 +27,13 @@ int SimpleClient::HalfClose() {
return 0;
}
-int SimpleClient::response_header_size() const { return 0; }
+int SimpleClient::response_header_size() const {
+ return 0;
+}
-int64 SimpleClient::response_body_size() const { return 0; }
+int64 SimpleClient::response_body_size() const {
+ return 0;
+}
} // namespace net
} // namespace tools
diff --git a/net/tools/quic/test_tools/simple_client.h b/net/tools/quic/test_tools/simple_client.h
index b483491..1c85dac 100644
--- a/net/tools/quic/test_tools/simple_client.h
+++ b/net/tools/quic/test_tools/simple_client.h
@@ -25,14 +25,14 @@ class SimpleClient {
// server, possibly with multiple send operations. Returns 'size' on success
// and -1 on error. Callers should assume that any return value other than
// 'size' indicates failure.
- virtual ssize_t Send(const void *buffer, size_t size) = 0;
+ virtual ssize_t Send(const void* buffer, size_t size) = 0;
// Serialize and send an HTTP request.
virtual ssize_t SendMessage(const HTTPMessage& message) = 0;
// Clears any outstanding state, sends 'size' bytes from 'buffer' and waits
// for a response or an error.
- virtual ssize_t SendAndWaitForResponse(const void *buffer, size_t size) = 0;
+ virtual ssize_t SendAndWaitForResponse(const void* buffer, size_t size) = 0;
// Clears any outstanding state and sends a simple GET of 'uri' to the
// server.