Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host_unittest.cc

Issue 10911073: NOT FOR COMMIT: Add DeviceInfo type and ChangeProcessor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix several issues Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 profile_.get(), 150 profile_.get(),
149 sync_prefs_->AsWeakPtr(), 151 sync_prefs_->AsWeakPtr(),
150 invalidator_storage_->AsWeakPtr())); 152 invalidator_storage_->AsWeakPtr()));
151 credentials_.email = "user@example.com"; 153 credentials_.email = "user@example.com";
152 credentials_.sync_token = "sync_token"; 154 credentials_.sync_token = "sync_token";
153 155
154 // NOTE: We can't include Passwords or Typed URLs due to the Sync Backend 156 // NOTE: We can't include Passwords or Typed URLs due to the Sync Backend
155 // Registrar removing them if it can't find their model workers. 157 // Registrar removing them if it can't find their model workers.
156 enabled_types_.Put(syncer::BOOKMARKS); 158 enabled_types_.Put(syncer::BOOKMARKS);
157 enabled_types_.Put(syncer::NIGORI); 159 enabled_types_.Put(syncer::NIGORI);
160 enabled_types_.Put(syncer::DEVICE_INFO);
158 enabled_types_.Put(syncer::PREFERENCES); 161 enabled_types_.Put(syncer::PREFERENCES);
159 enabled_types_.Put(syncer::SESSIONS); 162 enabled_types_.Put(syncer::SESSIONS);
160 enabled_types_.Put(syncer::SEARCH_ENGINES); 163 enabled_types_.Put(syncer::SEARCH_ENGINES);
161 enabled_types_.Put(syncer::AUTOFILL); 164 enabled_types_.Put(syncer::AUTOFILL);
162 } 165 }
163 166
164 virtual void TearDown() OVERRIDE { 167 virtual void TearDown() OVERRIDE {
165 if (backend_.get()) { 168 if (backend_.get()) {
166 backend_->StopSyncingForShutdown(); 169 backend_->StopSyncingForShutdown();
167 backend_->Shutdown(false); 170 backend_->Shutdown(false);
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 // Make sure the above calls take effect before we continue. 628 // Make sure the above calls take effect before we continue.
626 fake_manager_->WaitForSyncThread(); 629 fake_manager_->WaitForSyncThread();
627 630
628 backend_->Shutdown(false); 631 backend_->Shutdown(false);
629 backend_.reset(); 632 backend_.reset();
630 633
631 TearDown(); 634 TearDown();
632 SetUp(); 635 SetUp();
633 } 636 }
634 637
638 TEST_F(SyncBackendHostTest, InitializeDeviceInfo) {
639 DeviceInfo info;
640 SyncedDeviceTracker* device_tracker =
641 backend_->GetSyncedDeviceTrackerForTest();
642
643 ASSERT_FALSE(device_tracker->ReadLocalDeviceInfo(&info));
644 InitializeBackend();
645 ASSERT_TRUE(device_tracker->ReadLocalDeviceInfo(&info));
646 }
647
635 } // namespace 648 } // namespace
636 649
637 } // namespace browser_sync 650 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host.cc ('k') | chrome/browser/sync/glue/sync_backend_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698