| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/tools/quic/test_tools/quic_test_client.h" | 5 #include "net/tools/quic/test_tools/quic_test_client.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "net/base/completion_callback.h" | 8 #include "net/base/completion_callback.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/cert/cert_verify_result.h" | 10 #include "net/cert/cert_verify_result.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 ssize_t QuicTestClient::SendMessage(const HTTPMessage& message) { | 236 ssize_t QuicTestClient::SendMessage(const HTTPMessage& message) { |
| 237 stream_ = NULL; // Always force creation of a stream for SendMessage. | 237 stream_ = NULL; // Always force creation of a stream for SendMessage. |
| 238 | 238 |
| 239 // If we're not connected, try to find an sni hostname. | 239 // If we're not connected, try to find an sni hostname. |
| 240 if (!connected()) { | 240 if (!connected()) { |
| 241 GURL url(message.headers()->request_uri().as_string()); | 241 GURL url(message.headers()->request_uri().as_string()); |
| 242 if (!url.host().empty()) { | 242 if (!url.host().empty()) { |
| 243 client_->set_server_key( | 243 client_->set_server_key( |
| 244 QuicSessionKey(url.host(), url.EffectiveIntPort(), | 244 QuicSessionKey(url.host(), url.EffectiveIntPort(), |
| 245 url.SchemeIs("https"), kPrivacyModeDisabled)); | 245 url.SchemeIs("https"), PRIVACY_MODE_DISABLED)); |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 QuicSpdyClientStream* stream = GetOrCreateStream(); | 249 QuicSpdyClientStream* stream = GetOrCreateStream(); |
| 250 if (!stream) { return 0; } | 250 if (!stream) { return 0; } |
| 251 | 251 |
| 252 scoped_ptr<BalsaHeaders> munged_headers(MungeHeaders(message.headers(), | 252 scoped_ptr<BalsaHeaders> munged_headers(MungeHeaders(message.headers(), |
| 253 secure_)); | 253 secure_)); |
| 254 ssize_t ret = GetOrCreateStream()->SendRequest( | 254 ssize_t ret = GetOrCreateStream()->SendRequest( |
| 255 munged_headers.get() ? *munged_headers.get() : *message.headers(), | 255 munged_headers.get() ? *munged_headers.get() : *message.headers(), |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 | 486 |
| 487 void QuicTestClient::WaitForWriteToFlush() { | 487 void QuicTestClient::WaitForWriteToFlush() { |
| 488 while (connected() && client()->session()->HasDataToWrite()) { | 488 while (connected() && client()->session()->HasDataToWrite()) { |
| 489 client_->WaitForEvents(); | 489 client_->WaitForEvents(); |
| 490 } | 490 } |
| 491 } | 491 } |
| 492 | 492 |
| 493 } // namespace test | 493 } // namespace test |
| 494 } // namespace tools | 494 } // namespace tools |
| 495 } // namespace net | 495 } // namespace net |
| OLD | NEW |