| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // A standalone tool for testing MCS connections and the MCS client on their | 5 // A standalone tool for testing MCS connections and the MCS client on their |
| 6 // own. | 6 // own. |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <cstdio> | 9 #include <cstdio> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 virtual ~MyTestURLRequestContext() {} | 142 virtual ~MyTestURLRequestContext() {} |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 class MyTestURLRequestContextGetter : public net::TestURLRequestContextGetter { | 145 class MyTestURLRequestContextGetter : public net::TestURLRequestContextGetter { |
| 146 public: | 146 public: |
| 147 explicit MyTestURLRequestContextGetter( | 147 explicit MyTestURLRequestContextGetter( |
| 148 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy) | 148 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy) |
| 149 : TestURLRequestContextGetter(io_message_loop_proxy) {} | 149 : TestURLRequestContextGetter(io_message_loop_proxy) {} |
| 150 | 150 |
| 151 virtual net::TestURLRequestContext* GetURLRequestContext() OVERRIDE { | 151 virtual net::TestURLRequestContext* GetURLRequestContext() override { |
| 152 // Construct |context_| lazily so it gets constructed on the right | 152 // Construct |context_| lazily so it gets constructed on the right |
| 153 // thread (the IO thread). | 153 // thread (the IO thread). |
| 154 if (!context_) | 154 if (!context_) |
| 155 context_.reset(new MyTestURLRequestContext()); | 155 context_.reset(new MyTestURLRequestContext()); |
| 156 return context_.get(); | 156 return context_.get(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 private: | 159 private: |
| 160 virtual ~MyTestURLRequestContextGetter() {} | 160 virtual ~MyTestURLRequestContextGetter() {} |
| 161 | 161 |
| 162 scoped_ptr<MyTestURLRequestContext> context_; | 162 scoped_ptr<MyTestURLRequestContext> context_; |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 // A cert verifier that access all certificates. | 165 // A cert verifier that access all certificates. |
| 166 class MyTestCertVerifier : public net::CertVerifier { | 166 class MyTestCertVerifier : public net::CertVerifier { |
| 167 public: | 167 public: |
| 168 MyTestCertVerifier() {} | 168 MyTestCertVerifier() {} |
| 169 virtual ~MyTestCertVerifier() {} | 169 virtual ~MyTestCertVerifier() {} |
| 170 | 170 |
| 171 virtual int Verify(net::X509Certificate* cert, | 171 virtual int Verify(net::X509Certificate* cert, |
| 172 const std::string& hostname, | 172 const std::string& hostname, |
| 173 int flags, | 173 int flags, |
| 174 net::CRLSet* crl_set, | 174 net::CRLSet* crl_set, |
| 175 net::CertVerifyResult* verify_result, | 175 net::CertVerifyResult* verify_result, |
| 176 const net::CompletionCallback& callback, | 176 const net::CompletionCallback& callback, |
| 177 RequestHandle* out_req, | 177 RequestHandle* out_req, |
| 178 const net::BoundNetLog& net_log) OVERRIDE { | 178 const net::BoundNetLog& net_log) override { |
| 179 return net::OK; | 179 return net::OK; |
| 180 } | 180 } |
| 181 | 181 |
| 182 virtual void CancelRequest(RequestHandle req) OVERRIDE { | 182 virtual void CancelRequest(RequestHandle req) override { |
| 183 // Do nothing. | 183 // Do nothing. |
| 184 } | 184 } |
| 185 }; | 185 }; |
| 186 | 186 |
| 187 class MCSProbe { | 187 class MCSProbe { |
| 188 public: | 188 public: |
| 189 MCSProbe( | 189 MCSProbe( |
| 190 const CommandLine& command_line, | 190 const CommandLine& command_line, |
| 191 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter); | 191 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter); |
| 192 ~MCSProbe(); | 192 ~MCSProbe(); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 492 |
| 493 return 0; | 493 return 0; |
| 494 } | 494 } |
| 495 | 495 |
| 496 } // namespace | 496 } // namespace |
| 497 } // namespace gcm | 497 } // namespace gcm |
| 498 | 498 |
| 499 int main(int argc, char* argv[]) { | 499 int main(int argc, char* argv[]) { |
| 500 return gcm::MCSProbeMain(argc, argv); | 500 return gcm::MCSProbeMain(argc, argv); |
| 501 } | 501 } |
| OLD | NEW |