| Index: chrome/renderer/safe_browsing/features_unittest.cc
|
| diff --git a/chrome/renderer/safe_browsing/features_unittest.cc b/chrome/renderer/safe_browsing/features_unittest.cc
|
| index ad07ba29c2713920bba0716058294b9276648fdb..ac5cb555e16028b2a01f4f5b90dd718b8951cf23 100644
|
| --- a/chrome/renderer/safe_browsing/features_unittest.cc
|
| +++ b/chrome/renderer/safe_browsing/features_unittest.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "base/format_macros.h"
|
| #include "base/string_util.h"
|
| +#include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace safe_browsing {
|
| @@ -24,4 +25,20 @@ TEST(PhishingFeaturesTest, TooManyFeatures) {
|
| EXPECT_EQ(FeatureMap::kMaxFeatureMapSize, features.features().size());
|
| }
|
|
|
| +TEST(PhishingFeaturesTest, IllegalFeatureValue) {
|
| + FeatureMap features;
|
| + EXPECT_FALSE(features.AddRealFeature("toosmall", -0.1));
|
| + EXPECT_TRUE(features.AddRealFeature("zero", 0.0));
|
| + EXPECT_TRUE(features.AddRealFeature("pointfive", 0.5));
|
| + EXPECT_TRUE(features.AddRealFeature("one", 1.0));
|
| + EXPECT_FALSE(features.AddRealFeature("toolarge", 1.1));
|
| +
|
| + FeatureMap expected_features;
|
| + expected_features.AddRealFeature("zero", 0.0);
|
| + expected_features.AddRealFeature("pointfive", 0.5);
|
| + expected_features.AddRealFeature("one", 1.0);
|
| + EXPECT_THAT(features.features(),
|
| + ::testing::ContainerEq(expected_features.features()));
|
| +}
|
| +
|
| } // namespace safe_browsing
|
|
|