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
3 // found in the LICENSE file.
5 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
7 #include "chrome/browser/sync/profile_sync_service.h"
8 #include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
9 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h"
11 namespace sync_integration_test_util
{
13 class PassphraseRequiredChecker
: public SingleClientStatusChangeChecker
{
15 explicit PassphraseRequiredChecker(ProfileSyncService
* service
)
16 : SingleClientStatusChangeChecker(service
) {}
18 bool IsExitConditionSatisfied() override
{
19 return service()->IsPassphraseRequired();
22 std::string
GetDebugMessage() const override
{ return "Passhrase Required"; }
25 class PassphraseAcceptedChecker
: public SingleClientStatusChangeChecker
{
27 explicit PassphraseAcceptedChecker(ProfileSyncService
* service
)
28 : SingleClientStatusChangeChecker(service
) {}
30 bool IsExitConditionSatisfied() override
{
31 return !service()->IsPassphraseRequired() &&
32 service()->IsUsingSecondaryPassphrase();
35 std::string
GetDebugMessage() const override
{ return "Passhrase Accepted"; }
38 bool AwaitPassphraseRequired(ProfileSyncService
* service
) {
39 PassphraseRequiredChecker
checker(service
);
41 return !checker
.TimedOut();
44 bool AwaitPassphraseAccepted(ProfileSyncService
* service
) {
45 PassphraseAcceptedChecker
checker(service
);
47 return !checker
.TimedOut();
50 bool AwaitCommitActivityCompletion(ProfileSyncService
* service
) {
51 UpdatedProgressMarkerChecker
checker(service
);
53 return !checker
.TimedOut();
56 } // namespace sync_integration_test_util