| 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 <cstddef> | 5 #include <cstddef> |
| 6 #include <cstdio> | 6 #include <cstdio> |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 | 95 |
| 96 virtual void SetBootstrapData(const std::string& data) OVERRIDE { | 96 virtual void SetBootstrapData(const std::string& data) OVERRIDE { |
| 97 std::string base64_data; | 97 std::string base64_data; |
| 98 CHECK(base::Base64Encode(data, &base64_data)); | 98 CHECK(base::Base64Encode(data, &base64_data)); |
| 99 VLOG(1) << "Setting bootstrap data to: " << base64_data; | 99 VLOG(1) << "Setting bootstrap data to: " << base64_data; |
| 100 } | 100 } |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 // Needed to use a real host resolver. | 103 // Needed to use a real host resolver. |
| 104 class MyTestURLRequestContext : public TestURLRequestContext { | 104 class MyTestURLRequestContext : public net::TestURLRequestContext { |
| 105 public: | 105 public: |
| 106 MyTestURLRequestContext() : TestURLRequestContext(true) { | 106 MyTestURLRequestContext() : TestURLRequestContext(true) { |
| 107 context_storage_.set_host_resolver( | 107 context_storage_.set_host_resolver( |
| 108 net::HostResolver::CreateDefaultResolver(NULL)); | 108 net::HostResolver::CreateDefaultResolver(NULL)); |
| 109 context_storage_.set_transport_security_state( | 109 context_storage_.set_transport_security_state( |
| 110 new net::TransportSecurityState()); | 110 new net::TransportSecurityState()); |
| 111 Init(); | 111 Init(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 virtual ~MyTestURLRequestContext() {} | 114 virtual ~MyTestURLRequestContext() {} |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 class MyTestURLRequestContextGetter : public TestURLRequestContextGetter { | 117 class MyTestURLRequestContextGetter : public net::TestURLRequestContextGetter { |
| 118 public: | 118 public: |
| 119 explicit MyTestURLRequestContextGetter( | 119 explicit MyTestURLRequestContextGetter( |
| 120 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy) | 120 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy) |
| 121 : TestURLRequestContextGetter(io_message_loop_proxy) {} | 121 : TestURLRequestContextGetter(io_message_loop_proxy) {} |
| 122 | 122 |
| 123 virtual TestURLRequestContext* GetURLRequestContext() OVERRIDE { | 123 virtual net::TestURLRequestContext* GetURLRequestContext() OVERRIDE { |
| 124 // Construct |context_| lazily so it gets constructed on the right | 124 // Construct |context_| lazily so it gets constructed on the right |
| 125 // thread (the IO thread). | 125 // thread (the IO thread). |
| 126 if (!context_.get()) | 126 if (!context_.get()) |
| 127 context_.reset(new MyTestURLRequestContext()); | 127 context_.reset(new MyTestURLRequestContext()); |
| 128 return context_.get(); | 128 return context_.get(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 private: | 131 private: |
| 132 virtual ~MyTestURLRequestContextGetter() {} | 132 virtual ~MyTestURLRequestContextGetter() {} |
| 133 | 133 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 io_thread.Stop(); | 391 io_thread.Stop(); |
| 392 return 0; | 392 return 0; |
| 393 } | 393 } |
| 394 | 394 |
| 395 } // namespace | 395 } // namespace |
| 396 } // namespace syncer | 396 } // namespace syncer |
| 397 | 397 |
| 398 int main(int argc, char* argv[]) { | 398 int main(int argc, char* argv[]) { |
| 399 return syncer::SyncClientMain(argc, argv); | 399 return syncer::SyncClientMain(argc, argv); |
| 400 } | 400 } |
| OLD | NEW |