| 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 19 matching lines...) Expand all Loading... |
| 30 class CommandLine; | 30 class CommandLine; |
| 31 } | 31 } |
| 32 | 32 |
| 33 namespace fake_server { | 33 namespace fake_server { |
| 34 class FakeServer; | 34 class FakeServer; |
| 35 class FakeServerInvalidationService; | 35 class FakeServerInvalidationService; |
| 36 } | 36 } |
| 37 | 37 |
| 38 namespace net { | 38 namespace net { |
| 39 class FakeURLFetcherFactory; | 39 class FakeURLFetcherFactory; |
| 40 class ProxyConfig; | |
| 41 class ScopedDefaultHostResolverProc; | 40 class ScopedDefaultHostResolverProc; |
| 42 class URLFetcherImplFactory; | 41 class URLFetcherImplFactory; |
| 43 class URLRequestContextGetter; | 42 class URLRequestContextGetter; |
| 44 } | 43 } |
| 45 | 44 |
| 46 // This is the base class for integration tests for all sync data types. Derived | 45 // This is the base class for integration tests for all sync data types. Derived |
| 47 // classes must be defined for each sync data type. Individual tests are defined | 46 // classes must be defined for each sync data type. Individual tests are defined |
| 48 // using the IN_PROC_BROWSER_TEST_F macro. | 47 // using the IN_PROC_BROWSER_TEST_F macro. |
| 49 class SyncTest : public InProcessBrowserTest { | 48 class SyncTest : public InProcessBrowserTest { |
| 50 public: | 49 public: |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // reflected in the verifier profile. Note: Not all datatypes use this. | 162 // reflected in the verifier profile. Note: Not all datatypes use this. |
| 164 // TODO(rsimha): Hook up all datatypes to this mechanism. | 163 // TODO(rsimha): Hook up all datatypes to this mechanism. |
| 165 void DisableVerifier(); | 164 void DisableVerifier(); |
| 166 | 165 |
| 167 // Initializes sync clients and profiles but does not sync any of them. | 166 // Initializes sync clients and profiles but does not sync any of them. |
| 168 virtual bool SetupClients() WARN_UNUSED_RESULT; | 167 virtual bool SetupClients() WARN_UNUSED_RESULT; |
| 169 | 168 |
| 170 // Initializes sync clients and profiles if required and syncs each of them. | 169 // Initializes sync clients and profiles if required and syncs each of them. |
| 171 virtual bool SetupSync() WARN_UNUSED_RESULT; | 170 virtual bool SetupSync() WARN_UNUSED_RESULT; |
| 172 | 171 |
| 173 // Enable outgoing network connections for the given profile. | |
| 174 virtual void EnableNetwork(Profile* profile); | |
| 175 | |
| 176 // Disable outgoing network connections for the given profile. | |
| 177 virtual void DisableNetwork(Profile* profile); | |
| 178 | |
| 179 // Sets whether or not the sync clients in this test should respond to | 172 // Sets whether or not the sync clients in this test should respond to |
| 180 // notifications of their own commits. Real sync clients do not do this, but | 173 // notifications of their own commits. Real sync clients do not do this, but |
| 181 // many test assertions require this behavior. | 174 // many test assertions require this behavior. |
| 182 // | 175 // |
| 183 // Default is to return true. Test should override this if they require | 176 // Default is to return true. Test should override this if they require |
| 184 // different behavior. | 177 // different behavior. |
| 185 virtual bool TestUsesSelfNotifications(); | 178 virtual bool TestUsesSelfNotifications(); |
| 186 | 179 |
| 187 // Kicks off encryption for profile |index|. | 180 // Kicks off encryption for profile |index|. |
| 188 bool EnableEncryption(int index); | 181 bool EnableEncryption(int index); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 void TriggerNotification(syncer::ModelTypeSet changed_types); | 214 void TriggerNotification(syncer::ModelTypeSet changed_types); |
| 222 | 215 |
| 223 // Returns true if the server being used supports injecting errors. | 216 // Returns true if the server being used supports injecting errors. |
| 224 bool ServerSupportsErrorTriggering() const; | 217 bool ServerSupportsErrorTriggering() const; |
| 225 | 218 |
| 226 // Triggers a migration for one or more datatypes, and waits | 219 // Triggers a migration for one or more datatypes, and waits |
| 227 // for the server to complete it. This operation is available | 220 // for the server to complete it. This operation is available |
| 228 // only if ServerSupportsErrorTriggering() returned true. | 221 // only if ServerSupportsErrorTriggering() returned true. |
| 229 void TriggerMigrationDoneError(syncer::ModelTypeSet model_types); | 222 void TriggerMigrationDoneError(syncer::ModelTypeSet model_types); |
| 230 | 223 |
| 231 // Triggers a transient error on the server. Note the server will stay in | |
| 232 // this state until shut down. | |
| 233 void TriggerTransientError(); | |
| 234 | |
| 235 // Triggers an XMPP auth error on the server. Note the server will | 224 // Triggers an XMPP auth error on the server. Note the server will |
| 236 // stay in this state until shut down. | 225 // stay in this state until shut down. |
| 237 void TriggerXmppAuthError(); | 226 void TriggerXmppAuthError(); |
| 238 | 227 |
| 239 // Triggers a sync error on the server. | 228 // Triggers a sync error on the server. |
| 240 // error: The error the server is expected to return. | 229 // error: The error the server is expected to return. |
| 241 // frequency: Frequency with which the error is returned. | 230 // frequency: Frequency with which the error is returned. |
| 242 void TriggerSyncError(const syncer::SyncProtocolError& error, | 231 void TriggerSyncError(const syncer::SyncProtocolError& error, |
| 243 SyncErrorFrequency frequency); | 232 SyncErrorFrequency frequency); |
| 244 | 233 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 311 |
| 323 // Helper method that waits for up to |wait| for the test server | 312 // Helper method that waits for up to |wait| for the test server |
| 324 // to start. Splits the time into |intervals| intervals, and polls the | 313 // to start. Splits the time into |intervals| intervals, and polls the |
| 325 // server after each interval to see if it has started. Returns true if | 314 // server after each interval to see if it has started. Returns true if |
| 326 // successful. | 315 // successful. |
| 327 bool WaitForTestServerToStart(base::TimeDelta wait, int intervals); | 316 bool WaitForTestServerToStart(base::TimeDelta wait, int intervals); |
| 328 | 317 |
| 329 // Helper method used to check if the test server is up and running. | 318 // Helper method used to check if the test server is up and running. |
| 330 bool IsTestServerRunning(); | 319 bool IsTestServerRunning(); |
| 331 | 320 |
| 332 // Used to disable and enable network connectivity by providing and | |
| 333 // clearing an invalid proxy configuration. | |
| 334 void SetProxyConfig(net::URLRequestContextGetter* context, | |
| 335 const net::ProxyConfig& proxy_config); | |
| 336 | |
| 337 void SetupNetwork(net::URLRequestContextGetter* context); | 321 void SetupNetwork(net::URLRequestContextGetter* context); |
| 338 | 322 |
| 339 // Helper method used to set up fake responses for kClientLoginUrl, | 323 // Helper method used to set up fake responses for kClientLoginUrl, |
| 340 // kIssueAuthTokenUrl, kGetUserInfoUrl and kSearchDomainCheckUrl in order to | 324 // kIssueAuthTokenUrl, kGetUserInfoUrl and kSearchDomainCheckUrl in order to |
| 341 // mock out calls to GAIA servers. | 325 // mock out calls to GAIA servers. |
| 342 void SetupMockGaiaResponses(); | 326 void SetupMockGaiaResponses(); |
| 343 | 327 |
| 344 // Helper method used to clear any fake responses that might have been set for | 328 // Helper method used to clear any fake responses that might have been set for |
| 345 // various gaia URLs, cancel any outstanding URL requests, and return to using | 329 // various gaia URLs, cancel any outstanding URL requests, and return to using |
| 346 // the default URLFetcher creation mechanism. | 330 // the default URLFetcher creation mechanism. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 // Fake URLFetcher factory used to mock out GAIA signin. | 402 // Fake URLFetcher factory used to mock out GAIA signin. |
| 419 scoped_ptr<net::FakeURLFetcherFactory> fake_factory_; | 403 scoped_ptr<net::FakeURLFetcherFactory> fake_factory_; |
| 420 | 404 |
| 421 // The URLFetcherImplFactory instance used to instantiate |fake_factory_|. | 405 // The URLFetcherImplFactory instance used to instantiate |fake_factory_|. |
| 422 scoped_ptr<net::URLFetcherImplFactory> factory_; | 406 scoped_ptr<net::URLFetcherImplFactory> factory_; |
| 423 | 407 |
| 424 DISALLOW_COPY_AND_ASSIGN(SyncTest); | 408 DISALLOW_COPY_AND_ASSIGN(SyncTest); |
| 425 }; | 409 }; |
| 426 | 410 |
| 427 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ | 411 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ |
| OLD | NEW |