| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/renderer/safe_browsing/features.h" | 5 #include "components/safe_browsing/renderer/features.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "chrome/renderer/safe_browsing/test_utils.h" | 11 #include "components/safe_browsing/renderer/test_utils.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace safe_browsing { | 14 namespace safe_browsing { |
| 15 | 15 |
| 16 TEST(PhishingFeaturesTest, TooManyFeatures) { | 16 TEST(PhishingFeaturesTest, TooManyFeatures) { |
| 17 FeatureMap features; | 17 FeatureMap features; |
| 18 for (size_t i = 0; i < FeatureMap::kMaxFeatureMapSize; ++i) { | 18 for (size_t i = 0; i < FeatureMap::kMaxFeatureMapSize; ++i) { |
| 19 EXPECT_TRUE(features.AddBooleanFeature( | 19 EXPECT_TRUE(features.AddBooleanFeature( |
| 20 base::StringPrintf("Feature%" PRIuS, i))); | 20 base::StringPrintf("Feature%" PRIuS, i))); |
| 21 } | 21 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 EXPECT_FALSE(features.AddRealFeature("toolarge", 1.1)); | 38 EXPECT_FALSE(features.AddRealFeature("toolarge", 1.1)); |
| 39 | 39 |
| 40 FeatureMap expected_features; | 40 FeatureMap expected_features; |
| 41 expected_features.AddRealFeature("zero", 0.0); | 41 expected_features.AddRealFeature("zero", 0.0); |
| 42 expected_features.AddRealFeature("pointfive", 0.5); | 42 expected_features.AddRealFeature("pointfive", 0.5); |
| 43 expected_features.AddRealFeature("one", 1.0); | 43 expected_features.AddRealFeature("one", 1.0); |
| 44 ExpectFeatureMapsAreEqual(features, expected_features); | 44 ExpectFeatureMapsAreEqual(features, expected_features); |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // namespace safe_browsing | 47 } // namespace safe_browsing |
| OLD | NEW |