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

Side by Side Diff: sync/test/engine/mock_commit_queue.h

Issue 1325453003: [Sync] rename USS processor / worker interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update base on comments Created 5 years, 3 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_ENGINE_MOCK_MODEL_TYPE_SYNC_WORKER_H_ 5 #ifndef SYNC_TEST_ENGINE_MOCK_COMMIT_QUEUE_H_
6 #define SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_SYNC_WORKER_H_ 6 #define SYNC_TEST_ENGINE_MOCK_COMMIT_QUEUE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "sync/engine/model_type_sync_worker.h" 11 #include "sync/engine/commit_queue.h"
12 #include "sync/internal_api/public/non_blocking_sync_common.h" 12 #include "sync/internal_api/public/non_blocking_sync_common.h"
13 13
14 namespace syncer_v2 { 14 namespace syncer_v2 {
15 15
16 // Receives and records commit requests sent through the ModelTypeSyncWorker. 16 // Receives and records commit requests sent through the CommitQueue.
17 // 17 //
18 // This class also includes features intended to help mock out server behavior. 18 // This class also includes features intended to help mock out server behavior.
19 // It has some basic functionality to keep track of server state and generate 19 // It has some basic functionality to keep track of server state and generate
20 // plausible UpdateResponseData and CommitResponseData messages. 20 // plausible UpdateResponseData and CommitResponseData messages.
21 class MockModelTypeSyncWorker : public ModelTypeSyncWorker { 21 class MockCommitQueue : public CommitQueue {
22 public: 22 public:
23 MockModelTypeSyncWorker(); 23 MockCommitQueue();
24 ~MockModelTypeSyncWorker() override; 24 ~MockCommitQueue() override;
25 25
26 // Implementation of ModelTypeSyncWorker. 26 // Implementation of CommitQueue.
27 void EnqueueForCommit(const CommitRequestDataList& list) override; 27 void EnqueueForCommit(const CommitRequestDataList& list) override;
28 28
29 // Getters to inspect the requests sent to this object. 29 // Getters to inspect the requests sent to this object.
30 size_t GetNumCommitRequestLists() const; 30 size_t GetNumCommitRequestLists() const;
31 CommitRequestDataList GetNthCommitRequestList(size_t n) const; 31 CommitRequestDataList GetNthCommitRequestList(size_t n) const;
32 bool HasCommitRequestForTagHash(const std::string& tag_hash) const; 32 bool HasCommitRequestForTagHash(const std::string& tag_hash) const;
33 CommitRequestData GetLatestCommitRequestForTagHash( 33 CommitRequestData GetLatestCommitRequestForTagHash(
34 const std::string& tag_hash) const; 34 const std::string& tag_hash) const;
35 35
36 // Functions to produce state as though it came from a real server and had 36 // Functions to produce state as though it came from a real server and had
37 // been filtered through a real ModelTypeSyncWorker. 37 // been filtered through a real CommitQueue.
38 38
39 // Returns an UpdateResponseData representing an update received from 39 // Returns an UpdateResponseData representing an update received from
40 // the server. Updates server state accordingly. 40 // the server. Updates server state accordingly.
41 // 41 //
42 // The |version_offset| field can be used to emulate stale data (ie. versions 42 // The |version_offset| field can be used to emulate stale data (ie. versions
43 // going backwards), reflections and redeliveries (ie. several instances of 43 // going backwards), reflections and redeliveries (ie. several instances of
44 // the same version) or new updates. 44 // the same version) or new updates.
45 UpdateResponseData UpdateFromServer( 45 UpdateResponseData UpdateFromServer(
46 int64 version_offset, 46 int64 version_offset,
47 const std::string& tag_hash, 47 const std::string& tag_hash,
(...skipping 25 matching lines...) Expand all
73 // A record of past commits requests. 73 // A record of past commits requests.
74 std::vector<CommitRequestDataList> commit_request_lists_; 74 std::vector<CommitRequestDataList> commit_request_lists_;
75 75
76 // Map of versions by client tag. 76 // Map of versions by client tag.
77 // This is an essential part of the mocked server state. 77 // This is an essential part of the mocked server state.
78 std::map<const std::string, int64> server_versions_; 78 std::map<const std::string, int64> server_versions_;
79 79
80 // Name of the encryption key in use on other clients. 80 // Name of the encryption key in use on other clients.
81 std::string server_encryption_key_name_; 81 std::string server_encryption_key_name_;
82 82
83 DISALLOW_COPY_AND_ASSIGN(MockModelTypeSyncWorker); 83 DISALLOW_COPY_AND_ASSIGN(MockCommitQueue);
84 }; 84 };
85 85
86 } // namespace syncer 86 } // namespace syncer
87 87
88 #endif // SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_SYNC_WORKER_H_ 88 #endif // SYNC_TEST_ENGINE_MOCK_COMMIT_QUEUE_H_
OLDNEW
« no previous file with comments | « sync/test/engine/injectable_sync_context_proxy.cc ('k') | sync/test/engine/mock_commit_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698