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

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

Issue 10805002: [Sync] Enable adding notifier observers from ProfileSyncService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 4 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/chrome_sync_notification_bridge.h" 5 #include "chrome/browser/sync/glue/chrome_sync_notification_bridge.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/sequenced_task_runner.h" 12 #include "base/sequenced_task_runner.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 "base/threading/thread.h" 15 #include "base/threading/thread.h"
16 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
17 #include "chrome/test/base/profile_mock.h" 17 #include "chrome/test/base/profile_mock.h"
18 #include "content/public/browser/notification_details.h" 18 #include "content/public/browser/notification_details.h"
19 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
(...skipping 26 matching lines...) Expand all
46 ChromeSyncNotificationBridge* bridge, 46 ChromeSyncNotificationBridge* bridge,
47 const syncer::ObjectIdPayloadMap& expected_payloads, 47 const syncer::ObjectIdPayloadMap& expected_payloads,
48 syncer::IncomingNotificationSource expected_source) 48 syncer::IncomingNotificationSource expected_source)
49 : sync_task_runner_(sync_task_runner), 49 : sync_task_runner_(sync_task_runner),
50 bridge_(bridge), 50 bridge_(bridge),
51 received_improper_notification_(false), 51 received_improper_notification_(false),
52 notification_count_(0), 52 notification_count_(0),
53 expected_payloads_(expected_payloads), 53 expected_payloads_(expected_payloads),
54 expected_source_(expected_source) { 54 expected_source_(expected_source) {
55 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); 55 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread());
56 // TODO(dcheng): We might want a function to go from ObjectIdPayloadMap -> 56 const syncer::ObjectIdSet& ids =
57 // ObjectIdSet to avoid this rather long incantation... 57 syncer::ObjectIdPayloadMapToSet(expected_payloads);
58 const syncer::ObjectIdSet& ids = syncer::ModelTypeSetToObjectIdSet(
59 syncer::ModelTypePayloadMapToEnumSet(
60 syncer::ObjectIdPayloadMapToModelTypePayloadMap(
61 expected_payloads)));
62 bridge_->UpdateRegisteredIds(this, ids); 58 bridge_->UpdateRegisteredIds(this, ids);
63 } 59 }
64 60
65 virtual ~FakeSyncNotifierObserver() { 61 virtual ~FakeSyncNotifierObserver() {
66 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread()); 62 DCHECK(sync_task_runner_->RunsTasksOnCurrentThread());
67 bridge_->UpdateRegisteredIds(this, syncer::ObjectIdSet()); 63 bridge_->UpdateRegisteredIds(this, syncer::ObjectIdSet());
68 } 64 }
69 65
70 // SyncNotifierObserver implementation. 66 // SyncNotifierObserver implementation.
71 virtual void OnIncomingNotification( 67 virtual void OnIncomingNotification(
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 CreateObserverWithExpectations( 279 CreateObserverWithExpectations(
284 enabled_types_payload_map, syncer::REMOTE_NOTIFICATION); 280 enabled_types_payload_map, syncer::REMOTE_NOTIFICATION);
285 UpdateBridgeEnabledTypes(enabled_types); 281 UpdateBridgeEnabledTypes(enabled_types);
286 TriggerRefreshNotification(chrome::NOTIFICATION_SYNC_REFRESH_REMOTE, 282 TriggerRefreshNotification(chrome::NOTIFICATION_SYNC_REFRESH_REMOTE,
287 syncer::ModelTypePayloadMap()); 283 syncer::ModelTypePayloadMap());
288 VerifyAndDestroyObserver(); 284 VerifyAndDestroyObserver();
289 } 285 }
290 286
291 } // namespace 287 } // namespace
292 } // namespace browser_sync 288 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698