blob: 6a44afa86332d308a978b4cb7bb634b8b90d9811 [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_PERFORMANCE_MANAGER_PERFORMANCE_MANAGER_TEST_HARNESS_H_
#define COMPONENTS_PERFORMANCE_MANAGER_PERFORMANCE_MANAGER_TEST_HARNESS_H_
#include "components/performance_manager/performance_manager_impl.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_renderer_host.h"
namespace performance_manager {
class PerformanceManagerRegistry;
// A test harness that initializes PerformanceManagerImpl, plus the entire
// RenderViewHost harness. Allows for creating full WebContents, and their
// accompanying structures in the graph. The task environment is accessed
// via content::RenderViewHostTestHarness::test_bundle().
class PerformanceManagerTestHarness
: public content::RenderViewHostTestHarness {
public:
using Super = content::RenderViewHostTestHarness;
PerformanceManagerTestHarness();
~PerformanceManagerTestHarness() override;
void SetUp() override;
void TearDown() override;
// Creates a test web contents with performance manager tab helpers
// attached. This is a test web contents that can be interacted with
// via WebContentsTester.
std::unique_ptr<content::WebContents> CreateTestWebContents();
private:
std::unique_ptr<PerformanceManagerImpl> perf_man_;
std::unique_ptr<PerformanceManagerRegistry> registry_;
DISALLOW_COPY_AND_ASSIGN(PerformanceManagerTestHarness);
};
} // namespace performance_manager
#endif // COMPONENTS_PERFORMANCE_MANAGER_PERFORMANCE_MANAGER_TEST_HARNESS_H_