| 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> |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // specified. | 119 // specified. |
| 120 void SetUp() override; | 120 void SetUp() override; |
| 121 | 121 |
| 122 // Brings down local python test server if one was created. | 122 // Brings down local python test server if one was created. |
| 123 void TearDown() override; | 123 void TearDown() override; |
| 124 | 124 |
| 125 // Sets up command line flags required for sync tests. | 125 // Sets up command line flags required for sync tests. |
| 126 void SetUpCommandLine(base::CommandLine* cl) override; | 126 void SetUpCommandLine(base::CommandLine* cl) override; |
| 127 | 127 |
| 128 // Used to get the number of sync clients used by a test. | 128 // Used to get the number of sync clients used by a test. |
| 129 int num_clients() { return num_clients_; } | 129 int num_clients() WARN_UNUSED_RESULT { return num_clients_; } |
| 130 | 130 |
| 131 // Returns a pointer to a particular sync profile. Callee owns the object | 131 // Returns a pointer to a particular sync profile. Callee owns the object |
| 132 // and manages its lifetime. | 132 // and manages its lifetime. |
| 133 Profile* GetProfile(int index); | 133 Profile* GetProfile(int index) WARN_UNUSED_RESULT; |
| 134 | 134 |
| 135 // Returns a list of all profiles including the verifier if available. Callee | 135 // Returns a list of all profiles including the verifier if available. Callee |
| 136 // owns the objects and manages its lifetime. | 136 // owns the objects and manages its lifetime. |
| 137 std::vector<Profile*> GetAllProfiles(); | 137 std::vector<Profile*> GetAllProfiles(); |
| 138 | 138 |
| 139 // Returns a pointer to a particular browser. Callee owns the object | 139 // Returns a pointer to a particular browser. Callee owns the object |
| 140 // and manages its lifetime. | 140 // and manages its lifetime. |
| 141 Browser* GetBrowser(int index); | 141 Browser* GetBrowser(int index) WARN_UNUSED_RESULT; |
| 142 | |
| 143 // Adds a new browser belonging to the profile at |profile_index|, and appends | |
| 144 // it to the list of browsers. Creates a copy of the Profile pointer in | |
| 145 // position |profile_index| and appends it to the list of profiles. This is | |
| 146 // done so that the profile associated with the new browser can be found at | |
| 147 // the same index as it. Tests typically use browser indexes and profile | |
| 148 // indexes interchangeably; this allows them to do so freely. | |
| 149 Browser* AddBrowser(int profile_index); | |
| 150 | 142 |
| 151 // Returns a pointer to a particular sync client. Callee owns the object | 143 // Returns a pointer to a particular sync client. Callee owns the object |
| 152 // and manages its lifetime. | 144 // and manages its lifetime. |
| 153 ProfileSyncServiceHarness* GetClient(int index); | 145 ProfileSyncServiceHarness* GetClient(int index) WARN_UNUSED_RESULT; |
| 154 | 146 |
| 155 // Returns a reference to the collection of sync clients. Callee owns the | 147 // Returns a reference to the collection of sync clients. Callee owns the |
| 156 // object and manages its lifetime. | 148 // object and manages its lifetime. |
| 157 std::vector<ProfileSyncServiceHarness*>& clients() { return clients_.get(); } | 149 std::vector<ProfileSyncServiceHarness*>& clients() WARN_UNUSED_RESULT { |
| 150 return clients_.get(); |
| 151 } |
| 158 | 152 |
| 159 // Returns a ProfileSyncService at the given index. | 153 // Returns a ProfileSyncService at the given index. |
| 160 browser_sync::ProfileSyncService* GetSyncService(int index); | 154 browser_sync::ProfileSyncService* GetSyncService(int index); |
| 161 | 155 |
| 162 // Returns the set of ProfileSyncServices. | 156 // Returns the set of ProfileSyncServices. |
| 163 std::vector<browser_sync::ProfileSyncService*> GetSyncServices(); | 157 std::vector<browser_sync::ProfileSyncService*> GetSyncServices(); |
| 164 | 158 |
| 165 // Returns a pointer to the sync profile that is used to verify changes to | 159 // Returns a pointer to the sync profile that is used to verify changes to |
| 166 // individual sync profiles. Callee owns the object and manages its lifetime. | 160 // individual sync profiles. Callee owns the object and manages its lifetime. |
| 167 Profile* verifier(); | 161 Profile* verifier() WARN_UNUSED_RESULT; |
| 168 | 162 |
| 169 // Used to determine whether the verifier profile should be updated or not. | 163 // Used to determine whether the verifier profile should be updated or not. |
| 170 bool use_verifier() { return use_verifier_; } | 164 bool use_verifier() WARN_UNUSED_RESULT { return use_verifier_; } |
| 171 | 165 |
| 172 // After calling this method, changes made to a profile will no longer be | 166 // After calling this method, changes made to a profile will no longer be |
| 173 // reflected in the verifier profile. Note: Not all datatypes use this. | 167 // reflected in the verifier profile. Note: Not all datatypes use this. |
| 174 // TODO(rsimha): Hook up all datatypes to this mechanism. | 168 // TODO(rsimha): Hook up all datatypes to this mechanism. |
| 175 void DisableVerifier(); | 169 void DisableVerifier(); |
| 176 | 170 |
| 177 // Initializes sync clients and profiles but does not sync any of them. | 171 // Initializes sync clients and profiles but does not sync any of them. |
| 178 virtual bool SetupClients() WARN_UNUSED_RESULT; | 172 virtual bool SetupClients() WARN_UNUSED_RESULT; |
| 179 | 173 |
| 180 // Initializes sync clients and profiles if required and syncs each of them. | 174 // Initializes sync clients and profiles if required and syncs each of them. |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 std::unique_ptr<net::URLFetcherImplFactory> factory_; | 458 std::unique_ptr<net::URLFetcherImplFactory> factory_; |
| 465 | 459 |
| 466 // The contents to be written to a profile's Preferences file before the | 460 // The contents to be written to a profile's Preferences file before the |
| 467 // Profile object is created. If empty, no preexisting file will be written. | 461 // Profile object is created. If empty, no preexisting file will be written. |
| 468 std::string preexisting_preferences_file_contents_; | 462 std::string preexisting_preferences_file_contents_; |
| 469 | 463 |
| 470 DISALLOW_COPY_AND_ASSIGN(SyncTest); | 464 DISALLOW_COPY_AND_ASSIGN(SyncTest); |
| 471 }; | 465 }; |
| 472 | 466 |
| 473 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ | 467 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ |
| OLD | NEW |