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 virtual bool IsExitConditionSatisfied() OVERRIDE
{
19 return service()->IsPassphraseRequired();
22 virtual std::string
GetDebugMessage() const OVERRIDE
{
23 return "Passhrase Required";
27 class PassphraseAcceptedChecker
: public SingleClientStatusChangeChecker
{
29 explicit PassphraseAcceptedChecker(ProfileSyncService
* service
)
30 : SingleClientStatusChangeChecker(service
) {}
32 virtual bool IsExitConditionSatisfied() OVERRIDE
{
33 return !service()->IsPassphraseRequired() &&
34 service()->IsUsingSecondaryPassphrase();
37 virtual std::string
GetDebugMessage() const OVERRIDE
{
38 return "Passhrase Accepted";
42 bool AwaitPassphraseRequired(ProfileSyncService
* service
) {
43 PassphraseRequiredChecker
checker(service
);
45 return !checker
.TimedOut();
48 bool AwaitPassphraseAccepted(ProfileSyncService
* service
) {
49 PassphraseAcceptedChecker
checker(service
);
51 return !checker
.TimedOut();
54 bool AwaitCommitActivityCompletion(ProfileSyncService
* service
) {
55 UpdatedProgressMarkerChecker
checker(service
);
57 return !checker
.TimedOut();
60 } // namespace sync_integration_test_util