chromium/chrome/browser/web_applications/daily_metrics_helper_unittest.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/web_applications/daily_metrics_helper.h"

#include <stdint.h>

#include <vector>

#include "base/numerics/clamped_math.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "chrome/browser/web_applications/test/web_app_test.h"
#include "chrome/test/base/testing_profile.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/public/test/browser_task_environment.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/mojom/ukm_interface.mojom.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

namespace web_app {

namespace {

Contains;
Key;
Not;
UkmEntry;

// EntryWithStartUrlAndInstallSource matcher is unable to refer to
// kInstallSourceNameHash directly.
constexpr auto kInstallSourceNameHash =;

MATCHER_P3(EntryWithStartUrlAndInstallSource,
           ukm_recorder,
           url,
           install_source,
           "") {}

class DailyMetricsHelperTest : public WebAppTest {};

}  // namespace

TEST_F(DailyMetricsHelperTest, NothingEmittedForCallsInOneDay) {}

TEST_F(DailyMetricsHelperTest, EmitsOldRecordsOnFirstCallNextDay) {}

TEST_F(DailyMetricsHelperTest, EmitsOncePerUrl) {}

TEST_F(DailyMetricsHelperTest, EmitsLatestValuePerUrl) {}

// Ensure last-recorded values are used for non-summed features.
TEST_F(DailyMetricsHelperTest, EmitsLatestValues) {}

TEST_F(DailyMetricsHelperTest, EmitsSumsForDurationsAndSessions) {}

TEST_F(DailyMetricsHelperTest, EmitsClampedSumsForExtremeDurations) {}

TEST_F(DailyMetricsHelperTest, DoesNotEmitZeroDurationsOrSessions) {}

}  // namespace web_app