#include "chrome/browser/page_load_metrics/integration_tests/metric_integration_test.h"
#include <string_view>
#include "base/strings/stringprintf.h"
#include "base/test/trace_event_analyzer.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/tracing_controller.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "services/metrics/public/cpp/ukm_builders.h"
CommandLine;
OnceClosure;
RunLoop;
TraceConfig;
TracingController;
WebContents;
BasicHttpResponse;
HttpRequest;
HttpResponse;
Query;
TraceAnalyzer;
TraceEvent;
TraceEventVector;
TestUkmRecorder;
PageLoad;
UkmEntry;
MetricIntegrationTest::MetricIntegrationTest() { … }
MetricIntegrationTest::~MetricIntegrationTest() = default;
void MetricIntegrationTest::SetUpOnMainThread() { … }
void MetricIntegrationTest::ServeDelayed(const std::string& url,
const std::string& content,
base::TimeDelta delay) { … }
void MetricIntegrationTest::Serve(const std::string& url,
const std::string& content) { … }
void MetricIntegrationTest::Start() { … }
void MetricIntegrationTest::Load(const std::string& relative_url) { … }
void MetricIntegrationTest::LoadHTML(const std::string& content) { … }
content::RenderWidgetHost* MetricIntegrationTest::GetRenderWidgetHost() { … }
void MetricIntegrationTest::StartTracing(
const std::vector<std::string>& categories) { … }
void MetricIntegrationTest::StopTracing(std::string& trace_output) { … }
std::unique_ptr<TraceAnalyzer> MetricIntegrationTest::StopTracingAndAnalyze() { … }
WebContents* MetricIntegrationTest::web_contents() const { … }
void MetricIntegrationTest::SetUpCommandLine(CommandLine* command_line) { … }
std::unique_ptr<HttpResponse> MetricIntegrationTest::HandleRequest(
const std::string& relative_url,
const std::string& content,
base::TimeDelta delay,
const HttpRequest& request) { … }
const ukm::mojom::UkmEntryPtr MetricIntegrationTest::GetEntry() { … }
std::vector<double> MetricIntegrationTest::GetPageLoadMetricsAsList(
std::string_view metric_name) { … }
void MetricIntegrationTest::ExpectUKMPageLoadMetric(
std::string_view metric_name,
int64_t expected_value) { … }
void MetricIntegrationTest::ExpectUKMPageLoadMetricNonExistence(
std::string_view metric_name) { … }
void MetricIntegrationTest::
ExpectUKMPageLoadMetricNonExistenceWithExpectedPageLoadMetricsNum(
unsigned long expected_num_page_load_metrics,
std::string_view metric_name) { … }
void MetricIntegrationTest::ExpectUkmEventNotRecorded(
std::string_view event_name) { … }
void MetricIntegrationTest::ExpectUKMPageLoadMetricGreaterThan(
std::string_view metric_name,
int64_t expected_value) { … }
void MetricIntegrationTest::ExpectUKMPageLoadMetricLowerThan(
std::string_view metric_name,
int64_t expected_value) { … }
void MetricIntegrationTest::ExpectUKMPageLoadMetricsInAscendingOrder(
std::string_view metric_name1,
std::string_view metric_name2) { … }
int64_t MetricIntegrationTest::GetUKMPageLoadMetricFlagSet(
std::string_view metric_name) { … }
void MetricIntegrationTest::ExpectUKMPageLoadMetricFlagSet(
std::string_view metric_name,
uint32_t flag_set,
bool expected) { … }
void MetricIntegrationTest::ExpectUKMPageLoadMetricFlagSetExactMatch(
std::string_view metric_name,
uint32_t flag_set) { … }
void MetricIntegrationTest::ExpectUKMPageLoadMetricNear(
std::string_view metric_name,
double expected_value,
double epsilon) { … }
void MetricIntegrationTest::ExpectUniqueUMAWithinRange(
std::string_view metric_name,
double expected_value,
double below,
double above) { … }
void MetricIntegrationTest::ExpectUniqueUMABucketCount(
std::string_view metric_name,
base::HistogramBase::Sample sample,
base::HistogramBase::Count count) { … }
void MetricIntegrationTest::ExpectUniqueUMAPageLoadMetricNear(
std::string_view metric_name,
double expected_value) { … }
void MetricIntegrationTest::ExpectUniqueUMA(std::string_view metric_name) { … }
void MetricIntegrationTest::ExpectMetricInLastUKMUpdateTraceEventNear(
TraceAnalyzer& trace_analyzer,
std::string_view metric_name,
double expected_value,
double epsilon) { … }