OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/CSSStyleSheet.h" | 5 #include "core/css/CSSStyleSheet.h" |
6 #include "core/css/StyleRule.h" | 6 #include "core/css/StyleRule.h" |
7 #include "core/css/StyleSheetContents.h" | 7 #include "core/css/StyleSheetContents.h" |
8 #include "core/css/parser/CSSLazyParsingState.h" | 8 #include "core/css/parser/CSSLazyParsingState.h" |
9 #include "core/css/parser/CSSParser.h" | 9 #include "core/css/parser/CSSParser.h" |
10 #include "core/css/parser/CSSParserContext.h" | 10 #include "core/css/parser/CSSParserContext.h" |
11 #include "core/page/Page.h" | 11 #include "core/page/Page.h" |
12 #include "core/testing/DummyPageHolder.h" | 12 #include "core/testing/DummyPageHolder.h" |
13 #include "platform/heap/Heap.h" | 13 #include "platform/heap/Heap.h" |
14 #include "platform/testing/HistogramTester.h" | 14 #include "platform/testing/HistogramTester.h" |
15 #include "platform/wtf/text/WTFString.h" | 15 #include "platform/wtf/text/WTFString.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace blink { | 18 namespace blink { |
19 | 19 |
20 class CSSLazyParsingTest : public testing::Test { | 20 class CSSLazyParsingTest : public ::testing::Test { |
21 public: | 21 public: |
22 bool HasParsedProperties(StyleRule* rule) { | 22 bool HasParsedProperties(StyleRule* rule) { |
23 return rule->HasParsedProperties(); | 23 return rule->HasParsedProperties(); |
24 } | 24 } |
25 | 25 |
26 StyleRule* RuleAt(StyleSheetContents* sheet, size_t index) { | 26 StyleRule* RuleAt(StyleSheetContents* sheet, size_t index) { |
27 return ToStyleRule(sheet->ChildRules()[index]); | 27 return ToStyleRule(sheet->ChildRules()[index]); |
28 } | 28 } |
29 | 29 |
30 protected: | 30 protected: |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 histogram_tester_.ExpectBucketCount(usage_metric, | 236 histogram_tester_.ExpectBucketCount(usage_metric, |
237 CSSLazyParsingState::kUsageGt90, 1); | 237 CSSLazyParsingState::kUsageGt90, 1); |
238 histogram_tester_.ExpectBucketCount(usage_metric, | 238 histogram_tester_.ExpectBucketCount(usage_metric, |
239 CSSLazyParsingState::kUsageAll, 1); | 239 CSSLazyParsingState::kUsageAll, 1); |
240 | 240 |
241 histogram_tester_.ExpectTotalCount(total_rules_full_usage_metric, 1); | 241 histogram_tester_.ExpectTotalCount(total_rules_full_usage_metric, 1); |
242 histogram_tester_.ExpectUniqueSample(total_rules_full_usage_metric, 5, 1); | 242 histogram_tester_.ExpectUniqueSample(total_rules_full_usage_metric, 5, 1); |
243 } | 243 } |
244 | 244 |
245 } // namespace blink | 245 } // namespace blink |
OLD | NEW |