Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1253)

Side by Side Diff: sync/test/mock_invalidation.h

Issue 1866243002: Convert //sync from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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> 8 #include <stdint.h>
9 9
10 #include <memory>
10 #include <string> 11 #include <string>
11 12
12 #include "base/memory/scoped_ptr.h"
13 #include "sync/internal_api/public/base/invalidation_interface.h" 13 #include "sync/internal_api/public/base/invalidation_interface.h"
14 14
15 namespace syncer { 15 namespace syncer {
16 16
17 // An InvalidationInterface used by sync for testing. 17 // An InvalidationInterface used by sync for testing.
18 // It does not support any form of acknowledgements. 18 // It does not support any form of acknowledgements.
19 class MockInvalidation : public InvalidationInterface { 19 class MockInvalidation : public InvalidationInterface {
20 public: 20 public:
21 // Helpers to build new MockInvalidations. 21 // Helpers to build new MockInvalidations.
22 static scoped_ptr<MockInvalidation> BuildUnknownVersion(); 22 static std::unique_ptr<MockInvalidation> BuildUnknownVersion();
23 static scoped_ptr<MockInvalidation> Build(int64_t version, 23 static std::unique_ptr<MockInvalidation> Build(int64_t version,
24 const std::string& payload); 24 const std::string& payload);
25 25
26 ~MockInvalidation() override; 26 ~MockInvalidation() override;
27 27
28 // Implementation of InvalidationInterface. 28 // Implementation of InvalidationInterface.
29 bool IsUnknownVersion() const override; 29 bool IsUnknownVersion() const override;
30 const std::string& GetPayload() const override; 30 const std::string& GetPayload() const override;
31 int64_t GetVersion() const override; 31 int64_t GetVersion() const override;
32 void Acknowledge() override; 32 void Acknowledge() override;
33 void Drop() override; 33 void Drop() override;
34 34
35 protected: 35 protected:
36 MockInvalidation(bool is_unknown_version, 36 MockInvalidation(bool is_unknown_version,
37 int64_t version, 37 int64_t version,
38 const std::string& payload); 38 const std::string& payload);
39 39
40 // Whether or not this is an 'unknown version' invalidation. 40 // Whether or not this is an 'unknown version' invalidation.
41 const bool is_unknown_version_; 41 const bool is_unknown_version_;
42 42
43 // The version of this invalidation. Valid only if !is_unknown_version_. 43 // The version of this invalidation. Valid only if !is_unknown_version_.
44 const int64_t version_; 44 const int64_t version_;
45 45
46 // The payload of this invalidation. Valid only if !is_unknown_version_. 46 // The payload of this invalidation. Valid only if !is_unknown_version_.
47 const std::string payload_; 47 const std::string payload_;
48 }; 48 };
49 49
50 } // namespace syncer 50 } // namespace syncer
51 51
52 #endif // SYNC_TEST_MOCK_INVALIDATION_H_ 52 #endif // SYNC_TEST_MOCK_INVALIDATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698