#include "components/performance_manager/performance_manager_tab_helper.h"
#include <optional>
#include <set>
#include <utility>
#include "base/containers/contains.h"
#include "base/test/scoped_feature_list.h"
#include "components/performance_manager/graph/frame_node_impl.h"
#include "components/performance_manager/graph/graph_impl_operations.h"
#include "components/performance_manager/graph/page_node_impl.h"
#include "components/performance_manager/graph/process_node_impl.h"
#include "components/performance_manager/performance_manager_impl.h"
#include "components/performance_manager/public/features.h"
#include "components/performance_manager/public/graph/page_node.h"
#include "components/performance_manager/render_process_user_data.h"
#include "components/performance_manager/test_support/performance_manager_test_harness.h"
#include "components/performance_manager/test_support/run_in_graph.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_features.h"
#include "content/public/common/process_type.h"
#include "content/public/test/mock_permission_controller.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/render_frame_host_test_support.h"
#include "content/public/test/web_contents_tester.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/permissions/permission_utils.h"
#include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
namespace performance_manager {
namespace {
const char kParentUrl[] = …;
const char kChild1Url[] = …;
const char kChild2Url[] = …;
const char kGrandchildUrl[] = …;
const char kNewGrandchildUrl[] = …;
const char kCousinFreddyUrl[] = …;
class PerformanceManagerTabHelperTest
: public PerformanceManagerTestHarness,
public testing::WithParamInterface<bool> { … };
void PerformanceManagerTabHelperTest::CheckGraphTopology(
const std::set<content::RenderProcessHost*>& hosts,
const char* grandchild_url) { … }
}
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(PerformanceManagerTabHelperTest, FrameHierarchyReflectsToGraph) { … }
namespace {
void ExpectPageIsAudible(bool is_audible) { … }
#if !BUILDFLAG(IS_ANDROID)
void ExpectNotificationPermissionStatus(
std::optional<blink::mojom::PermissionStatus> status) { … }
#endif
}
TEST_P(PerformanceManagerTabHelperTest, PageIsAudible) { … }
#if !BUILDFLAG(IS_ANDROID)
TEST_P(PerformanceManagerTabHelperTest, NotificationPermission) { … }
#endif
TEST_P(PerformanceManagerTabHelperTest, GetFrameNode) { … }
namespace {
class LenientMockPageNodeObserver : public PageNode::ObserverDefaultImpl { … };
MockPageNodeObserver;
}
TEST_P(PerformanceManagerTabHelperTest,
NotificationsFromInactiveFrameTreeAreIgnored) { … }
}