#include "components/page_load_metrics/browser/observers/use_counter_page_load_metrics_observer.h"
#include <memory>
#include <vector>
#include "base/metrics/histogram_base.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "components/page_load_metrics/browser/observers/page_load_metrics_observer_content_test_harness.h"
#include "components/page_load_metrics/browser/page_load_tracker.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_renderer_host.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom.h"
#include "third_party/blink/public/mojom/use_counter/metrics/webdx_feature.mojom.h"
#include "url/gurl.h"
namespace {
const char kTestUrl[] = …;
WebFeature;
WebDXFeature;
CSSSampleId;
FeatureType;
const char* GetUseCounterHistogramName(
blink::mojom::UseCounterFeatureType feature_type,
bool is_in_main_frame = false) { … }
}
class UseCounterMetricsRecorderTest
: public page_load_metrics::PageLoadMetricsObserverContentTestHarness,
public testing::WithParamInterface<bool> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(UseCounterMetricsRecorderTest, CountOneFeature) { … }
TEST_P(UseCounterMetricsRecorderTest, CountFeatures) { … }
TEST_P(UseCounterMetricsRecorderTest, CountMappedFeatures) { … }
TEST_P(UseCounterMetricsRecorderTest, CountDuplicatedFeatures) { … }
class UseCounterPageLoadMetricsObserverTest
: public page_load_metrics::PageLoadMetricsObserverContentTestHarness { … };
TEST_F(UseCounterPageLoadMetricsObserverTest, CountOneFeature) { … }
TEST_F(UseCounterPageLoadMetricsObserverTest, CountOneWebDXFeature) { … }
TEST_F(UseCounterPageLoadMetricsObserverTest, CountFeatures) { … }
TEST_F(UseCounterPageLoadMetricsObserverTest, CountDuplicatedFeatures) { … }