#include "chrome/browser/ui/tabs/tab_ukm_test_helper.h"
#include "base/memory/raw_ptr.h"
#include <sstream>
#include "base/ranges/algorithm.h"
#include "services/metrics/public/cpp/ukm_source.h"
#include "services/metrics/public/mojom/ukm_interface.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
void ExpectEntryMetrics(const ukm::mojom::UkmEntry& entry,
const UkmMetricMap& expected_metrics) { … }
bool EntryContainsMetrics(const ukm::mojom::UkmEntry* entry,
const UkmMetricMap& expected_metrics) { … }
std::vector<
raw_ptr<const ukm::mojom::UkmEntry, VectorExperimental>>::const_iterator
FindMatchingEntry(
const std::vector<raw_ptr<const ukm::mojom::UkmEntry, VectorExperimental>>&
entries,
const UkmMetricMap& expected_metrics) { … }
}
UkmEntryChecker::UkmEntryChecker() = default;
UkmEntryChecker::~UkmEntryChecker() { … }
void UkmEntryChecker::ExpectNewEntry(const std::string& entry_name,
const GURL& source_url,
const UkmMetricMap& expected_metrics) { … }
void UkmEntryChecker::ExpectNewEntries(
const std::string& entry_name,
const std::vector<UkmMetricMap>& expected_entries) { … }
void UkmEntryChecker::ExpectNewEntriesBySource(
const std::string& entry_name,
const SourceUkmMetricMap& expected_data) { … }
int UkmEntryChecker::NumNewEntriesRecorded(
const std::string& entry_name) const { … }
size_t UkmEntryChecker::NumEntries(const std::string& entry_name) const { … }
const ukm::mojom::UkmEntry* UkmEntryChecker::LastUkmEntry(
const std::string& entry_name) const { … }