| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/sync_integration_test_util.h" | 5 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sync/profile_sync_service.h" | 7 #include "chrome/browser/sync/profile_sync_service.h" |
| 8 #include "chrome/browser/sync/test/integration/single_client_status_change_check
er.h" | 8 #include "chrome/browser/sync/test/integration/single_client_status_change_check
er.h" |
| 9 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h
" | 9 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h
" |
| 10 | 10 |
| 11 namespace sync_integration_test_util { | 11 namespace sync_integration_test_util { |
| 12 | 12 |
| 13 class PassphraseRequiredChecker : public SingleClientStatusChangeChecker { | 13 class PassphraseRequiredChecker : public SingleClientStatusChangeChecker { |
| 14 public: | 14 public: |
| 15 explicit PassphraseRequiredChecker(ProfileSyncService* service) | 15 explicit PassphraseRequiredChecker(ProfileSyncService* service) |
| 16 : SingleClientStatusChangeChecker(service) {} | 16 : SingleClientStatusChangeChecker(service) {} |
| 17 | 17 |
| 18 virtual bool IsExitConditionSatisfied() OVERRIDE { | 18 virtual bool IsExitConditionSatisfied() override { |
| 19 return service()->IsPassphraseRequired(); | 19 return service()->IsPassphraseRequired(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 virtual std::string GetDebugMessage() const OVERRIDE { | 22 virtual std::string GetDebugMessage() const override { |
| 23 return "Passhrase Required"; | 23 return "Passhrase Required"; |
| 24 } | 24 } |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 class PassphraseAcceptedChecker : public SingleClientStatusChangeChecker { | 27 class PassphraseAcceptedChecker : public SingleClientStatusChangeChecker { |
| 28 public: | 28 public: |
| 29 explicit PassphraseAcceptedChecker(ProfileSyncService* service) | 29 explicit PassphraseAcceptedChecker(ProfileSyncService* service) |
| 30 : SingleClientStatusChangeChecker(service) {} | 30 : SingleClientStatusChangeChecker(service) {} |
| 31 | 31 |
| 32 virtual bool IsExitConditionSatisfied() OVERRIDE { | 32 virtual bool IsExitConditionSatisfied() override { |
| 33 return !service()->IsPassphraseRequired() && | 33 return !service()->IsPassphraseRequired() && |
| 34 service()->IsUsingSecondaryPassphrase(); | 34 service()->IsUsingSecondaryPassphrase(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 virtual std::string GetDebugMessage() const OVERRIDE { | 37 virtual std::string GetDebugMessage() const override { |
| 38 return "Passhrase Accepted"; | 38 return "Passhrase Accepted"; |
| 39 } | 39 } |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 bool AwaitPassphraseRequired(ProfileSyncService* service) { | 42 bool AwaitPassphraseRequired(ProfileSyncService* service) { |
| 43 PassphraseRequiredChecker checker(service); | 43 PassphraseRequiredChecker checker(service); |
| 44 checker.Wait(); | 44 checker.Wait(); |
| 45 return !checker.TimedOut(); | 45 return !checker.TimedOut(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool AwaitPassphraseAccepted(ProfileSyncService* service) { | 48 bool AwaitPassphraseAccepted(ProfileSyncService* service) { |
| 49 PassphraseAcceptedChecker checker(service); | 49 PassphraseAcceptedChecker checker(service); |
| 50 checker.Wait(); | 50 checker.Wait(); |
| 51 return !checker.TimedOut(); | 51 return !checker.TimedOut(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool AwaitCommitActivityCompletion(ProfileSyncService* service) { | 54 bool AwaitCommitActivityCompletion(ProfileSyncService* service) { |
| 55 UpdatedProgressMarkerChecker checker(service); | 55 UpdatedProgressMarkerChecker checker(service); |
| 56 checker.Wait(); | 56 checker.Wait(); |
| 57 return !checker.TimedOut(); | 57 return !checker.TimedOut(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace sync_integration_test_util | 60 } // namespace sync_integration_test_util |
| OLD | NEW |