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

Unified Diff: sync/notifier/sync_invalidation_listener_unittest.cc

Issue 221963003: Reduce dependency of TiclInvalidationService on Profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made InvalidationStateTracker not vend WeakPtrs. Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: sync/notifier/sync_invalidation_listener_unittest.cc
diff --git a/sync/notifier/sync_invalidation_listener_unittest.cc b/sync/notifier/sync_invalidation_listener_unittest.cc
index 5fd9442ae174cb49f46f48ef259451d3a50cd823..29276bd02fdcdb4818310c22fd14fde2214570d2 100644
--- a/sync/notifier/sync_invalidation_listener_unittest.cc
+++ b/sync/notifier/sync_invalidation_listener_unittest.cc
@@ -282,7 +282,8 @@ class SyncInvalidationListenerTest : public testing::Test {
fake_invalidation_client_(NULL),
listener_(scoped_ptr<SyncNetworkChannel>(new PushClientChannel(
scoped_ptr<notifier::PushClient>(fake_push_client_)))),
- fake_delegate_(&listener_) {}
+ fake_delegate_(&listener_),
+ invalidation_state_tracker_weak_ptr_factory_(&fake_tracker_) {}
virtual void SetUp() {
StartClient();
@@ -294,6 +295,7 @@ class SyncInvalidationListenerTest : public testing::Test {
virtual void TearDown() {
StopClient();
+ invalidation_state_tracker_weak_ptr_factory_.InvalidateWeakPtrs();
}
// Restart client without re-registering IDs.
@@ -304,12 +306,13 @@ class SyncInvalidationListenerTest : public testing::Test {
void StartClient() {
fake_invalidation_client_ = NULL;
- listener_.Start(base::Bind(&CreateFakeInvalidationClient,
- &fake_invalidation_client_),
- kClientId, kClientInfo, kState,
- fake_tracker_.GetSavedInvalidations(),
- MakeWeakHandle(fake_tracker_.AsWeakPtr()),
- &fake_delegate_);
+ listener_.Start(
+ base::Bind(&CreateFakeInvalidationClient, &fake_invalidation_client_),
+ kClientId, kClientInfo, kState,
+ fake_tracker_.GetSavedInvalidations(),
+ MakeWeakHandle(
+ invalidation_state_tracker_weak_ptr_factory_.GetWeakPtr()),
+ &fake_delegate_);
DCHECK(fake_invalidation_client_);
}
@@ -464,7 +467,7 @@ class SyncInvalidationListenerTest : public testing::Test {
notifier::FakePushClient* const fake_push_client_;
protected:
- // A derrived test needs direct access to this.
+ // A derived test needs direct access to this.
FakeInvalidationStateTracker fake_tracker_;
// Tests need to access these directly.
@@ -473,6 +476,9 @@ class SyncInvalidationListenerTest : public testing::Test {
private:
FakeDelegate fake_delegate_;
+
+ base::WeakPtrFactory<InvalidationStateTracker>
+ invalidation_state_tracker_weak_ptr_factory_;
};
// Write a new state to the client. It should propagate to the

Powered by Google App Engine
This is Rietveld 408576698