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