Chromium Code Reviews| 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. Callee owns the |
| 160 // object and manages its lifetime. | 159 // object and manages its lifetime. |
|
Avi (use Gerrit)
2017/03/23 02:44:48
This note about lifetime seems wrong now that a ve
leonhsl(Using Gerrit)
2017/03/23 15:03:17
Done.
| |
| 161 std::vector<ProfileSyncServiceHarness*>& clients() { return clients_.get(); } | 160 std::vector<ProfileSyncServiceHarness*> GetSyncClients(); |
| 162 | 161 |
| 163 // Returns a ProfileSyncService at the given index. | 162 // Returns a ProfileSyncService at the given index. |
| 164 browser_sync::ProfileSyncService* GetSyncService(int index); | 163 browser_sync::ProfileSyncService* GetSyncService(int index); |
| 165 | 164 |
| 166 // Returns the set of ProfileSyncServices. | 165 // Returns the set of ProfileSyncServices. |
| 167 std::vector<browser_sync::ProfileSyncService*> GetSyncServices(); | 166 std::vector<browser_sync::ProfileSyncService*> GetSyncServices(); |
| 168 | 167 |
| 169 // Returns a pointer to the sync profile that is used to verify changes to | 168 // 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. | 169 // individual sync profiles. Callee owns the object and manages its lifetime. |
| 171 Profile* verifier(); | 170 Profile* verifier(); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 415 // time. | 414 // time. |
| 416 std::vector<std::unique_ptr<Profile::Delegate>> profile_delegates_; | 415 std::vector<std::unique_ptr<Profile::Delegate>> profile_delegates_; |
| 417 | 416 |
| 418 // Collection of profile paths used by a test. Each profile has a unique path | 417 // 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 | 418 // which should be cleaned up at test shutdown. Profile paths inside the |
| 420 // default user data dir gets deleted at InProcessBrowserTest teardown. | 419 // default user data dir gets deleted at InProcessBrowserTest teardown. |
| 421 std::vector<base::ScopedTempDir*> tmp_profile_paths_; | 420 std::vector<base::ScopedTempDir*> tmp_profile_paths_; |
| 422 | 421 |
| 423 // Collection of pointers to the browser objects used by a test. One browser | 422 // 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 | 423 // instance is created for each sync profile. Browser object lifetime is |
| 425 // managed by BrowserList, so we don't use a ScopedVector here. | 424 // managed by BrowserList, so we don't use a std::vector<std::unique_ptr<>> |
| 425 // here. | |
| 426 std::vector<Browser*> browsers_; | 426 std::vector<Browser*> browsers_; |
| 427 | 427 |
| 428 // Collection of sync clients used by a test. A sync client is associated with | 428 // 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 | 429 // a sync profile, and implements methods that sync the contents of the |
| 430 // profile with the server. | 430 // profile with the server. |
| 431 ScopedVector<ProfileSyncServiceHarness> clients_; | 431 std::vector<std::unique_ptr<ProfileSyncServiceHarness>> clients_; |
| 432 | 432 |
| 433 // A set of objects to listen for commit activity and broadcast notifications | 433 // A set of objects to listen for commit activity and broadcast notifications |
| 434 // of this activity to its peer sync clients. | 434 // of this activity to its peer sync clients. |
| 435 ScopedVector<P2PInvalidationForwarder> invalidation_forwarders_; | 435 std::vector<std::unique_ptr<P2PInvalidationForwarder>> |
| 436 invalidation_forwarders_; | |
| 436 | 437 |
| 437 // A set of objects to listen for commit activity and broadcast refresh | 438 // A set of objects to listen for commit activity and broadcast refresh |
| 438 // notifications of this activity to its peer sync clients. | 439 // notifications of this activity to its peer sync clients. |
| 439 ScopedVector<P2PSyncRefresher> sync_refreshers_; | 440 std::vector<std::unique_ptr<P2PSyncRefresher>> sync_refreshers_; |
| 440 | 441 |
| 441 // Collection of pointers to FakeServerInvalidation objects for each profile. | 442 // Collection of pointers to FakeServerInvalidation objects for each profile. |
| 442 std::vector<fake_server::FakeServerInvalidationService*> | 443 std::vector<fake_server::FakeServerInvalidationService*> |
| 443 fake_server_invalidation_services_; | 444 fake_server_invalidation_services_; |
| 444 | 445 |
| 445 // Sync profile against which changes to individual profiles are verified. We | 446 // 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 | 447 // 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. | 448 // verifier profile are strictly local, and are not meant to be synced. |
| 448 Profile* verifier_; | 449 Profile* verifier_; |
| 449 | 450 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 476 std::unique_ptr<net::URLFetcherImplFactory> factory_; | 477 std::unique_ptr<net::URLFetcherImplFactory> factory_; |
| 477 | 478 |
| 478 // The contents to be written to a profile's Preferences file before the | 479 // 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. | 480 // Profile object is created. If empty, no preexisting file will be written. |
| 480 std::string preexisting_preferences_file_contents_; | 481 std::string preexisting_preferences_file_contents_; |
| 481 | 482 |
| 482 DISALLOW_COPY_AND_ASSIGN(SyncTest); | 483 DISALLOW_COPY_AND_ASSIGN(SyncTest); |
| 483 }; | 484 }; |
| 484 | 485 |
| 485 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ | 486 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ |
| OLD | NEW |