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

Side by Side Diff: net/tools/quic/test_tools/quic_test_client.cc

Issue 309013006: Add quic_types.h and move the typedefs unrelated to the QUIC protocol (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/tools/quic/quic_socket_utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20 matching lines...) Expand all
31 namespace net { 31 namespace net {
32 namespace tools { 32 namespace tools {
33 namespace test { 33 namespace test {
34 namespace { 34 namespace {
35 35
36 // RecordingProofVerifier accepts any certificate chain and records the common 36 // RecordingProofVerifier accepts any certificate chain and records the common
37 // name of the leaf. 37 // name of the leaf.
38 class RecordingProofVerifier : public ProofVerifier { 38 class RecordingProofVerifier : public ProofVerifier {
39 public: 39 public:
40 // ProofVerifier interface. 40 // ProofVerifier interface.
41 virtual Status VerifyProof(const string& hostname, 41 virtual QuicAsyncStatus VerifyProof(
42 const string& server_config, 42 const string& hostname,
43 const vector<string>& certs, 43 const string& server_config,
44 const string& signature, 44 const vector<string>& certs,
45 const ProofVerifyContext* context, 45 const string& signature,
46 string* error_details, 46 const ProofVerifyContext* context,
47 scoped_ptr<ProofVerifyDetails>* details, 47 string* error_details,
48 ProofVerifierCallback* callback) OVERRIDE { 48 scoped_ptr<ProofVerifyDetails>* details,
49 ProofVerifierCallback* callback) OVERRIDE {
49 common_name_.clear(); 50 common_name_.clear();
50 if (certs.empty()) { 51 if (certs.empty()) {
51 return FAILURE; 52 return QUIC_FAILURE;
52 } 53 }
53 54
54 // Convert certs to X509Certificate. 55 // Convert certs to X509Certificate.
55 vector<StringPiece> cert_pieces(certs.size()); 56 vector<StringPiece> cert_pieces(certs.size());
56 for (unsigned i = 0; i < certs.size(); i++) { 57 for (unsigned i = 0; i < certs.size(); i++) {
57 cert_pieces[i] = StringPiece(certs[i]); 58 cert_pieces[i] = StringPiece(certs[i]);
58 } 59 }
59 scoped_refptr<net::X509Certificate> cert = 60 scoped_refptr<net::X509Certificate> cert =
60 net::X509Certificate::CreateFromDERCertChain(cert_pieces); 61 net::X509Certificate::CreateFromDERCertChain(cert_pieces);
61 if (!cert.get()) { 62 if (!cert.get()) {
62 return FAILURE; 63 return QUIC_FAILURE;
63 } 64 }
64 65
65 common_name_ = cert->subject().GetDisplayName(); 66 common_name_ = cert->subject().GetDisplayName();
66 return SUCCESS; 67 return QUIC_SUCCESS;
67 } 68 }
68 69
69 const string& common_name() const { return common_name_; } 70 const string& common_name() const { return common_name_; }
70 71
71 private: 72 private:
72 string common_name_; 73 string common_name_;
73 }; 74 };
74 75
75 } // anonymous namespace 76 } // anonymous namespace
76 77
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 541
541 void QuicTestClient::WaitForWriteToFlush() { 542 void QuicTestClient::WaitForWriteToFlush() {
542 while (connected() && client()->session()->HasDataToWrite()) { 543 while (connected() && client()->session()->HasDataToWrite()) {
543 client_->WaitForEvents(); 544 client_->WaitForEvents();
544 } 545 }
545 } 546 }
546 547
547 } // namespace test 548 } // namespace test
548 } // namespace tools 549 } // namespace tools
549 } // namespace net 550 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_socket_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698