chromium/third_party/blink/renderer/core/frame/use_counter_impl_test.cc

// Copyright 2015 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/test/metrics/histogram_tester.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/scheme_registry.h"
#include "third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom-blink.h"
#include "third_party/blink/renderer/core/css/css_property_names.h"
#include "third_party/blink/renderer/core/css/properties/css_property.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/frame/deprecation/deprecation.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/html/html_html_element.h"
#include "third_party/blink/renderer/core/loader/document_loader.h"
#include "third_party/blink/renderer/core/loader/empty_clients.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/testing/dummy_page_holder.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/testing/url_test_helpers.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/scheme_registry.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"

namespace {
const char kExtensionFeaturesHistogramName[] =;

const char kExtensionUrl[] =;

int GetPageVisitsBucketforHistogram(const std::string& histogram_name) {}

}  // namespace

namespace blink {
WebFeature;

class UseCounterImplTest : public testing::Test {};

class UseCounterImplBrowserReportTest
    : public UseCounterImplTest,
      public ::testing::WithParamInterface</* URL */ const char*> {};

INSTANTIATE_TEST_SUITE_P();

// UseCounter should not send events to browser when handling page with
// Non HTTP Family URLs, as these events will be discarded on the browser side
// in |MetricsWebContentsObserver::DoesTimingUpdateHaveError|.
TEST_P(UseCounterImplBrowserReportTest, ReportOnlyHTTPFamily) {}

TEST_F(UseCounterImplTest, RecordingExtensions) {}

TEST_F(UseCounterImplTest, CSSSelectorPseudoWhere) {}

/*
 * Counter-specific tests
 *
 * NOTE: Most individual UseCounters don't need dedicated test cases.  They are
 * "tested" by analyzing the data they generate including on some known pages.
 * Feel free to add tests for counters where the triggering logic is
 * non-trivial, but it's not required. Manual analysis is necessary to trust the
 * data anyway, real-world pages are full of edge-cases and surprises that you
 * won't find in unit testing anyway.
 */

TEST_F(UseCounterImplTest, CSSSelectorPseudoAnyLink) {}

TEST_F(UseCounterImplTest, CSSSelectorPseudoWebkitAnyLink) {}

TEST_F(UseCounterImplTest, CSSTypedOMStylePropertyMap) {}

TEST_F(UseCounterImplTest, CSSSelectorPseudoIs) {}

TEST_F(UseCounterImplTest, CSSSelectorPseudoDir) {}

TEST_F(UseCounterImplTest, CSSSelectorNthChildOfSelector) {}

TEST_F(UseCounterImplTest, CSSGridLayoutPercentageColumnIndefiniteWidth) {}

TEST_F(UseCounterImplTest, CSSFlexibleBox) {}

TEST_F(UseCounterImplTest, CSSFlexibleBoxInline) {}

TEST_F(UseCounterImplTest, CSSFlexibleBoxButton) {}

TEST_F(UseCounterImplTest, HTMLRootContained) {}

TEST_F(UseCounterImplTest, HTMLBodyContained) {}

class DeprecationTest : public testing::Test {};

TEST_F(DeprecationTest, InspectorDisablesDeprecation) {}

TEST_F(UseCounterImplTest, CSSUnknownNamespacePrefixInSelector) {}

TEST_F(UseCounterImplTest, CSSSelectorHostContextInLiveProfile) {}

TEST_F(UseCounterImplTest, CSSSelectorHostContextInSnapshotProfile) {}

TEST_F(UseCounterImplTest, UniqueCSSSampleIds) {}

TEST_F(UseCounterImplTest, MaximumCSSSampleId) {}

TEST_F(UseCounterImplTest, CSSMarkerPseudoElementUA) {}

TEST_F(UseCounterImplTest, CSSMarkerPseudoElementAuthor) {}

TEST_F(UseCounterImplTest, BackgroundClip) {}

TEST_F(UseCounterImplTest, H1UserAgentFontSizeInSectionApplied) {}

}  // namespace blink