Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: third_party/WebKit/Source/core/dom/DocumentStatisticsCollectorTest.cpp

Issue 2321223003: Revert of Move collectGarbage* methods to ThreadState (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/html/HTMLHeadElement.h" 9 #include "core/html/HTMLHeadElement.h"
10 #include "core/html/HTMLLinkElement.h" 10 #include "core/html/HTMLLinkElement.h"
(...skipping 11 matching lines...) Expand all
22 22
23 // Filter out short P elements. The threshold is set to around 2 English sentenc es. 23 // Filter out short P elements. The threshold is set to around 2 English sentenc es.
24 const unsigned kParagraphLengthThreshold = 140; 24 const unsigned kParagraphLengthThreshold = 140;
25 25
26 class DocumentStatisticsCollectorTest : public ::testing::Test { 26 class DocumentStatisticsCollectorTest : public ::testing::Test {
27 protected: 27 protected:
28 void SetUp() override; 28 void SetUp() override;
29 29
30 void TearDown() override 30 void TearDown() override
31 { 31 {
32 ThreadState::current()-> collectAllGarbage(); 32 ThreadHeap::collectAllGarbage();
33 } 33 }
34 34
35 Document& document() const { return m_dummyPageHolder->document(); } 35 Document& document() const { return m_dummyPageHolder->document(); }
36 36
37 void setHtmlInnerHTML(const String&); 37 void setHtmlInnerHTML(const String&);
38 38
39 private: 39 private:
40 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; 40 std::unique_ptr<DummyPageHolder> m_dummyPageHolder;
41 }; 41 };
42 42
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 ); 144 );
145 WebDistillabilityFeatures features = DocumentStatisticsCollector::collectSta tistics(document()); 145 WebDistillabilityFeatures features = DocumentStatisticsCollector::collectSta tistics(document());
146 146
147 double error = 1e-5; 147 double error = 1e-5;
148 EXPECT_NEAR(features.mozScore, 6 * sqrt(kTextContentLengthSaturation - kPara graphLengthThreshold), error); 148 EXPECT_NEAR(features.mozScore, 6 * sqrt(kTextContentLengthSaturation - kPara graphLengthThreshold), error);
149 EXPECT_NEAR(features.mozScoreAllSqrt, 6 * sqrt(kTextContentLengthSaturation) , error); 149 EXPECT_NEAR(features.mozScoreAllSqrt, 6 * sqrt(kTextContentLengthSaturation) , error);
150 EXPECT_NEAR(features.mozScoreAllLinear, 6 * kTextContentLengthSaturation, er ror); 150 EXPECT_NEAR(features.mozScoreAllLinear, 6 * kTextContentLengthSaturation, er ror);
151 } 151 }
152 152
153 } // namespace blink 153 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp ('k') | third_party/WebKit/Source/core/dom/DocumentTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698