| 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 "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 8 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 9 #include "core/html/HTMLHeadElement.h" | 10 #include "core/html/HTMLHeadElement.h" |
| 10 #include "core/html/HTMLLinkElement.h" | 11 #include "core/html/HTMLLinkElement.h" |
| 11 #include "core/testing/DummyPageHolder.h" | 12 #include "core/testing/DummyPageHolder.h" |
| 12 #include "public/platform/WebDistillability.h" | 13 #include "public/platform/WebDistillability.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "wtf/text/StringBuilder.h" | 16 #include "wtf/text/StringBuilder.h" |
| 16 #include <memory> | |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 // Saturate the length of a paragraph to save time. | 20 // Saturate the length of a paragraph to save time. |
| 21 const unsigned kTextContentLengthSaturation = 1000; | 21 const unsigned kTextContentLengthSaturation = 1000; |
| 22 | 22 |
| 23 // Filter out short P elements. The threshold is set to around 2 English | 23 // Filter out short P elements. The threshold is set to around 2 English |
| 24 // sentences. | 24 // sentences. |
| 25 const unsigned kParagraphLengthThreshold = 140; | 25 const unsigned kParagraphLengthThreshold = 140; |
| 26 | 26 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 EXPECT_NEAR(features.mozScore, 6 * sqrt(kTextContentLengthSaturation - | 150 EXPECT_NEAR(features.mozScore, 6 * sqrt(kTextContentLengthSaturation - |
| 151 kParagraphLengthThreshold), | 151 kParagraphLengthThreshold), |
| 152 error); | 152 error); |
| 153 EXPECT_NEAR(features.mozScoreAllSqrt, 6 * sqrt(kTextContentLengthSaturation), | 153 EXPECT_NEAR(features.mozScoreAllSqrt, 6 * sqrt(kTextContentLengthSaturation), |
| 154 error); | 154 error); |
| 155 EXPECT_NEAR(features.mozScoreAllLinear, 6 * kTextContentLengthSaturation, | 155 EXPECT_NEAR(features.mozScoreAllLinear, 6 * kTextContentLengthSaturation, |
| 156 error); | 156 error); |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace blink | 159 } // namespace blink |
| OLD | NEW |