chromium/third_party/blink/renderer/core/css/rule_set_test.cc

/*
 * Copyright (c) 2014, Google Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of Opera Software ASA nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "third_party/blink/renderer/core/css/rule_set.h"

#include "base/test/scoped_feature_list.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/core/css/css_default_style_sheets.h"
#include "third_party/blink/renderer/core/css/css_keyframes_rule.h"
#include "third_party/blink/renderer/core/css/css_rule_list.h"
#include "third_party/blink/renderer/core/css/css_test_helpers.h"
#include "third_party/blink/renderer/core/css/style_sheet_contents.h"
#include "third_party/blink/renderer/core/html/html_style_element.h"
#include "third_party/blink/renderer/core/testing/sim/sim_request.h"
#include "third_party/blink/renderer/core/testing/sim/sim_test.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"

ElementsAreArray;

namespace blink {

namespace {

StyleRule* CreateDummyStyleRule() {}

}  // namespace

TEST(RuleSetTest, findBestRuleSetAndAdd_CustomPseudoElements) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_Id) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_NthChild) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_ClassThenId) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_IdThenClass) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_AttrThenId) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_TagThenAttrThenId) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_TagThenAttr) {}

// It's arbitrary which of these we choose, but it needs to match
// the behavior in IsCoveredByBucketing().
TEST(RuleSetTest, findBestRuleSetAndAdd_ThreeClasses) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_AttrThenClass) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_Host) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_HostWithId) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_HostContext) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_HostContextWithId) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_HostAndHostContextNotInRightmost) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_HostAndClass) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_HostContextAndClass) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_Focus) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_LinkVisited) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_Cue) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_PlaceholderPseudo) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_PartPseudoElements) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_IsSingleArg) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_WhereSingleArg) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_WhereSingleArgNested) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_IsMultiArg) {}

TEST(RuleSetTest, findBestRuleSetAndAdd_WhereMultiArg) {}

static void AddManyAttributeRules(base::test::ScopedFeatureList& feature_list,
                                  css_test_helpers::TestStyleSheet& sheet) {}

TEST(RuleSetTest, LargeNumberOfAttributeRules) {}

TEST(RuleSetTest, LargeNumberOfAttributeRulesWithEmpty) {}

TEST(RuleSetTest, LargeNumberOfAttributeRulesWithCatchAll) {}

TEST(RuleSetTest, LargeNumberOfAttributeRulesWithCatchAll2) {}

#if DCHECK_IS_ON()  // Requires all_rules_, to find back the rules we add.

// Parse the given selector, buckets it and returns which of the constituent
// simple selectors were marked as covered by that bucketing. Note the the
// result value is stored in the order the selector is stored, which means
// that the order of the compound selectors are reversed (see comment in
// CSSSelectorParser::ConsumeComplexSelector()).
//
// A single selector may produce more than one RuleData, since visited-dependent
// rules are added to the RuleSet twice. The `rule_index` parameter can used
// to specify which of the added RuleData objects we want to produce bucket-
// coverage information from.
std::deque<bool> CoveredByBucketing(const String& selector_text,
                                    wtf_size_t rule_index = 0) {}

wtf_size_t RuleCount(const String& selector_text) {}

TEST(RuleSetTest, IsCoveredByBucketing) {}

TEST(RuleSetTest, VisitedDependentRuleCount) {}

#endif  // DCHECK_IS_ON()

TEST(RuleSetTest, SelectorIndexLimit) {}

TEST(RuleSetTest, RuleDataPositionLimit) {}

TEST(RuleSetTest, RuleCountNotIncreasedByInvalidRuleData) {}

TEST(RuleSetTest, NoStyleScope) {}

TEST(RuleSetTest, StyleScope) {}

TEST(RuleSetTest, NestedStyleScope) {}

TEST(RuleSetTest, SingleScope) {}

class RuleSetCascadeLayerTest : public SimTest {};

TEST_F(RuleSetCascadeLayerTest, NoLayer) {}

TEST_F(RuleSetCascadeLayerTest, Basic) {}

TEST_F(RuleSetCascadeLayerTest, NestingAndFlatListName) {}

TEST_F(RuleSetCascadeLayerTest, LayerStatementOrdering) {}

TEST_F(RuleSetCascadeLayerTest, LayeredImport) {}

TEST_F(RuleSetCascadeLayerTest, LayerStatementsBeforeAndAfterImport) {}

}  // namespace blink