| 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/dom/DocumentStatisticsCollector.h" | 5 #include "core/dom/DocumentStatisticsCollector.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/html/HTMLHeadElement.h" | 10 #include "core/html/HTMLHeadElement.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 for (int j = 0; j < 1000; j++) { | 140 for (int j = 0; j < 1000; j++) { |
| 141 html.append("0123456789"); | 141 html.append("0123456789"); |
| 142 } | 142 } |
| 143 html.append("</p>"); | 143 html.append("</p>"); |
| 144 } | 144 } |
| 145 setHtmlInnerHTML(html.toString()); | 145 setHtmlInnerHTML(html.toString()); |
| 146 WebDistillabilityFeatures features = | 146 WebDistillabilityFeatures features = |
| 147 DocumentStatisticsCollector::collectStatistics(document()); | 147 DocumentStatisticsCollector::collectStatistics(document()); |
| 148 | 148 |
| 149 double error = 1e-5; | 149 double error = 1e-5; |
| 150 EXPECT_NEAR(features.mozScore, 6 * sqrt(kTextContentLengthSaturation - | 150 EXPECT_NEAR( |
| 151 kParagraphLengthThreshold), | 151 features.mozScore, |
| 152 error); | 152 6 * sqrt(kTextContentLengthSaturation - kParagraphLengthThreshold), |
| 153 error); |
| 153 EXPECT_NEAR(features.mozScoreAllSqrt, 6 * sqrt(kTextContentLengthSaturation), | 154 EXPECT_NEAR(features.mozScoreAllSqrt, 6 * sqrt(kTextContentLengthSaturation), |
| 154 error); | 155 error); |
| 155 EXPECT_NEAR(features.mozScoreAllLinear, 6 * kTextContentLengthSaturation, | 156 EXPECT_NEAR(features.mozScoreAllLinear, 6 * kTextContentLengthSaturation, |
| 156 error); | 157 error); |
| 157 } | 158 } |
| 158 | 159 |
| 159 } // namespace blink | 160 } // namespace blink |
| OLD | NEW |