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

Side by Side Diff: sync/notifier/sync_notifier_factory_unittest.cc

Issue 10824161: [Sync] Avoid unregistering object IDs on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Work around brittle unit test 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
« no previous file with comments | « sync/notifier/sync_notifier.h ('k') | sync/notifier/sync_notifier_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "sync/notifier/sync_notifier_factory.h" 5 #include "sync/notifier/sync_notifier_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 SyncNotifierFactory factory( 54 SyncNotifierFactory factory(
55 notifier_options_, 55 notifier_options_,
56 "test client info", 56 "test client info",
57 base::WeakPtr<InvalidationStateTracker>()); 57 base::WeakPtr<InvalidationStateTracker>());
58 scoped_ptr<SyncNotifier> notifier(factory.CreateSyncNotifier()); 58 scoped_ptr<SyncNotifier> notifier(factory.CreateSyncNotifier());
59 #if defined(OS_ANDROID) 59 #if defined(OS_ANDROID)
60 ASSERT_FALSE(notifier.get()); 60 ASSERT_FALSE(notifier.get());
61 #else 61 #else
62 ASSERT_TRUE(notifier.get()); 62 ASSERT_TRUE(notifier.get());
63 ObjectIdSet ids = ModelTypeSetToObjectIdSet(ModelTypeSet(syncer::BOOKMARKS)); 63 ObjectIdSet ids = ModelTypeSetToObjectIdSet(ModelTypeSet(syncer::BOOKMARKS));
64 notifier->RegisterHandler(&mock_observer_);
64 notifier->UpdateRegisteredIds(&mock_observer_, ids); 65 notifier->UpdateRegisteredIds(&mock_observer_, ids);
65 notifier->UpdateRegisteredIds(&mock_observer_, ObjectIdSet()); 66 notifier->UnregisterHandler(&mock_observer_);
66 #endif 67 #endif
67 } 68 }
68 69
69 // Test basic creation of a P2PNotifier. 70 // Test basic creation of a P2PNotifier.
70 TEST_F(SyncNotifierFactoryTest, Basic_P2P) { 71 TEST_F(SyncNotifierFactoryTest, Basic_P2P) {
71 notifier_options_.notification_method = notifier::NOTIFICATION_P2P; 72 notifier_options_.notification_method = notifier::NOTIFICATION_P2P;
72 SyncNotifierFactory factory( 73 SyncNotifierFactory factory(
73 notifier_options_, 74 notifier_options_,
74 "test client info", 75 "test client info",
75 base::WeakPtr<InvalidationStateTracker>()); 76 base::WeakPtr<InvalidationStateTracker>());
76 scoped_ptr<SyncNotifier> notifier(factory.CreateSyncNotifier()); 77 scoped_ptr<SyncNotifier> notifier(factory.CreateSyncNotifier());
77 #if defined(OS_ANDROID) 78 #if defined(OS_ANDROID)
78 ASSERT_FALSE(notifier.get()); 79 ASSERT_FALSE(notifier.get());
79 #else 80 #else
80 ASSERT_TRUE(notifier.get()); 81 ASSERT_TRUE(notifier.get());
81 ObjectIdSet ids = ModelTypeSetToObjectIdSet(ModelTypeSet(syncer::BOOKMARKS)); 82 ObjectIdSet ids = ModelTypeSetToObjectIdSet(ModelTypeSet(syncer::BOOKMARKS));
83 notifier->RegisterHandler(&mock_observer_);
82 notifier->UpdateRegisteredIds(&mock_observer_, ids); 84 notifier->UpdateRegisteredIds(&mock_observer_, ids);
83 notifier->UpdateRegisteredIds(&mock_observer_, ObjectIdSet()); 85 notifier->UnregisterHandler(&mock_observer_);
84 #endif 86 #endif
85 } 87 }
86 88
87 } // namespace 89 } // namespace
88 } // namespace syncer 90 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/notifier/sync_notifier.h ('k') | sync/notifier/sync_notifier_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698