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

Side by Side Diff: sync/notifier/invalidator_test_template.h

Issue 12847003: Separate invalidator and sync client ID (part 2/2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix sync_listen_notifications utility Created 7 years, 9 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 // This class defines tests that implementations of Invalidator should pass in 5 // This class defines tests that implementations of Invalidator should pass in
6 // order to be conformant. Here's how you use it to test your implementation. 6 // order to be conformant. Here's how you use it to test your implementation.
7 // 7 //
8 // Say your class is called MyInvalidator. Then you need to define a class 8 // Say your class is called MyInvalidator. Then you need to define a class
9 // called MyInvalidatorTestDelegate in my_sync_notifier_unittest.cc like this: 9 // called MyInvalidatorTestDelegate in my_sync_notifier_unittest.cc like this:
10 // 10 //
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 class InvalidatorTest : public testing::Test { 94 class InvalidatorTest : public testing::Test {
95 protected: 95 protected:
96 InvalidatorTest() 96 InvalidatorTest()
97 : id1(ipc::invalidation::ObjectSource::TEST, "a"), 97 : id1(ipc::invalidation::ObjectSource::TEST, "a"),
98 id2(ipc::invalidation::ObjectSource::TEST, "b"), 98 id2(ipc::invalidation::ObjectSource::TEST, "b"),
99 id3(ipc::invalidation::ObjectSource::TEST, "c"), 99 id3(ipc::invalidation::ObjectSource::TEST, "c"),
100 id4(ipc::invalidation::ObjectSource::TEST, "d") { 100 id4(ipc::invalidation::ObjectSource::TEST, "d") {
101 } 101 }
102 102
103 Invalidator* CreateAndInitializeInvalidator() { 103 Invalidator* CreateAndInitializeInvalidator() {
104 this->delegate_.CreateInvalidator("fake_initial_state", 104 this->delegate_.CreateInvalidator("fake_invalidator_client_id",
105 "fake_initial_state",
105 this->fake_tracker_.AsWeakPtr()); 106 this->fake_tracker_.AsWeakPtr());
106 Invalidator* const invalidator = this->delegate_.GetInvalidator(); 107 Invalidator* const invalidator = this->delegate_.GetInvalidator();
107 108
108 invalidator->SetUniqueId("fake_id");
109 this->delegate_.WaitForInvalidator(); 109 this->delegate_.WaitForInvalidator();
110 invalidator->UpdateCredentials("foo@bar.com", "fake_token"); 110 invalidator->UpdateCredentials("foo@bar.com", "fake_token");
111 this->delegate_.WaitForInvalidator(); 111 this->delegate_.WaitForInvalidator();
112 112
113 return invalidator; 113 return invalidator;
114 } 114 }
115 115
116 FakeInvalidationStateTracker fake_tracker_; 116 FakeInvalidationStateTracker fake_tracker_;
117 InvalidatorTestDelegate delegate_; 117 InvalidatorTestDelegate delegate_;
118 118
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 invalidator->UnregisterHandler(&handler); 367 invalidator->UnregisterHandler(&handler);
368 } 368 }
369 369
370 REGISTER_TYPED_TEST_CASE_P(InvalidatorTest, 370 REGISTER_TYPED_TEST_CASE_P(InvalidatorTest,
371 Basic, MultipleHandlers, EmptySetUnregisters, 371 Basic, MultipleHandlers, EmptySetUnregisters,
372 GetInvalidatorStateAlwaysCurrent); 372 GetInvalidatorStateAlwaysCurrent);
373 373
374 } // namespace syncer 374 } // namespace syncer
375 375
376 #endif // SYNC_NOTIFIER_INVALIDATOR_TEST_TEMPLATE_H_ 376 #endif // SYNC_NOTIFIER_INVALIDATOR_TEST_TEMPLATE_H_
OLDNEW
« no previous file with comments | « sync/notifier/invalidator_registrar_unittest.cc ('k') | sync/notifier/non_blocking_invalidator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698