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/phishing_term_feature_extractor.h" | 5 #include "chrome/renderer/safe_browsing/phishing_term_feature_extractor.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 using base::ASCIIToUTF16; | 26 using base::ASCIIToUTF16; |
27 using ::testing::Return; | 27 using ::testing::Return; |
28 | 28 |
29 | 29 |
30 static const uint32 kMurmurHash3Seed = 2777808611U; | 30 static const uint32 kMurmurHash3Seed = 2777808611U; |
31 | 31 |
32 namespace safe_browsing { | 32 namespace safe_browsing { |
33 | 33 |
34 class PhishingTermFeatureExtractorTest : public ::testing::Test { | 34 class PhishingTermFeatureExtractorTest : public ::testing::Test { |
35 protected: | 35 protected: |
36 virtual void SetUp() { | 36 void SetUp() override { |
37 base::hash_set<std::string> terms; | 37 base::hash_set<std::string> terms; |
38 terms.insert("one"); | 38 terms.insert("one"); |
39 terms.insert("one one"); | 39 terms.insert("one one"); |
40 terms.insert("two"); | 40 terms.insert("two"); |
41 terms.insert("multi word test"); | 41 terms.insert("multi word test"); |
42 terms.insert("capitalization"); | 42 terms.insert("capitalization"); |
43 terms.insert("space"); | 43 terms.insert("space"); |
44 terms.insert("separator"); | 44 terms.insert("separator"); |
45 terms.insert("punctuation"); | 45 terms.insert("punctuation"); |
46 // Chinese (translation of "hello") | 46 // Chinese (translation of "hello") |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // Now extract normally and make sure nothing breaks. | 455 // Now extract normally and make sure nothing breaks. |
456 EXPECT_TRUE(ExtractFeatures(page_text.get(), &features, &shingle_hashes)); | 456 EXPECT_TRUE(ExtractFeatures(page_text.get(), &features, &shingle_hashes)); |
457 | 457 |
458 FeatureMap expected_features; | 458 FeatureMap expected_features; |
459 expected_features.AddBooleanFeature(features::kPageTerm + | 459 expected_features.AddBooleanFeature(features::kPageTerm + |
460 std::string("multi word test")); | 460 std::string("multi word test")); |
461 ExpectFeatureMapsAreEqual(features, expected_features); | 461 ExpectFeatureMapsAreEqual(features, expected_features); |
462 } | 462 } |
463 | 463 |
464 } // namespace safe_browsing | 464 } // namespace safe_browsing |
OLD | NEW |