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

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

Issue 2551023006: [Sync] SyncEngine 1.5: Fix all backend references in PSS. (Closed)
Patch Set: Created 4 years 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 bool HasAuthError(ProfileSyncService* service) { 43 bool HasAuthError(ProfileSyncService* service) {
44 return service->GetAuthError().state() == 44 return service->GetAuthError().state() ==
45 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS || 45 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS ||
46 service->GetAuthError().state() == 46 service->GetAuthError().state() ==
47 GoogleServiceAuthError::SERVICE_ERROR || 47 GoogleServiceAuthError::SERVICE_ERROR ||
48 service->GetAuthError().state() == 48 service->GetAuthError().state() ==
49 GoogleServiceAuthError::REQUEST_CANCELED; 49 GoogleServiceAuthError::REQUEST_CANCELED;
50 } 50 }
51 51
52 class BackendInitializeChecker : public SingleClientStatusChangeChecker { 52 class BackendInitializeChecker : public SingleClientStatusChangeChecker {
skym 2016/12/05 19:38:55 backend
maxbogue 2016/12/05 22:17:11 Done.
53 public: 53 public:
54 explicit BackendInitializeChecker(ProfileSyncService* service) 54 explicit BackendInitializeChecker(ProfileSyncService* service)
55 : SingleClientStatusChangeChecker(service) {} 55 : SingleClientStatusChangeChecker(service) {}
56 56
57 bool IsExitConditionSatisfied() override { 57 bool IsExitConditionSatisfied() override {
58 if (service()->IsBackendInitialized()) 58 if (service()->IsEngineInitialized())
59 return true; 59 return true;
60 // Backend initialization is blocked by an auth error. 60 // Backend initialization is blocked by an auth error.
skym 2016/12/05 19:38:55 backend
maxbogue 2016/12/05 22:17:10 Done.
61 if (HasAuthError(service())) 61 if (HasAuthError(service()))
62 return true; 62 return true;
63 // Backend initialization is blocked by a failure to fetch Oauth2 tokens. 63 // Backend initialization is blocked by a failure to fetch Oauth2 tokens.
skym 2016/12/05 19:38:56 backend
maxbogue 2016/12/05 22:17:11 Done.
64 if (service()->IsRetryingAccessTokenFetchForTest()) 64 if (service()->IsRetryingAccessTokenFetchForTest())
65 return true; 65 return true;
66 // Still waiting on backend initialization. 66 // Still waiting on backend initialization.
skym 2016/12/05 19:38:55 backend
maxbogue 2016/12/05 22:17:10 Done.
67 return false; 67 return false;
68 } 68 }
69 69
70 std::string GetDebugMessage() const override { return "Backend Initialize"; } 70 std::string GetDebugMessage() const override { return "Backend Initialize"; }
71 }; 71 };
72 72
73 class SyncSetupChecker : public SingleClientStatusChangeChecker { 73 class SyncSetupChecker : public SingleClientStatusChangeChecker {
74 public: 74 public:
75 explicit SyncSetupChecker(ProfileSyncService* service) 75 explicit SyncSetupChecker(ProfileSyncService* service)
76 : SingleClientStatusChangeChecker(service) {} 76 : SingleClientStatusChangeChecker(service) {}
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 if (clients.empty()) { 239 if (clients.empty()) {
240 return true; 240 return true;
241 } 241 }
242 242
243 for (const ProfileSyncServiceHarness* harness : clients) { 243 for (const ProfileSyncServiceHarness* harness : clients) {
244 services.push_back(harness->service()); 244 services.push_back(harness->service());
245 } 245 }
246 return QuiesceStatusChangeChecker(services).Wait(); 246 return QuiesceStatusChangeChecker(services).Wait();
247 } 247 }
248 248
249 bool ProfileSyncServiceHarness::AwaitBackendInitialization() { 249 bool ProfileSyncServiceHarness::AwaitBackendInitialization() {
skym 2016/12/05 19:38:56 backend
maxbogue 2016/12/05 22:17:11 Done.
250 if (!BackendInitializeChecker(service()).Wait()) { 250 if (!BackendInitializeChecker(service()).Wait()) {
251 LOG(ERROR) << "BackendInitializeChecker timed out."; 251 LOG(ERROR) << "BackendInitializeChecker timed out.";
skym 2016/12/05 19:38:55 backend
maxbogue 2016/12/05 22:17:10 Done.
252 return false; 252 return false;
253 } 253 }
254 254
255 if (!service()->IsBackendInitialized()) { 255 if (!service()->IsEngineInitialized()) {
256 LOG(ERROR) << "Service backend not initialized."; 256 LOG(ERROR) << "Service backend not initialized.";
skym 2016/12/05 19:38:55 backend
maxbogue 2016/12/05 22:17:10 Done.
257 return false; 257 return false;
258 } 258 }
259 259
260 // Make sure that initial sync wasn't blocked by a missing passphrase. 260 // Make sure that initial sync wasn't blocked by a missing passphrase.
261 if (service()->passphrase_required_reason() == syncer::REASON_DECRYPTION) { 261 if (service()->passphrase_required_reason() == syncer::REASON_DECRYPTION) {
262 LOG(ERROR) << "A passphrase is required for decryption. Sync cannot proceed" 262 LOG(ERROR) << "A passphrase is required for decryption. Sync cannot proceed"
263 " until SetDecryptionPassphrase is called."; 263 " until SetDecryptionPassphrase is called.";
264 return false; 264 return false;
265 } 265 }
266 266
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 464
465 std::string ProfileSyncServiceHarness::GetServiceStatus() { 465 std::string ProfileSyncServiceHarness::GetServiceStatus() {
466 std::unique_ptr<base::DictionaryValue> value( 466 std::unique_ptr<base::DictionaryValue> value(
467 syncer::sync_ui_util::ConstructAboutInformation( 467 syncer::sync_ui_util::ConstructAboutInformation(
468 service(), service()->signin(), chrome::GetChannel())); 468 service(), service()->signin(), chrome::GetChannel()));
469 std::string service_status; 469 std::string service_status;
470 base::JSONWriter::WriteWithOptions( 470 base::JSONWriter::WriteWithOptions(
471 *value, base::JSONWriter::OPTIONS_PRETTY_PRINT, &service_status); 471 *value, base::JSONWriter::OPTIONS_PRETTY_PRINT, &service_status);
472 return service_status; 472 return service_status;
473 } 473 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698