| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ |
| 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // a per-test basis by running a command | 88 // a per-test basis by running a command |
| 89 EXTERNAL_LIVE_SERVER, // A remote server that the test code has no control | 89 EXTERNAL_LIVE_SERVER, // A remote server that the test code has no control |
| 90 // over whatsoever; cross your fingers that the | 90 // over whatsoever; cross your fingers that the |
| 91 // account state is initially clean. | 91 // account state is initially clean. |
| 92 IN_PROCESS_FAKE_SERVER, // The fake Sync server (FakeServer) running | 92 IN_PROCESS_FAKE_SERVER, // The fake Sync server (FakeServer) running |
| 93 // in-process (bypassing HTTP calls). This | 93 // in-process (bypassing HTTP calls). This |
| 94 // ServerType will eventually replace | 94 // ServerType will eventually replace |
| 95 // LOCAL_PYTHON_SERVER. | 95 // LOCAL_PYTHON_SERVER. |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 // NOTE: IMPORTANT the enum here should match with | |
| 99 // the enum defined on the chromiumsync.py test server impl. | |
| 100 enum SyncErrorFrequency { | |
| 101 // Uninitialized state. | |
| 102 ERROR_FREQUENCY_NONE, | |
| 103 | |
| 104 // Server sends the error on all requests. | |
| 105 ERROR_FREQUENCY_ALWAYS, | |
| 106 | |
| 107 // Server sends the error on two thirds of the request. | |
| 108 // Note this is not random. The server would send the | |
| 109 // error on the first 2 requests of every 3 requests. | |
| 110 ERROR_FREQUENCY_TWO_THIRDS | |
| 111 }; | |
| 112 | |
| 113 // A SyncTest must be associated with a particular test type. | 98 // A SyncTest must be associated with a particular test type. |
| 114 explicit SyncTest(TestType test_type); | 99 explicit SyncTest(TestType test_type); |
| 115 | 100 |
| 116 virtual ~SyncTest(); | 101 virtual ~SyncTest(); |
| 117 | 102 |
| 118 // Validates command line parameters and creates a local python test server if | 103 // Validates command line parameters and creates a local python test server if |
| 119 // specified. | 104 // specified. |
| 120 virtual void SetUp() override; | 105 virtual void SetUp() override; |
| 121 | 106 |
| 122 // Brings down local python test server if one was created. | 107 // Brings down local python test server if one was created. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 void TriggerMigrationDoneError(syncer::ModelTypeSet model_types); | 214 void TriggerMigrationDoneError(syncer::ModelTypeSet model_types); |
| 230 | 215 |
| 231 // Triggers a transient error on the server. Note the server will stay in | 216 // Triggers a transient error on the server. Note the server will stay in |
| 232 // this state until shut down. | 217 // this state until shut down. |
| 233 void TriggerTransientError(); | 218 void TriggerTransientError(); |
| 234 | 219 |
| 235 // Triggers an XMPP auth error on the server. Note the server will | 220 // Triggers an XMPP auth error on the server. Note the server will |
| 236 // stay in this state until shut down. | 221 // stay in this state until shut down. |
| 237 void TriggerXmppAuthError(); | 222 void TriggerXmppAuthError(); |
| 238 | 223 |
| 239 // Triggers a sync error on the server. | |
| 240 // error: The error the server is expected to return. | |
| 241 // frequency: Frequency with which the error is returned. | |
| 242 void TriggerSyncError(const syncer::SyncProtocolError& error, | |
| 243 SyncErrorFrequency frequency); | |
| 244 | |
| 245 // Triggers the creation the Synced Bookmarks folder on the server. | 224 // Triggers the creation the Synced Bookmarks folder on the server. |
| 246 void TriggerCreateSyncedBookmarks(); | 225 void TriggerCreateSyncedBookmarks(); |
| 247 | 226 |
| 248 // Returns the FakeServer being used for the test or NULL if FakeServer is | 227 // Returns the FakeServer being used for the test or NULL if FakeServer is |
| 249 // not being used. | 228 // not being used. |
| 250 fake_server::FakeServer* GetFakeServer() const; | 229 fake_server::FakeServer* GetFakeServer() const; |
| 251 | 230 |
| 252 protected: | 231 protected: |
| 253 // Add custom switches needed for running the test. | 232 // Add custom switches needed for running the test. |
| 254 virtual void AddTestSwitches(base::CommandLine* cl); | 233 virtual void AddTestSwitches(base::CommandLine* cl); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 // Fake URLFetcher factory used to mock out GAIA signin. | 397 // Fake URLFetcher factory used to mock out GAIA signin. |
| 419 scoped_ptr<net::FakeURLFetcherFactory> fake_factory_; | 398 scoped_ptr<net::FakeURLFetcherFactory> fake_factory_; |
| 420 | 399 |
| 421 // The URLFetcherImplFactory instance used to instantiate |fake_factory_|. | 400 // The URLFetcherImplFactory instance used to instantiate |fake_factory_|. |
| 422 scoped_ptr<net::URLFetcherImplFactory> factory_; | 401 scoped_ptr<net::URLFetcherImplFactory> factory_; |
| 423 | 402 |
| 424 DISALLOW_COPY_AND_ASSIGN(SyncTest); | 403 DISALLOW_COPY_AND_ASSIGN(SyncTest); |
| 425 }; | 404 }; |
| 426 | 405 |
| 427 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ | 406 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ |
| OLD | NEW |