chromium/components/autofill/core/browser/test_event_waiter.h

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_EVENT_WAITER_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_EVENT_WAITER_H_

#include <list>

#include "base/location.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace autofill {

// EventWaiter is used to wait on specific events that may have occured
// before the call to Wait(), or after, in which case a RunLoop is used.
//
// Usage:
// waiter_ = std::make_unique<EventWaiter>({ ... });
//
// Do stuff, which (a)synchronously calls waiter_->OnEvent(...).
//
// waiter_->Wait();  <- Will either return right away if events were observed,
//                   <- or use a RunLoop's Run/Quit to wait.
//
// Optionally, event waiters can be quit the RunLoop after timing out.
template <typename Event>
class EventWaiter {};

template <typename Event>
EventWaiter<Event>::EventWaiter(std::list<Event> expected_event_sequence,
                                base::TimeDelta timeout,
                                base::Location location)
    :{}

template <typename Event>
EventWaiter<Event>::~EventWaiter() {}

template <typename Event>
testing::AssertionResult EventWaiter<Event>::Wait() {}

template <typename Event>
void EventWaiter<Event>::OnEvent(Event actual_event) {}

}  // namespace autofill

#endif  // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_EVENT_WAITER_H_