| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/scoped_vector.h" | |
| 15 #include "base/process/process.h" | 14 #include "base/process/process.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
| 18 #include "components/sync/base/model_type.h" | 17 #include "components/sync/base/model_type.h" |
| 19 #include "components/sync/protocol/sync_protocol_error.h" | 18 #include "components/sync/protocol/sync_protocol_error.h" |
| 20 #include "components/sync/test/fake_server/fake_server.h" | 19 #include "components/sync/test/fake_server/fake_server.h" |
| 21 #include "components/sync/test/local_sync_test_server.h" | 20 #include "components/sync/test/local_sync_test_server.h" |
| 22 #include "net/dns/mock_host_resolver.h" | 21 #include "net/dns/mock_host_resolver.h" |
| 23 #include "net/http/http_status_code.h" | 22 #include "net/http/http_status_code.h" |
| 24 #include "net/url_request/url_request_status.h" | 23 #include "net/url_request/url_request_status.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // position |profile_index| and appends it to the list of profiles. This is | 148 // position |profile_index| and appends it to the list of profiles. This is |
| 150 // done so that the profile associated with the new browser can be found at | 149 // done so that the profile associated with the new browser can be found at |
| 151 // the same index as it. Tests typically use browser indexes and profile | 150 // the same index as it. Tests typically use browser indexes and profile |
| 152 // indexes interchangeably; this allows them to do so freely. | 151 // indexes interchangeably; this allows them to do so freely. |
| 153 Browser* AddBrowser(int profile_index); | 152 Browser* AddBrowser(int profile_index); |
| 154 | 153 |
| 155 // Returns a pointer to a particular sync client. Callee owns the object | 154 // Returns a pointer to a particular sync client. Callee owns the object |
| 156 // and manages its lifetime. | 155 // and manages its lifetime. |
| 157 ProfileSyncServiceHarness* GetClient(int index); | 156 ProfileSyncServiceHarness* GetClient(int index); |
| 158 | 157 |
| 159 // Returns a reference to the collection of sync clients. Callee owns the | 158 // Returns a list of the collection of sync clients. |
| 160 // object and manages its lifetime. | 159 std::vector<ProfileSyncServiceHarness*> GetSyncClients(); |
| 161 std::vector<ProfileSyncServiceHarness*>& clients() { return clients_.get(); } | |
| 162 | 160 |
| 163 // Returns a ProfileSyncService at the given index. | 161 // Returns a ProfileSyncService at the given index. |
| 164 browser_sync::ProfileSyncService* GetSyncService(int index); | 162 browser_sync::ProfileSyncService* GetSyncService(int index); |
| 165 | 163 |
| 166 // Returns the set of ProfileSyncServices. | 164 // Returns the set of ProfileSyncServices. |
| 167 std::vector<browser_sync::ProfileSyncService*> GetSyncServices(); | 165 std::vector<browser_sync::ProfileSyncService*> GetSyncServices(); |
| 168 | 166 |
| 169 // Returns a pointer to the sync profile that is used to verify changes to | 167 // Returns a pointer to the sync profile that is used to verify changes to |
| 170 // individual sync profiles. Callee owns the object and manages its lifetime. | 168 // individual sync profiles. Callee owns the object and manages its lifetime. |
| 171 Profile* verifier(); | 169 Profile* verifier(); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 // time. | 413 // time. |
| 416 std::vector<std::unique_ptr<Profile::Delegate>> profile_delegates_; | 414 std::vector<std::unique_ptr<Profile::Delegate>> profile_delegates_; |
| 417 | 415 |
| 418 // Collection of profile paths used by a test. Each profile has a unique path | 416 // Collection of profile paths used by a test. Each profile has a unique path |
| 419 // which should be cleaned up at test shutdown. Profile paths inside the | 417 // which should be cleaned up at test shutdown. Profile paths inside the |
| 420 // default user data dir gets deleted at InProcessBrowserTest teardown. | 418 // default user data dir gets deleted at InProcessBrowserTest teardown. |
| 421 std::vector<base::ScopedTempDir*> tmp_profile_paths_; | 419 std::vector<base::ScopedTempDir*> tmp_profile_paths_; |
| 422 | 420 |
| 423 // Collection of pointers to the browser objects used by a test. One browser | 421 // Collection of pointers to the browser objects used by a test. One browser |
| 424 // instance is created for each sync profile. Browser object lifetime is | 422 // instance is created for each sync profile. Browser object lifetime is |
| 425 // managed by BrowserList, so we don't use a ScopedVector here. | 423 // managed by BrowserList, so we don't use a std::vector<std::unique_ptr<>> |
| 424 // here. |
| 426 std::vector<Browser*> browsers_; | 425 std::vector<Browser*> browsers_; |
| 427 | 426 |
| 428 // Collection of sync clients used by a test. A sync client is associated with | 427 // Collection of sync clients used by a test. A sync client is associated with |
| 429 // a sync profile, and implements methods that sync the contents of the | 428 // a sync profile, and implements methods that sync the contents of the |
| 430 // profile with the server. | 429 // profile with the server. |
| 431 ScopedVector<ProfileSyncServiceHarness> clients_; | 430 std::vector<std::unique_ptr<ProfileSyncServiceHarness>> clients_; |
| 432 | 431 |
| 433 // A set of objects to listen for commit activity and broadcast notifications | 432 // A set of objects to listen for commit activity and broadcast notifications |
| 434 // of this activity to its peer sync clients. | 433 // of this activity to its peer sync clients. |
| 435 ScopedVector<P2PInvalidationForwarder> invalidation_forwarders_; | 434 std::vector<std::unique_ptr<P2PInvalidationForwarder>> |
| 435 invalidation_forwarders_; |
| 436 | 436 |
| 437 // A set of objects to listen for commit activity and broadcast refresh | 437 // A set of objects to listen for commit activity and broadcast refresh |
| 438 // notifications of this activity to its peer sync clients. | 438 // notifications of this activity to its peer sync clients. |
| 439 ScopedVector<P2PSyncRefresher> sync_refreshers_; | 439 std::vector<std::unique_ptr<P2PSyncRefresher>> sync_refreshers_; |
| 440 | 440 |
| 441 // Collection of pointers to FakeServerInvalidation objects for each profile. | 441 // Collection of pointers to FakeServerInvalidation objects for each profile. |
| 442 std::vector<fake_server::FakeServerInvalidationService*> | 442 std::vector<fake_server::FakeServerInvalidationService*> |
| 443 fake_server_invalidation_services_; | 443 fake_server_invalidation_services_; |
| 444 | 444 |
| 445 // Sync profile against which changes to individual profiles are verified. We | 445 // Sync profile against which changes to individual profiles are verified. We |
| 446 // don't need a corresponding verifier sync client because the contents of the | 446 // don't need a corresponding verifier sync client because the contents of the |
| 447 // verifier profile are strictly local, and are not meant to be synced. | 447 // verifier profile are strictly local, and are not meant to be synced. |
| 448 Profile* verifier_; | 448 Profile* verifier_; |
| 449 | 449 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 476 std::unique_ptr<net::URLFetcherImplFactory> factory_; | 476 std::unique_ptr<net::URLFetcherImplFactory> factory_; |
| 477 | 477 |
| 478 // The contents to be written to a profile's Preferences file before the | 478 // The contents to be written to a profile's Preferences file before the |
| 479 // Profile object is created. If empty, no preexisting file will be written. | 479 // Profile object is created. If empty, no preexisting file will be written. |
| 480 std::string preexisting_preferences_file_contents_; | 480 std::string preexisting_preferences_file_contents_; |
| 481 | 481 |
| 482 DISALLOW_COPY_AND_ASSIGN(SyncTest); | 482 DISALLOW_COPY_AND_ASSIGN(SyncTest); |
| 483 }; | 483 }; |
| 484 | 484 |
| 485 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ | 485 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ |
| OLD | NEW |