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
3 // found in the LICENSE file.
5 #ifndef SYNC_TEST_TRACKABLE_MOCK_INVALIDATION_H_
6 #define SYNC_TEST_TRACKABLE_MOCK_INVALIDATION_H_
8 #include "sync/test/mock_invalidation.h"
12 class MockInvalidationTracker
;
14 // A variant of MockInvalidation that supports acknowledgements.
16 // With the help of a MockInvalidationTracker, this can be used to test
17 // sync's use of the Drop() and Acknowledge() methods.
18 class TrackableMockInvalidation
: public MockInvalidation
{
20 TrackableMockInvalidation(bool is_unknown_version
,
22 const std::string
& payload
,
23 MockInvalidationTracker
* tracker
,
25 ~TrackableMockInvalidation() override
;
27 // Forwards notice of the acknowledgement of this invalidation to the
29 void Acknowledge() override
;
31 // Forwards notice of the drop of this invalidation to the |tracker_|.
34 // Returns the integer used to identify this object with the |tracker_|.
38 // The MockInvalidationTracker that initialized this object, and which keeps
39 // track of its acknowledgement status. It is expected to outlive the
40 // invalidations. The data required for unit test assertions lives there.
41 MockInvalidationTracker
* tracker_
;
43 // An identifier that uniquely identifies this invalidation to its
46 // This is necessary in part because invalidations may be short lived; the
47 // invalidation may be deleted by the time we want to make assertions about
54 #endif // SYNC_TEST_TRACKABLE_MOCK_INVALIDATION_H_