chromium/components/page_load_metrics/browser/observers/third_party_metrics_observer_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 "components/page_load_metrics/browser/observers/third_party_metrics_observer.h"

#include "base/memory/ptr_util.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 "components/page_load_metrics/common/page_load_metrics.mojom.h"
#include "components/page_load_metrics/common/test/page_load_metrics_test_util.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_renderer_host.h"
#include "net/cookies/canonical_cookie.h"
#include "testing/gmock/include/gmock/gmock.h"

const char kReadCookieHistogram[] =;
const char kSubframeFCPHistogram[] =;

NavigationSimulator;
RenderFrameHost;
RenderFrameHostTester;

class ThirdPartyMetricsObserverTestBase
    : public page_load_metrics::PageLoadMetricsObserverContentTestHarness {};

class ThirdPartyMetricsObserverTest : public ThirdPartyMetricsObserverTestBase,
                                      public testing::WithParamInterface<bool> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(ThirdPartyMetricsObserverTest, NoThirdPartyFrame_NoneRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest, OneThirdPartyFrame_OneRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest,
       OneThirdPartyFrameWithTwoSameUpdates_OneRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest, SixtyFrames_FiftyRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest, ThreeThirdPartyFrames_ThreeRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest, NoCookiesRead_NoneRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest, BlockedCookiesRead_NotRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest,
       NoRegistrableDomainNoHostCookiesRead_NoneRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest,
       NoRegistrableDomainWithHostCookiesRead_OneRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest,
       DifferentSchemeSameRegistrableDomain_OneRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest, OnlyFirstPartyCookiesRead_NotRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest, OneCookieRead_OneRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest,
       ThreeCookiesReadSameThirdParty_OneRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest,
       CookiesReadMultipleThirdParties_MultipleRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest, OneCookieChanged_OneRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest, ReadAndChangeCookies_BothRecorded) {}

TEST_P(ThirdPartyMetricsObserverTest,
       LargestContentfulPaint_HasThirdPartyFont) {}

TEST_P(ThirdPartyMetricsObserverTest,
       NoLargestContentfulPaint_HasThirdPartyFont) {}

TEST_P(ThirdPartyMetricsObserverTest,
       NoTextLargestContentfulPaint_HasThirdPartyFont) {}