| 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 "core/css/resolver/MatchResult.h" | 5 #include "core/css/resolver/MatchResult.h" |
| 6 | 6 |
| 7 #include "core/css/StylePropertySet.h" | 7 #include "core/css/StylePropertySet.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 class MatchResultTest : public ::testing::Test { | 12 class MatchResultTest : public ::testing::Test { |
| 13 protected: | 13 protected: |
| 14 void SetUp() override; | 14 void SetUp() override; |
| 15 | 15 |
| 16 const StylePropertySet* propertySet(unsigned index) const { | 16 const StylePropertySet* propertySet(unsigned index) const { |
| 17 return propertySets[index].get(); | 17 return propertySets[index].get(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 private: | 20 private: |
| 21 PersistentHeapVector<Member<MutableStylePropertySet>, 6> propertySets; | 21 PersistentHeapVector<Member<MutableStylePropertySet>, 6> propertySets; |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 void MatchResultTest::SetUp() { | 24 void MatchResultTest::SetUp() { |
| 25 for (unsigned i = 0; i < 6; i++) | 25 for (unsigned i = 0; i < 6; i++) |
| 26 propertySets.append(MutableStylePropertySet::create(HTMLQuirksMode)); | 26 propertySets.push_back(MutableStylePropertySet::create(HTMLQuirksMode)); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void testMatchedPropertiesRange(const MatchedPropertiesRange& range, | 29 void testMatchedPropertiesRange(const MatchedPropertiesRange& range, |
| 30 int expectedLength, | 30 int expectedLength, |
| 31 const StylePropertySet** expectedSets) { | 31 const StylePropertySet** expectedSets) { |
| 32 EXPECT_EQ(expectedLength, range.end() - range.begin()); | 32 EXPECT_EQ(expectedLength, range.end() - range.begin()); |
| 33 for (const auto& matchedProperties : range) | 33 for (const auto& matchedProperties : range) |
| 34 EXPECT_EQ(*expectedSets++, matchedProperties.properties); | 34 EXPECT_EQ(*expectedSets++, matchedProperties.properties); |
| 35 } | 35 } |
| 36 | 36 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 ++iter; | 162 ++iter; |
| 163 EXPECT_NE(important.end(), iter); | 163 EXPECT_NE(important.end(), iter); |
| 164 testMatchedPropertiesRange(*iter, 2, authorSets); | 164 testMatchedPropertiesRange(*iter, 2, authorSets); |
| 165 | 165 |
| 166 ++iter; | 166 ++iter; |
| 167 EXPECT_EQ(important.end(), iter); | 167 EXPECT_EQ(important.end(), iter); |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace blink | 170 } // namespace blink |
| OLD | NEW |