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

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

Issue 666733003: Standardize usage of virtual/override/final in chrome/browser/sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 GoogleServiceAuthError::SERVICE_ERROR || 43 GoogleServiceAuthError::SERVICE_ERROR ||
44 service->GetAuthError().state() == 44 service->GetAuthError().state() ==
45 GoogleServiceAuthError::REQUEST_CANCELED; 45 GoogleServiceAuthError::REQUEST_CANCELED;
46 } 46 }
47 47
48 class BackendInitializeChecker : public SingleClientStatusChangeChecker { 48 class BackendInitializeChecker : public SingleClientStatusChangeChecker {
49 public: 49 public:
50 explicit BackendInitializeChecker(ProfileSyncService* service) 50 explicit BackendInitializeChecker(ProfileSyncService* service)
51 : SingleClientStatusChangeChecker(service) {} 51 : SingleClientStatusChangeChecker(service) {}
52 52
53 virtual bool IsExitConditionSatisfied() override { 53 bool IsExitConditionSatisfied() override {
54 if (service()->backend_mode() != ProfileSyncService::SYNC) 54 if (service()->backend_mode() != ProfileSyncService::SYNC)
55 return false; 55 return false;
56 if (service()->backend_initialized()) 56 if (service()->backend_initialized())
57 return true; 57 return true;
58 // Backend initialization is blocked by an auth error. 58 // Backend initialization is blocked by an auth error.
59 if (HasAuthError(service())) 59 if (HasAuthError(service()))
60 return true; 60 return true;
61 // Backend initialization is blocked by a failure to fetch Oauth2 tokens. 61 // Backend initialization is blocked by a failure to fetch Oauth2 tokens.
62 if (service()->IsRetryingAccessTokenFetchForTest()) 62 if (service()->IsRetryingAccessTokenFetchForTest())
63 return true; 63 return true;
64 // Still waiting on backend initialization. 64 // Still waiting on backend initialization.
65 return false; 65 return false;
66 } 66 }
67 67
68 virtual std::string GetDebugMessage() const override { 68 std::string GetDebugMessage() const override { return "Backend Initialize"; }
69 return "Backend Initialize";
70 }
71 }; 69 };
72 70
73 class SyncSetupChecker : public SingleClientStatusChangeChecker { 71 class SyncSetupChecker : public SingleClientStatusChangeChecker {
74 public: 72 public:
75 explicit SyncSetupChecker(ProfileSyncService* service) 73 explicit SyncSetupChecker(ProfileSyncService* service)
76 : SingleClientStatusChangeChecker(service) {} 74 : SingleClientStatusChangeChecker(service) {}
77 75
78 virtual bool IsExitConditionSatisfied() override { 76 bool IsExitConditionSatisfied() override {
79 if (!service()->SyncActive()) 77 if (!service()->SyncActive())
80 return false; 78 return false;
81 if (service()->ConfigurationDone()) 79 if (service()->ConfigurationDone())
82 return true; 80 return true;
83 // Sync is blocked because a custom passphrase is required. 81 // Sync is blocked because a custom passphrase is required.
84 if (service()->passphrase_required_reason() == syncer::REASON_DECRYPTION) 82 if (service()->passphrase_required_reason() == syncer::REASON_DECRYPTION)
85 return true; 83 return true;
86 // Sync is blocked by an auth error. 84 // Sync is blocked by an auth error.
87 if (HasAuthError(service())) 85 if (HasAuthError(service()))
88 return true; 86 return true;
89 // Still waiting on sync setup. 87 // Still waiting on sync setup.
90 return false; 88 return false;
91 } 89 }
92 90
93 virtual std::string GetDebugMessage() const override { 91 std::string GetDebugMessage() const override { return "Sync Setup"; }
94 return "Sync Setup";
95 }
96 }; 92 };
97 93
98 } // namespace 94 } // namespace
99 95
100 // static 96 // static
101 ProfileSyncServiceHarness* ProfileSyncServiceHarness::Create( 97 ProfileSyncServiceHarness* ProfileSyncServiceHarness::Create(
102 Profile* profile, 98 Profile* profile,
103 const std::string& username, 99 const std::string& username,
104 const std::string& password) { 100 const std::string& password) {
105 return new ProfileSyncServiceHarness(profile, username, password); 101 return new ProfileSyncServiceHarness(profile, username, password);
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 442
447 std::string ProfileSyncServiceHarness::GetServiceStatus() { 443 std::string ProfileSyncServiceHarness::GetServiceStatus() {
448 scoped_ptr<base::DictionaryValue> value( 444 scoped_ptr<base::DictionaryValue> value(
449 sync_ui_util::ConstructAboutInformation(service())); 445 sync_ui_util::ConstructAboutInformation(service()));
450 std::string service_status; 446 std::string service_status;
451 base::JSONWriter::WriteWithOptions(value.get(), 447 base::JSONWriter::WriteWithOptions(value.get(),
452 base::JSONWriter::OPTIONS_PRETTY_PRINT, 448 base::JSONWriter::OPTIONS_PRETTY_PRINT,
453 &service_status); 449 &service_status);
454 return service_status; 450 return service_status;
455 } 451 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698