| Index: net/tools/quic/test_tools/quic_test_client.cc
|
| diff --git a/net/tools/quic/test_tools/quic_test_client.cc b/net/tools/quic/test_tools/quic_test_client.cc
|
| index c4f2706fcec27ad131b4cec2621a2cc5786a6f49..9f4cf72314c26ccad3fe2a93bf6076ade96a81af 100644
|
| --- a/net/tools/quic/test_tools/quic_test_client.cc
|
| +++ b/net/tools/quic/test_tools/quic_test_client.cc
|
| @@ -74,8 +74,7 @@ class RecordingProofVerifier : public ProofVerifier {
|
|
|
| } // anonymous namespace
|
|
|
| -BalsaHeaders* MungeHeaders(const BalsaHeaders* const_headers,
|
| - bool secure) {
|
| +BalsaHeaders* MungeHeaders(const BalsaHeaders* const_headers, bool secure) {
|
| StringPiece uri = const_headers->request_uri();
|
| if (uri.empty()) {
|
| return NULL;
|
| @@ -85,11 +84,10 @@ 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 = secure ? "https://www.google.com" :
|
| - "http://www.google.com";
|
| + string full_uri =
|
| + secure ? "https://www.google.com" : "http://www.google.com";
|
| full_uri.append(uri.as_string());
|
| headers->SetRequestUri(full_uri);
|
| }
|
| @@ -107,7 +105,8 @@ MockableQuicClient::MockableQuicClient(
|
| false,
|
| initial_flow_control_window),
|
| override_connection_id_(0),
|
| - test_writer_(NULL) {}
|
| + test_writer_(NULL) {
|
| +}
|
|
|
| MockableQuicClient::MockableQuicClient(
|
| IPEndPoint server_address,
|
| @@ -121,7 +120,8 @@ MockableQuicClient::MockableQuicClient(
|
| supported_versions,
|
| initial_flow_control_window),
|
| override_connection_id_(0),
|
| - test_writer_(NULL) {}
|
| + test_writer_(NULL) {
|
| +}
|
|
|
| MockableQuicClient::~MockableQuicClient() {
|
| if (connected()) {
|
| @@ -140,7 +140,7 @@ QuicPacketWriter* MockableQuicClient::CreateQuicPacketWriter() {
|
|
|
| QuicConnectionId MockableQuicClient::GenerateConnectionId() {
|
| return override_connection_id_ ? override_connection_id_
|
| - : QuicClient::GenerateConnectionId();
|
| + : QuicClient::GenerateConnectionId();
|
| }
|
|
|
| // Takes ownership of writer.
|
| @@ -230,9 +230,7 @@ void QuicTestClient::ExpectCertificates(bool on) {
|
| }
|
|
|
| ssize_t QuicTestClient::SendRequest(const string& uri) {
|
| - HTTPMessage message(HttpConstants::HTTP_1_1,
|
| - HttpConstants::GET,
|
| - uri);
|
| + HTTPMessage message(HttpConstants::HTTP_1_1, HttpConstants::GET, uri);
|
| return SendMessage(message);
|
| }
|
|
|
| @@ -243,19 +241,20 @@ 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(),
|
| - url.SchemeIs("https"),
|
| - PRIVACY_MODE_DISABLED));
|
| + client_->set_server_id(QuicServerId(url.host(),
|
| + url.EffectiveIntPort(),
|
| + url.SchemeIs("https"),
|
| + PRIVACY_MODE_DISABLED));
|
| }
|
| }
|
|
|
| QuicSpdyClientStream* stream = GetOrCreateStream();
|
| - if (!stream) { return 0; }
|
| + if (!stream) {
|
| + return 0;
|
| + }
|
|
|
| - scoped_ptr<BalsaHeaders> munged_headers(MungeHeaders(message.headers(),
|
| - secure_));
|
| + scoped_ptr<BalsaHeaders> munged_headers(
|
| + MungeHeaders(message.headers(), secure_));
|
| ssize_t ret = GetOrCreateStream()->SendRequest(
|
| munged_headers.get() ? *munged_headers.get() : *message.headers(),
|
| message.body(),
|
| @@ -266,7 +265,9 @@ ssize_t QuicTestClient::SendMessage(const HTTPMessage& message) {
|
|
|
| ssize_t QuicTestClient::SendData(string data, bool last_data) {
|
| QuicSpdyClientStream* stream = GetOrCreateStream();
|
| - if (!stream) { return 0; }
|
| + if (!stream) {
|
| + return 0;
|
| + }
|
| GetOrCreateStream()->SendBody(data, last_data);
|
| WaitForWriteToFlush();
|
| return data.length();
|
| @@ -345,7 +346,9 @@ QuicErrorCode QuicTestClient::connection_error() {
|
| return client()->session()->error();
|
| }
|
|
|
| -MockableQuicClient* QuicTestClient::client() { return client_.get(); }
|
| +MockableQuicClient* QuicTestClient::client() {
|
| + return client_.get();
|
| +}
|
|
|
| const string& QuicTestClient::cert_common_name() const {
|
| return reinterpret_cast<RecordingProofVerifier*>(proof_verifier_)
|
| @@ -411,11 +414,10 @@ void QuicTestClient::WaitForResponseForMs(int timeout_ms) {
|
| if (timeout_us > 0) {
|
| client()->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));
|
| + const QuicClock* clock = QuicConnectionPeer::GetHelper(
|
| + client()->session()->connection())->GetClock();
|
| + QuicTime end_waiting_time =
|
| + clock->Now().Add(QuicTime::Delta::FromMicroseconds(timeout_us));
|
| while (stream_ != NULL &&
|
| !client_->session()->IsClosedStream(stream_->id()) &&
|
| (timeout_us < 0 || clock->Now() < end_waiting_time)) {
|
| @@ -432,11 +434,10 @@ void QuicTestClient::WaitForInitialResponseForMs(int timeout_ms) {
|
| if (timeout_us > 0) {
|
| client()->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));
|
| + const QuicClock* clock = QuicConnectionPeer::GetHelper(
|
| + client()->session()->connection())->GetClock();
|
| + QuicTime end_waiting_time =
|
| + clock->Now().Add(QuicTime::Delta::FromMicroseconds(timeout_us));
|
| while (stream_ != NULL &&
|
| !client_->session()->IsClosedStream(stream_->id()) &&
|
| stream_->stream_bytes_read() == 0 &&
|
| @@ -448,7 +449,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);
|
| }
|
|
|
| @@ -509,7 +510,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;
|
|
|