Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / sync / test / mock_invalidation.h
blob65d1bcef2f66f99d320e83196c58cc0a68d87ffe
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_MOCK_INVALIDATION_H_
6 #define SYNC_TEST_MOCK_INVALIDATION_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "sync/internal_api/public/base/invalidation_interface.h"
11 namespace syncer {
13 // An InvalidationInterface used by sync for testing.
14 // It does not support any form of acknowledgements.
15 class MockInvalidation : public InvalidationInterface {
16 public:
17 // Helpers to build new MockInvalidations.
18 static scoped_ptr<MockInvalidation> BuildUnknownVersion();
19 static scoped_ptr<MockInvalidation> Build(int64 version,
20 const std::string& payload);
22 ~MockInvalidation() override;
24 // Implementation of InvalidationInterface.
25 bool IsUnknownVersion() const override;
26 const std::string& GetPayload() const override;
27 int64 GetVersion() const override;
28 void Acknowledge() override;
29 void Drop() override;
31 protected:
32 MockInvalidation(bool is_unknown_version,
33 int64 version,
34 const std::string& payload);
36 // Whether or not this is an 'unknown version' invalidation.
37 const bool is_unknown_version_;
39 // The version of this invalidation. Valid only if !is_unknown_version_.
40 const int64 version_;
42 // The payload of this invalidation. Valid only if !is_unknown_version_.
43 const std::string payload_;
46 } // namespace syncer
48 #endif // SYNC_TEST_MOCK_INVALIDATION_H_