chromium/components/performance_manager/test_support/test_harness_helper.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.

// Common functionality for unittest and browsertest harnesses.

#ifndef COMPONENTS_PERFORMANCE_MANAGER_TEST_SUPPORT_TEST_HARNESS_HELPER_H_
#define COMPONENTS_PERFORMANCE_MANAGER_TEST_SUPPORT_TEST_HARNESS_HELPER_H_

#include <memory>

#include "components/performance_manager/embedder/graph_features.h"
#include "components/performance_manager/graph/graph_impl.h"

namespace content {
class BrowserContext;
class WebContents;
}  // namespace content

namespace performance_manager {

class PerformanceManagerImpl;
class PerformanceManagerRegistry;

// A test harness helper. Manages the PM in a test environment.
//
// Note that in some test environments we have automatic WebContents creation
// hooks, and in others the test code must manually call "OnWebContentsCreated".
//
// Rough directions for use:
//
// In browser tests:
// - components_browsertests:
//   The PerformanceManagerBrowserTestHarness fixture brings its own
//   OnWebContentsCreated hooks.
// - browser_tests:
//   The PerformanceManagerBrowserTestHarness and
//   ChromeRenderViewHostTestHarness have their own OnWebContentsCreated hooks.
//   If using ChromeRenderViewHostTestHarness you need to embed an instance of
//   this helper in order to initialize the PM.
//
// In unit tests:
// - components_unittests:
//   The PerformanceManagerTestHarness brings its own OnWebContentsCreated
//   hooks providing you use its CreateTestWebContents helper.
// - unit_tests:
//   The ChromeRenderViewHostTestHarness brings its own OnWebContentsCreated
//   hooks, but you need to embed an instance of this helper in order to
//   initialize the PM.
//
// This helper initializes the performance manager in the call to SetUp(), and
// tears it down in TearDown().
class PerformanceManagerTestHarnessHelper {};

}  // namespace performance_manager

#endif  // COMPONENTS_PERFORMANCE_MANAGER_TEST_SUPPORT_TEST_HARNESS_HELPER_H_