| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef SYNC_TEST_MOCK_INVALIDATION_H_ | |
| 6 #define SYNC_TEST_MOCK_INVALIDATION_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <memory> | |
| 11 #include <string> | |
| 12 | |
| 13 #include "sync/internal_api/public/base/invalidation_interface.h" | |
| 14 | |
| 15 namespace syncer { | |
| 16 | |
| 17 // An InvalidationInterface used by sync for testing. | |
| 18 // It does not support any form of acknowledgements. | |
| 19 class MockInvalidation : public InvalidationInterface { | |
| 20 public: | |
| 21 // Helpers to build new MockInvalidations. | |
| 22 static std::unique_ptr<MockInvalidation> BuildUnknownVersion(); | |
| 23 static std::unique_ptr<MockInvalidation> Build(int64_t version, | |
| 24 const std::string& payload); | |
| 25 | |
| 26 ~MockInvalidation() override; | |
| 27 | |
| 28 // Implementation of InvalidationInterface. | |
| 29 bool IsUnknownVersion() const override; | |
| 30 const std::string& GetPayload() const override; | |
| 31 int64_t GetVersion() const override; | |
| 32 void Acknowledge() override; | |
| 33 void Drop() override; | |
| 34 | |
| 35 protected: | |
| 36 MockInvalidation(bool is_unknown_version, | |
| 37 int64_t version, | |
| 38 const std::string& payload); | |
| 39 | |
| 40 // Whether or not this is an 'unknown version' invalidation. | |
| 41 const bool is_unknown_version_; | |
| 42 | |
| 43 // The version of this invalidation. Valid only if !is_unknown_version_. | |
| 44 const int64_t version_; | |
| 45 | |
| 46 // The payload of this invalidation. Valid only if !is_unknown_version_. | |
| 47 const std::string payload_; | |
| 48 }; | |
| 49 | |
| 50 } // namespace syncer | |
| 51 | |
| 52 #endif // SYNC_TEST_MOCK_INVALIDATION_H_ | |
| OLD | NEW |