| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 bool SetNewStoreBirthday(const std::string& store_birthday); | 63 bool SetNewStoreBirthday(const std::string& store_birthday); |
| 64 | 64 |
| 65 // Puts the server in a state where it acts as if authentication has | 65 // Puts the server in a state where it acts as if authentication has |
| 66 // succeeded. | 66 // succeeded. |
| 67 void SetAuthenticated(); | 67 void SetAuthenticated(); |
| 68 | 68 |
| 69 // Puts the server in a state where all commands will fail with an | 69 // Puts the server in a state where all commands will fail with an |
| 70 // authentication error. | 70 // authentication error. |
| 71 void SetUnauthenticated(); | 71 void SetUnauthenticated(); |
| 72 | 72 |
| 73 // Return |error_type| on next sync request. |
| 74 void TriggerError(const sync_pb::SyncEnums::ErrorType& error_type); |
| 75 |
| 73 // Adds |observer| to FakeServer's observer list. This should be called | 76 // Adds |observer| to FakeServer's observer list. This should be called |
| 74 // before the Profile associated with |observer| is connected to the server. | 77 // before the Profile associated with |observer| is connected to the server. |
| 75 void AddObserver(Observer* observer); | 78 void AddObserver(Observer* observer); |
| 76 | 79 |
| 77 // Removes |observer| from the FakeServer's observer list. This method | 80 // Removes |observer| from the FakeServer's observer list. This method |
| 78 // must be called if AddObserver was ever called with |observer|. | 81 // must be called if AddObserver was ever called with |observer|. |
| 79 void RemoveObserver(Observer* observer); | 82 void RemoveObserver(Observer* observer); |
| 80 | 83 |
| 81 private: | 84 private: |
| 82 typedef std::map<std::string, FakeServerEntity*> EntityMap; | 85 typedef std::map<std::string, FakeServerEntity*> EntityMap; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // authenticated. | 138 // authenticated. |
| 136 bool authenticated_; | 139 bool authenticated_; |
| 137 | 140 |
| 138 // All SyncEntity objects saved by the server. The key value is the entity's | 141 // All SyncEntity objects saved by the server. The key value is the entity's |
| 139 // id string. | 142 // id string. |
| 140 EntityMap entities_; | 143 EntityMap entities_; |
| 141 | 144 |
| 142 // All Keystore keys known to the server. | 145 // All Keystore keys known to the server. |
| 143 std::vector<std::string> keystore_keys_; | 146 std::vector<std::string> keystore_keys_; |
| 144 | 147 |
| 148 sync_pb::SyncEnums::ErrorType error_type_; |
| 149 |
| 145 // FakeServer's observers. | 150 // FakeServer's observers. |
| 146 ObserverList<Observer, true> observers_; | 151 ObserverList<Observer, true> observers_; |
| 147 }; | 152 }; |
| 148 | 153 |
| 149 } // namespace fake_server | 154 } // namespace fake_server |
| 150 | 155 |
| 151 #endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_H_ | 156 #endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_H_ |
| OLD | NEW |