| 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 "chrome/browser/sync/glue/sync_backend_host.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/test/test_timeouts.h" | 13 #include "base/test/test_timeouts.h" |
| 14 #include "chrome/browser/sync/glue/device_info.h" |
| 15 #include "chrome/browser/sync/glue/synced_device_tracker.h" |
| 14 #include "chrome/browser/sync/invalidations/invalidator_storage.h" | 16 #include "chrome/browser/sync/invalidations/invalidator_storage.h" |
| 15 #include "chrome/browser/sync/sync_prefs.h" | 17 #include "chrome/browser/sync/sync_prefs.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| 17 #include "content/public/test/test_browser_thread.h" | 19 #include "content/public/test/test_browser_thread.h" |
| 18 #include "google/cacheinvalidation/include/types.h" | 20 #include "google/cacheinvalidation/include/types.h" |
| 19 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 20 #include "net/url_request/test_url_fetcher_factory.h" | 22 #include "net/url_request/test_url_fetcher_factory.h" |
| 21 #include "sync/internal_api/public/base/model_type.h" | 23 #include "sync/internal_api/public/base/model_type.h" |
| 22 #include "sync/internal_api/public/engine/model_safe_worker.h" | 24 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 23 #include "sync/internal_api/public/sync_manager_factory.h" | 25 #include "sync/internal_api/public/sync_manager_factory.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 invalidator_storage_->AsWeakPtr())); | 151 invalidator_storage_->AsWeakPtr())); |
| 150 credentials_.email = "user@example.com"; | 152 credentials_.email = "user@example.com"; |
| 151 credentials_.sync_token = "sync_token"; | 153 credentials_.sync_token = "sync_token"; |
| 152 | 154 |
| 153 // These types are always implicitly enabled. | 155 // These types are always implicitly enabled. |
| 154 enabled_types_.PutAll(syncer::ControlTypes()); | 156 enabled_types_.PutAll(syncer::ControlTypes()); |
| 155 | 157 |
| 156 // NOTE: We can't include Passwords or Typed URLs due to the Sync Backend | 158 // NOTE: We can't include Passwords or Typed URLs due to the Sync Backend |
| 157 // Registrar removing them if it can't find their model workers. | 159 // Registrar removing them if it can't find their model workers. |
| 158 enabled_types_.Put(syncer::BOOKMARKS); | 160 enabled_types_.Put(syncer::BOOKMARKS); |
| 161 enabled_types_.Put(syncer::NIGORI); |
| 162 enabled_types_.Put(syncer::DEVICE_INFO); |
| 159 enabled_types_.Put(syncer::PREFERENCES); | 163 enabled_types_.Put(syncer::PREFERENCES); |
| 160 enabled_types_.Put(syncer::SESSIONS); | 164 enabled_types_.Put(syncer::SESSIONS); |
| 161 enabled_types_.Put(syncer::SEARCH_ENGINES); | 165 enabled_types_.Put(syncer::SEARCH_ENGINES); |
| 162 enabled_types_.Put(syncer::AUTOFILL); | 166 enabled_types_.Put(syncer::AUTOFILL); |
| 163 } | 167 } |
| 164 | 168 |
| 165 virtual void TearDown() OVERRIDE { | 169 virtual void TearDown() OVERRIDE { |
| 166 if (backend_.get()) { | 170 if (backend_.get()) { |
| 167 backend_->StopSyncingForShutdown(); | 171 backend_->StopSyncingForShutdown(); |
| 168 backend_->Shutdown(false); | 172 backend_->Shutdown(false); |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 // Make sure the above calls take effect before we continue. | 630 // Make sure the above calls take effect before we continue. |
| 627 fake_manager_->WaitForSyncThread(); | 631 fake_manager_->WaitForSyncThread(); |
| 628 | 632 |
| 629 backend_->Shutdown(false); | 633 backend_->Shutdown(false); |
| 630 backend_.reset(); | 634 backend_.reset(); |
| 631 | 635 |
| 632 TearDown(); | 636 TearDown(); |
| 633 SetUp(); | 637 SetUp(); |
| 634 } | 638 } |
| 635 | 639 |
| 640 TEST_F(SyncBackendHostTest, InitializeDeviceInfo) { |
| 641 ASSERT_EQ(NULL, backend_->GetSyncedDeviceTrackerForTest()); |
| 642 |
| 643 InitializeBackend(); |
| 644 SyncedDeviceTracker* device_tracker = |
| 645 backend_->GetSyncedDeviceTrackerForTest(); |
| 646 ASSERT_TRUE(device_tracker->ReadLocalDeviceInfo()); |
| 647 } |
| 648 |
| 636 } // namespace | 649 } // namespace |
| 637 | 650 |
| 638 } // namespace browser_sync | 651 } // namespace browser_sync |
| OLD | NEW |