Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: chrome/browser/sync/test/integration/profile_sync_service_harness.cc

Issue 1304933010: [Sync] Move data type logic from PSSA to PSS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update OnUserChoseDatatypes() comment. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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::ModelTypeSet::All()); 136 bool result = SetupSync(syncer::UserSelectableTypes());
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
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 = 192 bool sync_everything = synced_datatypes.Equals(syncer::UserSelectableTypes());
193 synced_datatypes.Equals(syncer::ModelTypeSet::All());
194 service()->OnUserChoseDatatypes(sync_everything, synced_datatypes); 193 service()->OnUserChoseDatatypes(sync_everything, synced_datatypes);
195 194
196 // Notify ProfileSyncService that we are done with configuration. 195 // Notify ProfileSyncService that we are done with configuration.
197 FinishSyncSetup(); 196 FinishSyncSetup();
198 197
199 // Set an implicit passphrase for encryption if an explicit one hasn't already 198 // Set an implicit passphrase for encryption if an explicit one hasn't already
200 // been set. If an explicit passphrase has been set, immediately return false, 199 // been set. If an explicit passphrase has been set, immediately return false,
201 // since a decryption passphrase is required. 200 // since a decryption passphrase is required.
202 if (!service()->IsUsingSecondaryPassphrase()) { 201 if (!service()->IsUsingSecondaryPassphrase()) {
203 service()->SetEncryptionPassphrase(password_, ProfileSyncService::IMPLICIT); 202 service()->SetEncryptionPassphrase(password_, ProfileSyncService::IMPLICIT);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 337
339 syncer::ModelTypeSet synced_datatypes = service()->GetPreferredDataTypes(); 338 syncer::ModelTypeSet synced_datatypes = service()->GetPreferredDataTypes();
340 if (synced_datatypes.Has(datatype)) { 339 if (synced_datatypes.Has(datatype)) {
341 DVLOG(1) << "EnableSyncForDatatype(): Sync already enabled for datatype " 340 DVLOG(1) << "EnableSyncForDatatype(): Sync already enabled for datatype "
342 << syncer::ModelTypeToString(datatype) 341 << syncer::ModelTypeToString(datatype)
343 << " on " << profile_debug_name_ << "."; 342 << " on " << profile_debug_name_ << ".";
344 return true; 343 return true;
345 } 344 }
346 345
347 synced_datatypes.Put(syncer::ModelTypeFromInt(datatype)); 346 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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/enable_disable_test.cc ('k') | chrome/browser/sync/test/integration/sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698