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

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: cleanup includes 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // server. The dictionary keys are the strings generated by ModelTypeToString 50 // server. The dictionary keys are the strings generated by ModelTypeToString
51 // and the values are ListValues containing StringValue versions of entity 51 // and the values are ListValues containing StringValue versions of entity
52 // names. 52 // names.
53 scoped_ptr<base::DictionaryValue> GetEntitiesAsDictionaryValue(); 53 scoped_ptr<base::DictionaryValue> GetEntitiesAsDictionaryValue();
54 54
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 // Return |error_type| on next sync request.
61 void TriggerError(const sync_pb::SyncEnums::ErrorType& error_type);
62
60 // Adds |observer| to FakeServer's observer list. This should be called 63 // Adds |observer| to FakeServer's observer list. This should be called
61 // before the Profile associated with |observer| is connected to the server. 64 // before the Profile associated with |observer| is connected to the server.
62 void AddObserver(Observer* observer); 65 void AddObserver(Observer* observer);
63 66
64 // Removes |observer| from the FakeServer's observer list. This method 67 // Removes |observer| from the FakeServer's observer list. This method
65 // must be called if AddObserver was ever called with |observer|. 68 // must be called if AddObserver was ever called with |observer|.
66 void RemoveObserver(Observer* observer); 69 void RemoveObserver(Observer* observer);
67 70
68 private: 71 private:
69 typedef std::map<std::string, FakeServerEntity*> EntityMap; 72 typedef std::map<std::string, FakeServerEntity*> EntityMap;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // The current birthday value. 121 // The current birthday value.
119 std::string birthday_; 122 std::string birthday_;
120 123
121 // All SyncEntity objects saved by the server. The key value is the entity's 124 // All SyncEntity objects saved by the server. The key value is the entity's
122 // id string. 125 // id string.
123 EntityMap entities_; 126 EntityMap entities_;
124 127
125 // All Keystore keys known to the server. 128 // All Keystore keys known to the server.
126 std::vector<std::string> keystore_keys_; 129 std::vector<std::string> keystore_keys_;
127 130
131 sync_pb::SyncEnums::ErrorType error_type_;
132
128 // FakeServer's observers. 133 // FakeServer's observers.
129 ObserverList<Observer, true> observers_; 134 ObserverList<Observer, true> observers_;
130 }; 135 };
131 136
132 } // namespace fake_server 137 } // namespace fake_server
133 138
134 #endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_H_ 139 #endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698