| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/debug/stack_trace.h" | 13 #include "base/debug/stack_trace.h" |
| 14 #include "base/files/scoped_temp_dir.h" |
| 14 #include "base/json/json_writer.h" | 15 #include "base/json/json_writer.h" |
| 15 #include "base/logging.h" | 16 #include "base/logging.h" |
| 16 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 19 #include "base/message_loop.h" | 20 #include "base/message_loop.h" |
| 20 #include "base/scoped_temp_dir.h" | |
| 21 #include "base/task_runner.h" | 21 #include "base/task_runner.h" |
| 22 #include "base/threading/thread.h" | 22 #include "base/threading/thread.h" |
| 23 #include "jingle/notifier/base/notification_method.h" | 23 #include "jingle/notifier/base/notification_method.h" |
| 24 #include "jingle/notifier/base/notifier_options.h" | 24 #include "jingle/notifier/base/notifier_options.h" |
| 25 #include "net/base/host_port_pair.h" | 25 #include "net/base/host_port_pair.h" |
| 26 #include "net/base/host_resolver.h" | 26 #include "net/base/host_resolver.h" |
| 27 #include "net/base/network_change_notifier.h" | 27 #include "net/base/network_change_notifier.h" |
| 28 #include "net/base/transport_security_state.h" | 28 #include "net/base/transport_security_state.h" |
| 29 #include "net/url_request/url_request_test_util.h" | 29 #include "net/url_request/url_request_test_util.h" |
| 30 #include "sync/internal_api/public/base/model_type.h" | 30 #include "sync/internal_api/public/base/model_type.h" |
| 31 #include "sync/internal_api/public/base_node.h" | 31 #include "sync/internal_api/public/base_node.h" |
| 32 #include "sync/internal_api/public/engine/passive_model_worker.h" | 32 #include "sync/internal_api/public/engine/passive_model_worker.h" |
| 33 #include "sync/internal_api/public/http_bridge.h" | 33 #include "sync/internal_api/public/http_bridge.h" |
| 34 #include "sync/internal_api/public/internal_components_factory_impl.h" | 34 #include "sync/internal_api/public/internal_components_factory_impl.h" |
| 35 #include "sync/internal_api/public/read_node.h" | 35 #include "sync/internal_api/public/read_node.h" |
| 36 #include "sync/internal_api/public/sync_manager.h" | 36 #include "sync/internal_api/public/sync_manager.h" |
| 37 #include "sync/internal_api/public/sync_manager_factory.h" | 37 #include "sync/internal_api/public/sync_manager_factory.h" |
| 38 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" | 38 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" |
| 39 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" | 39 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" |
| 40 #include "sync/internal_api/public/util/weak_handle.h" | 40 #include "sync/internal_api/public/util/weak_handle.h" |
| 41 #include "sync/js/js_event_details.h" | 41 #include "sync/js/js_event_details.h" |
| 42 #include "sync/js/js_event_handler.h" | 42 #include "sync/js/js_event_handler.h" |
| 43 #include "sync/notifier/invalidation_state_tracker.h" | 43 #include "sync/notifier/invalidation_state_tracker.h" |
| 44 #include "sync/notifier/invalidator.h" |
| 44 #include "sync/notifier/invalidator_factory.h" | 45 #include "sync/notifier/invalidator_factory.h" |
| 45 #include "sync/notifier/invalidator.h" | |
| 46 #include "sync/test/fake_encryptor.h" | 46 #include "sync/test/fake_encryptor.h" |
| 47 | 47 |
| 48 #if defined(OS_MACOSX) | 48 #if defined(OS_MACOSX) |
| 49 #include "base/mac/scoped_nsautorelease_pool.h" | 49 #include "base/mac/scoped_nsautorelease_pool.h" |
| 50 #endif | 50 #endif |
| 51 | 51 |
| 52 // This is a simple utility that initializes a sync client and | 52 // This is a simple utility that initializes a sync client and |
| 53 // prints out any events. | 53 // prints out any events. |
| 54 | 54 |
| 55 // TODO(akalin): Refactor to combine shared code with | 55 // TODO(akalin): Refactor to combine shared code with |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 new MyTestURLRequestContextGetter(io_thread.message_loop_proxy()); | 310 new MyTestURLRequestContextGetter(io_thread.message_loop_proxy()); |
| 311 const notifier::NotifierOptions& notifier_options = | 311 const notifier::NotifierOptions& notifier_options = |
| 312 ParseNotifierOptions(command_line, context_getter); | 312 ParseNotifierOptions(command_line, context_getter); |
| 313 const char kClientInfo[] = "sync_listen_notifications"; | 313 const char kClientInfo[] = "sync_listen_notifications"; |
| 314 NullInvalidationStateTracker null_invalidation_state_tracker; | 314 NullInvalidationStateTracker null_invalidation_state_tracker; |
| 315 InvalidatorFactory invalidator_factory( | 315 InvalidatorFactory invalidator_factory( |
| 316 notifier_options, kClientInfo, | 316 notifier_options, kClientInfo, |
| 317 null_invalidation_state_tracker.AsWeakPtr()); | 317 null_invalidation_state_tracker.AsWeakPtr()); |
| 318 | 318 |
| 319 // Set up database directory for the syncer. | 319 // Set up database directory for the syncer. |
| 320 ScopedTempDir database_dir; | 320 base::ScopedTempDir database_dir; |
| 321 CHECK(database_dir.CreateUniqueTempDir()); | 321 CHECK(database_dir.CreateUniqueTempDir()); |
| 322 | 322 |
| 323 // Set up model type parameters. | 323 // Set up model type parameters. |
| 324 const ModelTypeSet model_types = ModelTypeSet::All(); | 324 const ModelTypeSet model_types = ModelTypeSet::All(); |
| 325 ModelSafeRoutingInfo routing_info; | 325 ModelSafeRoutingInfo routing_info; |
| 326 for (ModelTypeSet::Iterator it = model_types.First(); | 326 for (ModelTypeSet::Iterator it = model_types.First(); |
| 327 it.Good(); it.Inc()) { | 327 it.Good(); it.Inc()) { |
| 328 routing_info[it.Get()] = GROUP_PASSIVE; | 328 routing_info[it.Get()] = GROUP_PASSIVE; |
| 329 } | 329 } |
| 330 scoped_refptr<PassiveModelWorker> passive_model_safe_worker = | 330 scoped_refptr<PassiveModelWorker> passive_model_safe_worker = |
| (...skipping 60 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 |