OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/css/resolver/MatchResult.h" | 6 #include "core/css/resolver/MatchResult.h" |
7 | 7 |
8 #include "core/css/StylePropertySet.h" | 8 #include "core/css/StylePropertySet.h" |
9 #include <gtest/gtest.h> | 9 #include <gtest/gtest.h> |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class MatchResultTest : public ::testing::Test { | 13 class MatchResultTest : public ::testing::Test { |
14 protected: | 14 protected: |
15 void SetUp() override; | 15 void SetUp() override; |
16 | 16 |
17 const StylePropertySet* propertySet(unsigned index) const | 17 const StylePropertySet* propertySet(unsigned index) const |
18 { | 18 { |
19 return propertySets[index].get(); | 19 return propertySets[index].get(); |
20 } | 20 } |
21 | 21 |
22 private: | 22 private: |
23 WillBePersistentHeapVector<RefPtrWillBeMember<MutableStylePropertySet>, 6> p
ropertySets; | 23 WillBePersistentHeapVector<RefPtrWillBeMember<MutableStylePropertySet>, 6> p
ropertySets; |
24 }; | 24 }; |
25 | 25 |
26 void MatchResultTest::SetUp() | 26 void MatchResultTest::SetUp() |
27 { | 27 { |
28 for (unsigned i = 0; i < 6; i++) | 28 for (unsigned i = 0; i < 6; i++) |
29 propertySets.append(MutableStylePropertySet::create()); | 29 propertySets.append(MutableStylePropertySet::create(HTMLQuirksMode)); |
30 } | 30 } |
31 | 31 |
32 void testMatchedPropertiesRange(const MatchedPropertiesRange& range, int expecte
dLength, const StylePropertySet** expectedSets) | 32 void testMatchedPropertiesRange(const MatchedPropertiesRange& range, int expecte
dLength, const StylePropertySet** expectedSets) |
33 { | 33 { |
34 EXPECT_EQ(expectedLength, range.end() - range.begin()); | 34 EXPECT_EQ(expectedLength, range.end() - range.begin()); |
35 for (const auto& matchedProperties : range) | 35 for (const auto& matchedProperties : range) |
36 EXPECT_EQ(*expectedSets++, matchedProperties.properties); | 36 EXPECT_EQ(*expectedSets++, matchedProperties.properties); |
37 } | 37 } |
38 | 38 |
39 TEST_F(MatchResultTest, UARules) | 39 TEST_F(MatchResultTest, UARules) |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 ++iter; | 165 ++iter; |
166 EXPECT_NE(important.end(), iter); | 166 EXPECT_NE(important.end(), iter); |
167 testMatchedPropertiesRange(*iter, 2, authorSets); | 167 testMatchedPropertiesRange(*iter, 2, authorSets); |
168 | 168 |
169 ++iter; | 169 ++iter; |
170 EXPECT_EQ(important.end(), iter); | 170 EXPECT_EQ(important.end(), iter); |
171 } | 171 } |
172 | 172 |
173 } // namespace blink | 173 } // namespace blink |
OLD | NEW |