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

Unified Diff: components/dom_distiller/core/distillable_page_detector_unittest.cc

Issue 1047223003: Add integration of the new heuristics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dd-adaboost-model
Patch Set: whitelist resources for ios Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/core/distillable_page_detector_unittest.cc
diff --git a/components/dom_distiller/core/distillable_page_detector_unittest.cc b/components/dom_distiller/core/distillable_page_detector_unittest.cc
index 6580fcd22092f6f2602509497d3e3654c703bc96..835f8ea6096be503d65b11e7f377587043f09692 100644
--- a/components/dom_distiller/core/distillable_page_detector_unittest.cc
+++ b/components/dom_distiller/core/distillable_page_detector_unittest.cc
@@ -91,6 +91,18 @@ TEST(DomDistillerDistillablePageDetectorTest, TestScoreAndClassify) {
EXPECT_TRUE(detector->Classify(features));
}
+TEST(DomDistillerDistillablePageDetectorTest, TestScoreWrongNumberFeatures) {
+ scoped_ptr<DistillablePageDetector> detector =
+ Builder().Stump(0, 1.0, 1.0).Stump(0, 1.4, 2.0).Build();
+ EXPECT_DOUBLE_EQ(1.5, detector->GetThreshold());
+
+ std::vector<double> features;
+ EXPECT_DOUBLE_EQ(0.0, detector->Score(features));
+ features.push_back(-3.0);
+ features.push_back(1.0);
+ EXPECT_DOUBLE_EQ(0.0, detector->Score(features));
+}
+
}

Powered by Google App Engine
This is Rietveld 408576698