status_change_checker.h revision a1401311d1ab56c4ed0a474bd38c108f75cb0cd9
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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_STATUS_CHANGE_CHECKER_H_
6#define CHROME_BROWSER_SYNC_TEST_INTEGRATION_STATUS_CHANGE_CHECKER_H_
7
8#include <string>
9
10class ProfileSyncServiceHarness;
11
12// Interface for a helper class that can be used to check if a desired change in
13// the state of the sync engine has taken place. Used by the desktop sync
14// integration tests.
15//
16// Usage: Tests that want to use this class to wait for an arbitrary sync state
17// must implement a concrete StatusChangeChecker object and pass it to
18// ProfileSyncServiceHarness::AwaitStatusChange().
19class StatusChangeChecker {
20 public:
21  explicit StatusChangeChecker();
22
23  // Called every time ProfileSyncServiceHarness is notified of a change in the
24  // state of the sync engine. Returns true if the desired change has occurred.
25  virtual bool IsExitConditionSatisfied() = 0;
26
27  // Returns a string representing this current StatusChangeChecker, and
28  // possibly some small part of its state.  For example: "AwaitPassphraseError"
29  // or "AwaitMigrationDone(BOOKMARKS)".
30  virtual std::string GetDebugMessage() const = 0;
31
32  virtual void InitObserver(ProfileSyncServiceHarness*) = 0;
33  virtual void UninitObserver(ProfileSyncServiceHarness*) = 0;
34
35 protected:
36  virtual ~StatusChangeChecker();
37};
38
39#endif  // CHROME_BROWSER_SYNC_TEST_INTEGRATION_STATUS_CHANGE_CHECKER_H_
40