#ifndef UI_VIEWS_WIDGET_WIDGET_INTERACTIVE_UITEST_UTILS_H_
#define UI_VIEWS_WIDGET_WIDGET_INTERACTIVE_UITEST_UTILS_H_
#include "base/functional/callback_forward.h"
#include "base/run_loop.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
namespace views::test {
class PropertyWaiter {
public:
PropertyWaiter(base::RepeatingCallback<bool(void)> callback,
bool expected_value,
base::TimeDelta timeout = base::Seconds(1));
~PropertyWaiter();
bool Wait();
private:
void Check();
base::TimeDelta timeout_;
base::RepeatingCallback<bool(void)> callback_;
const bool expected_value_;
bool success_ = false;
base::TimeTicks start_time_;
base::RunLoop run_loop_;
base::RepeatingTimer timer_;
};
}
#endif