Chromium Code Reviews| 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 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 14 #include "base/test/test_timeouts.h" | 14 #include "base/test/test_timeouts.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/invalidation/invalidator_storage.h" | 16 #include "chrome/browser/invalidation/invalidator_storage.h" |
| 17 #include "chrome/browser/prefs/pref_service_syncable.h" | 17 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 18 #include "chrome/browser/sync/glue/device_info.h" | 18 #include "chrome/browser/sync/glue/device_info.h" |
| 19 #include "chrome/browser/sync/glue/sync_frontend.h" | 19 #include "chrome/browser/sync/glue/sync_frontend.h" |
| 20 #include "chrome/browser/sync/glue/synced_device_tracker.h" | 20 #include "chrome/browser/sync/glue/synced_device_tracker.h" |
| 21 #include "chrome/browser/sync/sync_prefs.h" | 21 #include "chrome/browser/sync/sync_prefs.h" |
| 22 #include "chrome/browser/sync/test/test_http_bridge_factory.h" | |
| 22 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
| 23 #include "components/user_prefs/pref_registry_syncable.h" | 24 #include "components/user_prefs/pref_registry_syncable.h" |
| 24 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
| 25 #include "content/public/test/test_browser_thread_bundle.h" | 26 #include "content/public/test/test_browser_thread_bundle.h" |
| 26 #include "content/public/test/test_utils.h" | 27 #include "content/public/test/test_utils.h" |
| 27 #include "google/cacheinvalidation/include/types.h" | 28 #include "google/cacheinvalidation/include/types.h" |
| 28 #include "net/url_request/test_url_fetcher_factory.h" | 29 #include "net/url_request/test_url_fetcher_factory.h" |
| 29 #include "sync/internal_api/public/base/model_type.h" | 30 #include "sync/internal_api/public/base/model_type.h" |
| 30 #include "sync/internal_api/public/engine/model_safe_worker.h" | 31 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 32 #include "sync/internal_api/public/http_post_provider_factory.h" | |
| 31 #include "sync/internal_api/public/sync_manager_factory.h" | 33 #include "sync/internal_api/public/sync_manager_factory.h" |
| 32 #include "sync/internal_api/public/test/fake_sync_manager.h" | 34 #include "sync/internal_api/public/test/fake_sync_manager.h" |
| 33 #include "sync/internal_api/public/util/experiments.h" | 35 #include "sync/internal_api/public/util/experiments.h" |
| 34 #include "sync/notifier/invalidator_state.h" | 36 #include "sync/notifier/invalidator_state.h" |
| 35 #include "sync/protocol/encryption.pb.h" | 37 #include "sync/protocol/encryption.pb.h" |
| 36 #include "sync/protocol/sync_protocol_error.h" | 38 #include "sync/protocol/sync_protocol_error.h" |
| 37 #include "sync/util/test_unrecoverable_error_handler.h" | 39 #include "sync/util/test_unrecoverable_error_handler.h" |
| 38 #include "testing/gmock/include/gmock/gmock.h" | 40 #include "testing/gmock/include/gmock/gmock.h" |
| 39 #include "testing/gtest/include/gtest/gtest.h" | 41 #include "testing/gtest/include/gtest/gtest.h" |
| 40 #include "url/gurl.h" | 42 #include "url/gurl.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 backend_->Initialize( | 188 backend_->Initialize( |
| 187 &mock_frontend_, | 189 &mock_frontend_, |
| 188 scoped_ptr<base::Thread>(), | 190 scoped_ptr<base::Thread>(), |
| 189 syncer::WeakHandle<syncer::JsEventHandler>(), | 191 syncer::WeakHandle<syncer::JsEventHandler>(), |
| 190 GURL(std::string()), | 192 GURL(std::string()), |
| 191 credentials_, | 193 credentials_, |
| 192 true, | 194 true, |
| 193 fake_manager_factory_.PassAs<syncer::SyncManagerFactory>(), | 195 fake_manager_factory_.PassAs<syncer::SyncManagerFactory>(), |
| 194 scoped_ptr<syncer::UnrecoverableErrorHandler>( | 196 scoped_ptr<syncer::UnrecoverableErrorHandler>( |
| 195 new syncer::TestUnrecoverableErrorHandler).Pass(), | 197 new syncer::TestUnrecoverableErrorHandler).Pass(), |
| 196 NULL); | 198 NULL, |
| 199 scoped_ptr<syncer::HttpPostProviderFactory>( | |
|
rlarocque
2013/11/19 18:41:58
nit: Are you sure you want to use a test factory h
pval...(no longer on Chromium)
2013/11/21 01:32:50
How would using a non-test factory reduce the amou
| |
| 200 new TestHttpBridgeFactory())); | |
| 197 base::RunLoop run_loop; | 201 base::RunLoop run_loop; |
| 198 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, | 202 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, |
| 199 run_loop.QuitClosure(), | 203 run_loop.QuitClosure(), |
| 200 TestTimeouts::action_timeout()); | 204 TestTimeouts::action_timeout()); |
| 201 run_loop.Run(); | 205 run_loop.Run(); |
| 202 // |fake_manager_factory_|'s fake_manager() is set on the sync | 206 // |fake_manager_factory_|'s fake_manager() is set on the sync |
| 203 // thread, but we can rely on the message loop barriers to | 207 // thread, but we can rely on the message loop barriers to |
| 204 // guarantee that we see the updated value. | 208 // guarantee that we see the updated value. |
| 205 DCHECK(fake_manager_); | 209 DCHECK(fake_manager_); |
| 206 } | 210 } |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 699 ASSERT_NE(-1, file_util::WriteFile(sync_file, nonsense, strlen(nonsense))); | 703 ASSERT_NE(-1, file_util::WriteFile(sync_file, nonsense, strlen(nonsense))); |
| 700 | 704 |
| 701 InitializeBackend(true); | 705 InitializeBackend(true); |
| 702 | 706 |
| 703 EXPECT_FALSE(base::PathExists(sync_file)); | 707 EXPECT_FALSE(base::PathExists(sync_file)); |
| 704 } | 708 } |
| 705 | 709 |
| 706 } // namespace | 710 } // namespace |
| 707 | 711 |
| 708 } // namespace browser_sync | 712 } // namespace browser_sync |
| OLD | NEW |