summaryrefslogtreecommitdiffstats
path: root/net/quic/test_tools
diff options
context:
space:
mode:
Diffstat (limited to 'net/quic/test_tools')
-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
25 files changed, 166 insertions, 240 deletions
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