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_FAKE_SERVER_FAKE_SERVER_H_ | 5 #ifndef SYNC_TEST_FAKE_SERVER_FAKE_SERVER_H_ |
6 #define SYNC_TEST_FAKE_SERVER_FAKE_SERVER_H_ | 6 #define SYNC_TEST_FAKE_SERVER_FAKE_SERVER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 14 matching lines...) Expand all Loading... |
25 public: | 25 public: |
26 typedef base::Callback<void(int, int, const std::string&)> | 26 typedef base::Callback<void(int, int, const std::string&)> |
27 HandleCommandCallback; | 27 HandleCommandCallback; |
28 | 28 |
29 class Observer { | 29 class Observer { |
30 public: | 30 public: |
31 virtual ~Observer() {} | 31 virtual ~Observer() {} |
32 | 32 |
33 // Called after FakeServer has processed a successful commit. The types | 33 // Called after FakeServer has processed a successful commit. The types |
34 // updated as part of the commit are passed in |committed_model_types|. | 34 // updated as part of the commit are passed in |committed_model_types|. |
35 virtual void OnCommit(syncer::ModelTypeSet committed_model_types) = 0; | 35 virtual void OnCommit( |
| 36 const std::string& committer_id, |
| 37 syncer::ModelTypeSet committed_model_types) = 0; |
36 }; | 38 }; |
37 | 39 |
38 FakeServer(); | 40 FakeServer(); |
39 virtual ~FakeServer(); | 41 virtual ~FakeServer(); |
40 | 42 |
41 // Asynchronously handles a /command POST to the server. If the error_code is | 43 // Asynchronously handles a /command POST to the server. If the error_code is |
42 // passed to |callback| is 0 (success), the POST's response code and content | 44 // passed to |callback| is 0 (success), the POST's response code and content |
43 // will also be passed. | 45 // will also be passed. |
44 void HandleCommand(const std::string& request, | 46 void HandleCommand(const std::string& request, |
45 const HandleCommandCallback& callback); | 47 const HandleCommandCallback& callback); |
(...skipping 18 matching lines...) Expand all Loading... |
64 void RemoveObserver(Observer* observer); | 66 void RemoveObserver(Observer* observer); |
65 | 67 |
66 private: | 68 private: |
67 typedef std::map<std::string, FakeServerEntity*> EntityMap; | 69 typedef std::map<std::string, FakeServerEntity*> EntityMap; |
68 | 70 |
69 // Processes a GetUpdates call. | 71 // Processes a GetUpdates call. |
70 bool HandleGetUpdatesRequest(const sync_pb::GetUpdatesMessage& get_updates, | 72 bool HandleGetUpdatesRequest(const sync_pb::GetUpdatesMessage& get_updates, |
71 sync_pb::GetUpdatesResponse* response); | 73 sync_pb::GetUpdatesResponse* response); |
72 | 74 |
73 // Processes a Commit call. | 75 // Processes a Commit call. |
74 bool HandleCommitRequest(const sync_pb::CommitMessage& commit, | 76 bool HandleCommitRequest(const sync_pb::CommitMessage& message, |
| 77 const std::string& invalidator_client_id, |
75 sync_pb::CommitResponse* response); | 78 sync_pb::CommitResponse* response); |
76 | 79 |
77 // Inserts the default permanent items in |entities_|. | 80 // Inserts the default permanent items in |entities_|. |
78 bool CreateDefaultPermanentItems(); | 81 bool CreateDefaultPermanentItems(); |
79 | 82 |
80 // Inserts the mobile bookmarks folder entity in |entities_|. | 83 // Inserts the mobile bookmarks folder entity in |entities_|. |
81 bool CreateMobileBookmarksPermanentItem(); | 84 bool CreateMobileBookmarksPermanentItem(); |
82 | 85 |
83 // Saves a |entity| to |entities_|. | 86 // Saves a |entity| to |entities_|. |
84 void SaveEntity(FakeServerEntity* entity); | 87 void SaveEntity(FakeServerEntity* entity); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // All Keystore keys known to the server. | 125 // All Keystore keys known to the server. |
123 std::vector<std::string> keystore_keys_; | 126 std::vector<std::string> keystore_keys_; |
124 | 127 |
125 // FakeServer's observers. | 128 // FakeServer's observers. |
126 ObserverList<Observer, true> observers_; | 129 ObserverList<Observer, true> observers_; |
127 }; | 130 }; |
128 | 131 |
129 } // namespace fake_server | 132 } // namespace fake_server |
130 | 133 |
131 #endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_H_ | 134 #endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_H_ |
OLD | NEW |