chromium/extensions/test/extension_background_page_waiter.h

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

#ifndef EXTENSIONS_TEST_EXTENSION_BACKGROUND_PAGE_WAITER_H_
#define EXTENSIONS_TEST_EXTENSION_BACKGROUND_PAGE_WAITER_H_

#include "base/memory/raw_ptr.h"
#include "extensions/common/extension.h"

namespace content {
class BrowserContext;
}

namespace extensions {

// A class to wait for an extension's background to reach a certain state.
// NOTE: See also ExtensionHostTestHelper.
// * Use this class when you need to wait for a _state_ - e.g., for the
//   extension's background context to be initialized - and you don't
//   necessarily care when it happened. The state may already be active.
// * Use ExtensionHostTestHelper when you need to wait for an expected
//   _event_ - such as host destruction.
// See also
// https://chromium.googlesource.com/chromium/src/+/main/docs/patterns/synchronous-runloop.md#events-vs-states
// TODO(devlin): Rename this to ExtensionBackgroundContextWaiter? It supports
// service workers in addition to background (and event) pages.
class ExtensionBackgroundPageWaiter {};

}  // namespace extensions

#endif  // EXTENSIONS_TEST_EXTENSION_BACKGROUND_PAGE_WAITER_H_