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

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

Issue 308963006: Convert Sync BirthdayErrorTest to use FakeServer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
« 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 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 // 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
62 // returned and this method has no effect.
63 bool SetNewStoreBirthday(const std::string& store_birthday);
64
60 // Adds |observer| to FakeServer's observer list. This should be called 65 // Adds |observer| to FakeServer's observer list. This should be called
61 // before the Profile associated with |observer| is connected to the server. 66 // before the Profile associated with |observer| is connected to the server.
62 void AddObserver(Observer* observer); 67 void AddObserver(Observer* observer);
63 68
64 // Removes |observer| from the FakeServer's observer list. This method 69 // Removes |observer| from the FakeServer's observer list. This method
65 // must be called if AddObserver was ever called with |observer|. 70 // must be called if AddObserver was ever called with |observer|.
66 void RemoveObserver(Observer* observer); 71 void RemoveObserver(Observer* observer);
67 72
68 private: 73 private:
69 typedef std::map<std::string, FakeServerEntity*> EntityMap; 74 typedef std::map<std::string, FakeServerEntity*> EntityMap;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 bool IsChild(const std::string& id, const std::string& potential_parent_id); 113 bool IsChild(const std::string& id, const std::string& potential_parent_id);
109 114
110 // Creates and saves tombstones for all children of the entity with the given 115 // Creates and saves tombstones for all children of the entity with the given
111 // |id|. A tombstone is not created for the entity itself. 116 // |id|. A tombstone is not created for the entity itself.
112 bool DeleteChildren(const std::string& id); 117 bool DeleteChildren(const std::string& id);
113 118
114 // This is the last version number assigned to an entity. The next entity will 119 // This is the last version number assigned to an entity. The next entity will
115 // have a version number of version_ + 1. 120 // have a version number of version_ + 1.
116 int64 version_; 121 int64 version_;
117 122
118 // The current birthday value. 123 // The current store birthday value.
119 std::string birthday_; 124 std::string store_birthday_;
120 125
121 // All SyncEntity objects saved by the server. The key value is the entity's 126 // All SyncEntity objects saved by the server. The key value is the entity's
122 // id string. 127 // id string.
123 EntityMap entities_; 128 EntityMap entities_;
124 129
125 // All Keystore keys known to the server. 130 // All Keystore keys known to the server.
126 std::vector<std::string> keystore_keys_; 131 std::vector<std::string> keystore_keys_;
127 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
« 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