#include "content/browser/renderer_host/back_forward_cache_metrics.h"
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "components/ukm/test_ukm_recorder.h"
#include "content/browser/renderer_host/back_forward_cache_impl.h"
#include "content/browser/renderer_host/navigation_controller_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/content_navigation_policy.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/test/back_forward_cache_util.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/fenced_frame_test_util.h"
#include "content/public/test/prerender_test_util.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/shell/browser/shell.h"
#include "content/test/content_browser_test_utils_internal.h"
#include "mojo/public/cpp/test_support/test_utils.h"
#include "net/dns/mock_host_resolver.h"
#include "services/device/public/cpp/test/scoped_geolocation_overrider.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h"
#include "third_party/blink/public/mojom/frame/back_forward_cache_controller.mojom-test-utils.h"
Bucket;
ElementsAre;
namespace content {
namespace {
ukm::SourceId ToSourceId(int64_t navigation_id) { … }
blink::scheduler::WebSchedulerTrackedFeatures GetFeaturesToIgnore() { … }
UkmMetrics;
UkmEntry;
enum BackForwardCacheStatus { … };
}
class BackForwardCacheMetricsBrowserTestBase : public ContentBrowserTest,
public WebContentsObserver { … };
class BackForwardCacheMetricsBrowserTest
: public BackForwardCacheMetricsBrowserTestBase,
public testing::WithParamInterface<BackForwardCacheStatus> { … };
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest, UKM) { … }
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest, CloneAndGoBack) { … }
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest,
FlushRecordsNotRestoredReasons) { … }
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest,
WebViewFlushRecordsExtendedNotRestoredReasons) { … }
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest, Reload) { … }
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest,
SameDocumentNavigationAndGoBackImmediately) { … }
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest,
GoBackToSameDocumentNavigationEntry) { … }
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest,
GoBackToSameDocumentNavigationEntry2) { … }
namespace {
std::vector<ukm::SourceId> GetMetricsSourceIds(
ukm::TestAutoSetUkmRecorder* recorder) { … }
}
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest, Features_MainFrame) { … }
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest,
Features_MainFrame_CrossOriginNavigation) { … }
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest,
Features_SameOriginSubframes) { … }
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest,
Features_SameOriginSubframes_CrossOriginNavigation) { … }
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest,
Features_CrossOriginSubframes) { … }
#if BUILDFLAG(IS_ANDROID)
#define MAYBE_SharedWorker …
#else
#define MAYBE_SharedWorker …
#endif
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest, MAYBE_SharedWorker) { … }
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest, Geolocation) { … }
class RecordBackForwardCacheMetricsWithoutEnabling
: public BackForwardCacheMetricsBrowserTestBase { … };
IN_PROC_BROWSER_TEST_F(RecordBackForwardCacheMetricsWithoutEnabling,
ReloadsAndHistoryNavigations) { … }
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest,
RecordReloadsAfterHistoryNavigation) { … }
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsBrowserTest,
RestoreNavigationToNextPaint) { … }
class BackForwardCacheMetricsPrerenderingBrowserTest
: public BackForwardCacheMetricsBrowserTest { … };
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsPrerenderingBrowserTest,
MainFrameNavigation) { … }
class BackForwardCacheMetricsFencedFrameBrowserTest
: public BackForwardCacheMetricsBrowserTest { … };
IN_PROC_BROWSER_TEST_P(BackForwardCacheMetricsFencedFrameBrowserTest,
FenceFrameNavigation) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}