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

Unified Diff: components/dom_distiller/core/page_features_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
« no previous file with comments | « components/dom_distiller/core/page_features.cc ('k') | components/resources/dom_distiller_resources.grdp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/dom_distiller/core/page_features_unittest.cc
diff --git a/components/dom_distiller/core/page_features_unittest.cc b/components/dom_distiller/core/page_features_unittest.cc
index a863afc5631b9edef038782866ee501567cfba54..413c55f7b4e8d3f1ba33da711277aced107a8884 100644
--- a/components/dom_distiller/core/page_features_unittest.cc
+++ b/components/dom_distiller/core/page_features_unittest.cc
@@ -9,6 +9,7 @@
#include "base/files/file_util.h"
#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -66,8 +67,14 @@ TEST(DomDistillerPageFeaturesTest, TestCalculateDerivedFeatures) {
base::DictionaryValue* core_features;
ASSERT_TRUE(input_entries->GetDictionary(i, &entry));
ASSERT_TRUE(entry->GetDictionary("features", &core_features));
+ // CalculateDerivedFeaturesFromJSON expects a base::Value of the stringified
+ // JSON (and not a base::Value of the JSON itself)
+ std::string stringified_json;
+ ASSERT_TRUE(base::JSONWriter::Write(core_features, &stringified_json));
+ scoped_ptr<base::Value> stringified_value(
+ new base::StringValue(stringified_json));
std::vector<double> derived(
- CalculateDerivedFeaturesFromJSON(core_features));
+ CalculateDerivedFeaturesFromJSON(stringified_value.get()));
ASSERT_EQ(labels.size(), derived.size());
ASSERT_TRUE(expected_output_entries->GetDictionary(i, &entry));
« no previous file with comments | « components/dom_distiller/core/page_features.cc ('k') | components/resources/dom_distiller_resources.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698