chromium/content/browser/renderer_host/back_forward_cache_metrics_unittest.cc

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

#include "base/sanitizer_buildflags.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/browser/renderer_host/back_forward_cache_impl.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/test/back_forward_cache_util.h"
#include "content/public/test/test_utils.h"
#include "content/test/navigation_simulator_impl.h"
#include "content/test/test_render_frame_host.h"
#include "content/test/test_render_view_host.h"
#include "content/test/test_web_contents.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h"

namespace content {

namespace {
const char kBackForwardCachePageWithFormStorableHistogramName[] =;
const char kBackForwardCachePageWithFormRestoreResultHistogramName[] =;

class BackForwardCacheWebContentsDelegate : public WebContentsDelegate {};

}  // namespace

class BackForwardCacheMetricsTest : public RenderViewHostImplTestHarness,
                                    public WebContentsObserver {};

UkmEntry;

ukm::SourceId ToSourceId(int64_t navigation_id) {}

TEST_F(BackForwardCacheMetricsTest, HistoryNavigationUKM) {}

TEST_F(BackForwardCacheMetricsTest, LongDurationsAreClamped) {}

TEST_F(BackForwardCacheMetricsTest, TimeRecordedAtStart) {}

// TODO(crbug.com/40200059): Flaky under TSan.
#if BUILDFLAG(USING_SANITIZER)
#define MAYBE_TimeRecordedWhenRendererIsKilled
#else
#define MAYBE_TimeRecordedWhenRendererIsKilled
#endif
TEST_F(BackForwardCacheMetricsTest, MAYBE_TimeRecordedWhenRendererIsKilled) {}

// Test that |GetDisallowedFeatures()| and |GetAllowedFeatures()| cover all the
// blocklisted features.
TEST_F(BackForwardCacheMetricsTest, AllFeaturesCovered) {}

TEST_F(BackForwardCacheMetricsTest, PageWithFormsMetricsStoredRecorded) {}

TEST_F(BackForwardCacheMetricsTest,
       PageWithFormsMetricsRecordedForSameSiteNavigation) {}

TEST_F(BackForwardCacheMetricsTest, PageWithFormsMetricsNotRestoreRecorded) {}

TEST_F(BackForwardCacheMetricsTest, PageWithFormsMetricsNotStore) {}
}  // namespace content