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

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

Issue 296743005: sync: Implement fake server reflection blocking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split enable and disable methods Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.cc ('k') | sync/test/fake_server/fake_server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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
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
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
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_
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.cc ('k') | sync/test/fake_server/fake_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698