• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "base/basictypes.h"
9 #include "base/callback.h"
10 #include "base/compiler_specific.h"
11 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
12 
13 // Used to check if a desired change in the state of the sync engine has taken
14 // place. Used by the desktop sync integration tests.
15 class StatusChangeChecker {
16  public:
17   typedef base::Callback<bool()> StatusChangeCallback;
18 
19   StatusChangeChecker(StatusChangeCallback callback,
20                       const std::string& callback_name);
21   ~StatusChangeChecker();
22   bool IsExitConditionSatisfied();
callback_name()23   std::string callback_name() const { return callback_name_; }
24 
25  private:
26   // Evaluates whether the condition we are waiting on has been satisfied.
27   StatusChangeCallback callback_;
28 
29   // The name of the callback. Used for logging.
30   std::string callback_name_;
31 
32   DISALLOW_COPY_AND_ASSIGN(StatusChangeChecker);
33 };
34 
35 #endif  // CHROME_BROWSER_SYNC_TEST_INTEGRATION_STATUS_CHANGE_CHECKER_H_
36