| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 107 } |
| 108 | 108 |
| 109 virtual void SetBootstrapData(const std::string& data) OVERRIDE { | 109 virtual void SetBootstrapData(const std::string& data) OVERRIDE { |
| 110 std::string base64_data; | 110 std::string base64_data; |
| 111 CHECK(base::Base64Encode(data, &base64_data)); | 111 CHECK(base::Base64Encode(data, &base64_data)); |
| 112 LOG(INFO) << "Setting bootstrap data to: " << base64_data; | 112 LOG(INFO) << "Setting bootstrap data to: " << base64_data; |
| 113 } | 113 } |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 // Needed to use a real host resolver. | 116 // Needed to use a real host resolver. |
| 117 class MyTestURLRequestContext : public TestURLRequestContext { | 117 class MyTestURLRequestContext : public net::TestURLRequestContext { |
| 118 public: | 118 public: |
| 119 MyTestURLRequestContext() : TestURLRequestContext(true) { | 119 MyTestURLRequestContext() : TestURLRequestContext(true) { |
| 120 context_storage_.set_host_resolver( | 120 context_storage_.set_host_resolver( |
| 121 net::HostResolver::CreateDefaultResolver(NULL)); | 121 net::HostResolver::CreateDefaultResolver(NULL)); |
| 122 context_storage_.set_transport_security_state( | 122 context_storage_.set_transport_security_state( |
| 123 new net::TransportSecurityState()); | 123 new net::TransportSecurityState()); |
| 124 Init(); | 124 Init(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 virtual ~MyTestURLRequestContext() {} | 127 virtual ~MyTestURLRequestContext() {} |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 class MyTestURLRequestContextGetter : public TestURLRequestContextGetter { | 130 class MyTestURLRequestContextGetter : public net::TestURLRequestContextGetter { |
| 131 public: | 131 public: |
| 132 explicit MyTestURLRequestContextGetter( | 132 explicit MyTestURLRequestContextGetter( |
| 133 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy) | 133 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy) |
| 134 : TestURLRequestContextGetter(io_message_loop_proxy) {} | 134 : TestURLRequestContextGetter(io_message_loop_proxy) {} |
| 135 | 135 |
| 136 virtual TestURLRequestContext* GetURLRequestContext() OVERRIDE { | 136 virtual net::TestURLRequestContext* GetURLRequestContext() OVERRIDE { |
| 137 // Construct |context_| lazily so it gets constructed on the right | 137 // Construct |context_| lazily so it gets constructed on the right |
| 138 // thread (the IO thread). | 138 // thread (the IO thread). |
| 139 if (!context_.get()) | 139 if (!context_.get()) |
| 140 context_.reset(new MyTestURLRequestContext()); | 140 context_.reset(new MyTestURLRequestContext()); |
| 141 return context_.get(); | 141 return context_.get(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 private: | 144 private: |
| 145 virtual ~MyTestURLRequestContextGetter() {} | 145 virtual ~MyTestURLRequestContextGetter() {} |
| 146 | 146 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 io_thread.Stop(); | 254 io_thread.Stop(); |
| 255 return 0; | 255 return 0; |
| 256 } | 256 } |
| 257 | 257 |
| 258 } // namespace | 258 } // namespace |
| 259 } // namespace syncer | 259 } // namespace syncer |
| 260 | 260 |
| 261 int main(int argc, char* argv[]) { | 261 int main(int argc, char* argv[]) { |
| 262 return syncer::SyncListenNotificationsMain(argc, argv); | 262 return syncer::SyncListenNotificationsMain(argc, argv); |
| 263 } | 263 } |
| OLD | NEW |