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 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 5 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <ostream> | 9 #include <ostream> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 ProfileSyncServiceHarness::~ProfileSyncServiceHarness() { } | 127 ProfileSyncServiceHarness::~ProfileSyncServiceHarness() { } |
128 | 128 |
129 void ProfileSyncServiceHarness::SetCredentials(const std::string& username, | 129 void ProfileSyncServiceHarness::SetCredentials(const std::string& username, |
130 const std::string& password) { | 130 const std::string& password) { |
131 username_ = username; | 131 username_ = username; |
132 password_ = password; | 132 password_ = password; |
133 } | 133 } |
134 | 134 |
135 bool ProfileSyncServiceHarness::SetupSync() { | 135 bool ProfileSyncServiceHarness::SetupSync() { |
136 bool result = SetupSync(syncer::UserSelectableTypes()); | 136 bool result = SetupSync(syncer::ModelTypeSet::All()); |
137 if (result == false) { | 137 if (result == false) { |
138 std::string status = GetServiceStatus(); | 138 std::string status = GetServiceStatus(); |
139 LOG(ERROR) << profile_debug_name_ | 139 LOG(ERROR) << profile_debug_name_ |
140 << ": SetupSync failed. Syncer status:\n" << status; | 140 << ": SetupSync failed. Syncer status:\n" << status; |
141 } else { | 141 } else { |
142 DVLOG(1) << profile_debug_name_ << ": SetupSync successful."; | 142 DVLOG(1) << profile_debug_name_ << ": SetupSync successful."; |
143 } | 143 } |
144 return result; | 144 return result; |
145 } | 145 } |
146 | 146 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 // Now that auth is completed, request that sync actually start. | 183 // Now that auth is completed, request that sync actually start. |
184 service()->RequestStart(); | 184 service()->RequestStart(); |
185 | 185 |
186 if (!AwaitBackendInitialization()) { | 186 if (!AwaitBackendInitialization()) { |
187 return false; | 187 return false; |
188 } | 188 } |
189 | 189 |
190 // Choose the datatypes to be synced. If all datatypes are to be synced, | 190 // Choose the datatypes to be synced. If all datatypes are to be synced, |
191 // set sync_everything to true; otherwise, set it to false. | 191 // set sync_everything to true; otherwise, set it to false. |
192 bool sync_everything = synced_datatypes.Equals(syncer::UserSelectableTypes()); | 192 bool sync_everything = |
| 193 synced_datatypes.Equals(syncer::ModelTypeSet::All()); |
193 service()->OnUserChoseDatatypes(sync_everything, synced_datatypes); | 194 service()->OnUserChoseDatatypes(sync_everything, synced_datatypes); |
194 | 195 |
195 // Notify ProfileSyncService that we are done with configuration. | 196 // Notify ProfileSyncService that we are done with configuration. |
196 FinishSyncSetup(); | 197 FinishSyncSetup(); |
197 | 198 |
198 // Set an implicit passphrase for encryption if an explicit one hasn't already | 199 // Set an implicit passphrase for encryption if an explicit one hasn't already |
199 // been set. If an explicit passphrase has been set, immediately return false, | 200 // been set. If an explicit passphrase has been set, immediately return false, |
200 // since a decryption passphrase is required. | 201 // since a decryption passphrase is required. |
201 if (!service()->IsUsingSecondaryPassphrase()) { | 202 if (!service()->IsUsingSecondaryPassphrase()) { |
202 service()->SetEncryptionPassphrase(password_, ProfileSyncService::IMPLICIT); | 203 service()->SetEncryptionPassphrase(password_, ProfileSyncService::IMPLICIT); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 338 |
338 syncer::ModelTypeSet synced_datatypes = service()->GetPreferredDataTypes(); | 339 syncer::ModelTypeSet synced_datatypes = service()->GetPreferredDataTypes(); |
339 if (synced_datatypes.Has(datatype)) { | 340 if (synced_datatypes.Has(datatype)) { |
340 DVLOG(1) << "EnableSyncForDatatype(): Sync already enabled for datatype " | 341 DVLOG(1) << "EnableSyncForDatatype(): Sync already enabled for datatype " |
341 << syncer::ModelTypeToString(datatype) | 342 << syncer::ModelTypeToString(datatype) |
342 << " on " << profile_debug_name_ << "."; | 343 << " on " << profile_debug_name_ << "."; |
343 return true; | 344 return true; |
344 } | 345 } |
345 | 346 |
346 synced_datatypes.Put(syncer::ModelTypeFromInt(datatype)); | 347 synced_datatypes.Put(syncer::ModelTypeFromInt(datatype)); |
347 synced_datatypes.RetainAll(syncer::UserSelectableTypes()); | |
348 service()->OnUserChoseDatatypes(false, synced_datatypes); | 348 service()->OnUserChoseDatatypes(false, synced_datatypes); |
349 if (AwaitSyncSetupCompletion()) { | 349 if (AwaitSyncSetupCompletion()) { |
350 DVLOG(1) << "EnableSyncForDatatype(): Enabled sync for datatype " | 350 DVLOG(1) << "EnableSyncForDatatype(): Enabled sync for datatype " |
351 << syncer::ModelTypeToString(datatype) | 351 << syncer::ModelTypeToString(datatype) |
352 << " on " << profile_debug_name_ << "."; | 352 << " on " << profile_debug_name_ << "."; |
353 return true; | 353 return true; |
354 } | 354 } |
355 | 355 |
356 DVLOG(0) << GetClientInfoString("EnableSyncForDatatype failed"); | 356 DVLOG(0) << GetClientInfoString("EnableSyncForDatatype failed"); |
357 return false; | 357 return false; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 470 |
471 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 471 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
472 scoped_ptr<base::DictionaryValue> value( | 472 scoped_ptr<base::DictionaryValue> value( |
473 sync_driver::sync_ui_util::ConstructAboutInformation( | 473 sync_driver::sync_ui_util::ConstructAboutInformation( |
474 service(), service()->signin(), chrome::GetChannel())); | 474 service(), service()->signin(), chrome::GetChannel())); |
475 std::string service_status; | 475 std::string service_status; |
476 base::JSONWriter::WriteWithOptions( | 476 base::JSONWriter::WriteWithOptions( |
477 *value, base::JSONWriter::OPTIONS_PRETTY_PRINT, &service_status); | 477 *value, base::JSONWriter::OPTIONS_PRETTY_PRINT, &service_status); |
478 return service_status; | 478 return service_status; |
479 } | 479 } |
OLD | NEW |