| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/at_exit.h" | 13 #include "base/at_exit.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/files/scoped_file.h" | 16 #include "base/files/scoped_file.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 20 #include "base/message_loop/message_loop.h" | 20 #include "base/message_loop/message_loop.h" |
| 21 #include "base/run_loop.h" | 21 #include "base/run_loop.h" |
| 22 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
| 23 #include "base/thread_task_runner_handle.h" |
| 23 #include "base/threading/thread.h" | 24 #include "base/threading/thread.h" |
| 24 #include "base/threading/worker_pool.h" | 25 #include "base/threading/worker_pool.h" |
| 25 #include "base/time/default_clock.h" | 26 #include "base/time/default_clock.h" |
| 26 #include "base/values.h" | 27 #include "base/values.h" |
| 27 #include "google_apis/gcm/base/fake_encryptor.h" | 28 #include "google_apis/gcm/base/fake_encryptor.h" |
| 28 #include "google_apis/gcm/base/mcs_message.h" | 29 #include "google_apis/gcm/base/mcs_message.h" |
| 29 #include "google_apis/gcm/base/mcs_util.h" | 30 #include "google_apis/gcm/base/mcs_util.h" |
| 30 #include "google_apis/gcm/engine/checkin_request.h" | 31 #include "google_apis/gcm/engine/checkin_request.h" |
| 31 #include "google_apis/gcm/engine/connection_factory_impl.h" | 32 #include "google_apis/gcm/engine/connection_factory_impl.h" |
| 32 #include "google_apis/gcm/engine/gcm_store_impl.h" | 33 #include "google_apis/gcm/engine/gcm_store_impl.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 new net::TransportSecurityState()); | 140 new net::TransportSecurityState()); |
| 140 Init(); | 141 Init(); |
| 141 } | 142 } |
| 142 | 143 |
| 143 ~MyTestURLRequestContext() override {} | 144 ~MyTestURLRequestContext() override {} |
| 144 }; | 145 }; |
| 145 | 146 |
| 146 class MyTestURLRequestContextGetter : public net::TestURLRequestContextGetter { | 147 class MyTestURLRequestContextGetter : public net::TestURLRequestContextGetter { |
| 147 public: | 148 public: |
| 148 explicit MyTestURLRequestContextGetter( | 149 explicit MyTestURLRequestContextGetter( |
| 149 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy) | 150 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) |
| 150 : TestURLRequestContextGetter(io_message_loop_proxy) {} | 151 : TestURLRequestContextGetter(io_task_runner) {} |
| 151 | 152 |
| 152 net::TestURLRequestContext* GetURLRequestContext() override { | 153 net::TestURLRequestContext* GetURLRequestContext() override { |
| 153 // Construct |context_| lazily so it gets constructed on the right | 154 // Construct |context_| lazily so it gets constructed on the right |
| 154 // thread (the IO thread). | 155 // thread (the IO thread). |
| 155 if (!context_) | 156 if (!context_) |
| 156 context_.reset(new MyTestURLRequestContext()); | 157 context_.reset(new MyTestURLRequestContext()); |
| 157 return context_.get(); | 158 return context_.get(); |
| 158 } | 159 } |
| 159 | 160 |
| 160 private: | 161 private: |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 | 498 |
| 498 return 0; | 499 return 0; |
| 499 } | 500 } |
| 500 | 501 |
| 501 } // namespace | 502 } // namespace |
| 502 } // namespace gcm | 503 } // namespace gcm |
| 503 | 504 |
| 504 int main(int argc, char* argv[]) { | 505 int main(int argc, char* argv[]) { |
| 505 return gcm::MCSProbeMain(argc, argv); | 506 return gcm::MCSProbeMain(argc, argv); |
| 506 } | 507 } |
| OLD | NEW |