OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 InvalidationService should | 5 // This class defines tests that implementations of InvalidationService should |
6 // pass in order to be conformant. Here's how you use it to test your | 6 // pass in order to be conformant. Here's how you use it to test your |
7 // implementation. | 7 // implementation. |
8 // | 8 // |
9 // Say your class is called MyInvalidationService. Then you need to define a | 9 // Say your class is called MyInvalidationService. Then you need to define a |
10 // class called MyInvalidationServiceTestDelegate in | 10 // class called MyInvalidationServiceTestDelegate in |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 namespace internal { | 333 namespace internal { |
334 | 334 |
335 // A FakeInvalidationHandler that is "bound" to a specific | 335 // A FakeInvalidationHandler that is "bound" to a specific |
336 // InvalidationService. This is for cross-referencing state information with | 336 // InvalidationService. This is for cross-referencing state information with |
337 // the bound InvalidationService. | 337 // the bound InvalidationService. |
338 class BoundFakeInvalidationHandler : public syncer::FakeInvalidationHandler { | 338 class BoundFakeInvalidationHandler : public syncer::FakeInvalidationHandler { |
339 public: | 339 public: |
340 explicit BoundFakeInvalidationHandler( | 340 explicit BoundFakeInvalidationHandler( |
341 const invalidation::InvalidationService& invalidator); | 341 const invalidation::InvalidationService& invalidator); |
342 virtual ~BoundFakeInvalidationHandler(); | 342 ~BoundFakeInvalidationHandler() override; |
343 | 343 |
344 // Returns the last return value of GetInvalidatorState() on the | 344 // Returns the last return value of GetInvalidatorState() on the |
345 // bound invalidator from the last time the invalidator state | 345 // bound invalidator from the last time the invalidator state |
346 // changed. | 346 // changed. |
347 syncer::InvalidatorState GetLastRetrievedState() const; | 347 syncer::InvalidatorState GetLastRetrievedState() const; |
348 | 348 |
349 // InvalidationHandler implementation. | 349 // InvalidationHandler implementation. |
350 virtual void OnInvalidatorStateChange( | 350 void OnInvalidatorStateChange(syncer::InvalidatorState state) override; |
351 syncer::InvalidatorState state) override; | |
352 | 351 |
353 private: | 352 private: |
354 const invalidation::InvalidationService& invalidator_; | 353 const invalidation::InvalidationService& invalidator_; |
355 syncer::InvalidatorState last_retrieved_state_; | 354 syncer::InvalidatorState last_retrieved_state_; |
356 | 355 |
357 DISALLOW_COPY_AND_ASSIGN(BoundFakeInvalidationHandler); | 356 DISALLOW_COPY_AND_ASSIGN(BoundFakeInvalidationHandler); |
358 }; | 357 }; |
359 | 358 |
360 } // namespace internal | 359 } // namespace internal |
361 | 360 |
(...skipping 17 matching lines...) Expand all Loading... |
379 handler.GetLastRetrievedState()); | 378 handler.GetLastRetrievedState()); |
380 | 379 |
381 invalidator->UnregisterInvalidationHandler(&handler); | 380 invalidator->UnregisterInvalidationHandler(&handler); |
382 } | 381 } |
383 | 382 |
384 REGISTER_TYPED_TEST_CASE_P(InvalidationServiceTest, | 383 REGISTER_TYPED_TEST_CASE_P(InvalidationServiceTest, |
385 Basic, MultipleHandlers, EmptySetUnregisters, | 384 Basic, MultipleHandlers, EmptySetUnregisters, |
386 GetInvalidatorStateAlwaysCurrent); | 385 GetInvalidatorStateAlwaysCurrent); |
387 | 386 |
388 #endif // COMPONENTS_INVALIDATION_INVALIDATION_SERVICE_TEST_TEMPLATE_H_ | 387 #endif // COMPONENTS_INVALIDATION_INVALIDATION_SERVICE_TEST_TEMPLATE_H_ |
OLD | NEW |