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

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

Issue 310103004: Add integraton test for sync backup/rollback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // Adds the FakeServerEntity* owned by |entity| to the server's collection 55 // Adds the FakeServerEntity* owned by |entity| to the server's collection
56 // of entities. This method makes no guarantees that the added entity will 56 // of entities. This method makes no guarantees that the added entity will
57 // result in successful server operations. 57 // result in successful server operations.
58 void InjectEntity(scoped_ptr<FakeServerEntity> entity); 58 void InjectEntity(scoped_ptr<FakeServerEntity> entity);
59 59
60 // Sets a new store birthday so that tests may trigger a NOT_MY_BIRTHDAY 60 // Sets a new store birthday so that tests may trigger a NOT_MY_BIRTHDAY
61 // error. If |store_birthday| is the same as |store_birthday_|, false is 61 // error. If |store_birthday| is the same as |store_birthday_|, false is
62 // returned and this method has no effect. 62 // returned and this method has no effect.
63 bool SetNewStoreBirthday(const std::string& store_birthday); 63 bool SetNewStoreBirthday(const std::string& store_birthday);
64 64
65 // Return |error_type| on next sync request.
66 void TriggerError(const sync_pb::SyncEnums::ErrorType& error_type);
67
65 // Adds |observer| to FakeServer's observer list. This should be called 68 // Adds |observer| to FakeServer's observer list. This should be called
66 // before the Profile associated with |observer| is connected to the server. 69 // before the Profile associated with |observer| is connected to the server.
67 void AddObserver(Observer* observer); 70 void AddObserver(Observer* observer);
68 71
69 // Removes |observer| from the FakeServer's observer list. This method 72 // Removes |observer| from the FakeServer's observer list. This method
70 // must be called if AddObserver was ever called with |observer|. 73 // must be called if AddObserver was ever called with |observer|.
71 void RemoveObserver(Observer* observer); 74 void RemoveObserver(Observer* observer);
72 75
73 private: 76 private:
74 typedef std::map<std::string, FakeServerEntity*> EntityMap; 77 typedef std::map<std::string, FakeServerEntity*> EntityMap;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // The current store birthday value. 126 // The current store birthday value.
124 std::string store_birthday_; 127 std::string store_birthday_;
125 128
126 // All SyncEntity objects saved by the server. The key value is the entity's 129 // All SyncEntity objects saved by the server. The key value is the entity's
127 // id string. 130 // id string.
128 EntityMap entities_; 131 EntityMap entities_;
129 132
130 // All Keystore keys known to the server. 133 // All Keystore keys known to the server.
131 std::vector<std::string> keystore_keys_; 134 std::vector<std::string> keystore_keys_;
132 135
136 sync_pb::SyncEnums::ErrorType error_type_;
137
133 // FakeServer's observers. 138 // FakeServer's observers.
134 ObserverList<Observer, true> observers_; 139 ObserverList<Observer, true> observers_;
135 }; 140 };
136 141
137 } // namespace fake_server 142 } // namespace fake_server
138 143
139 #endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_H_ 144 #endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698