Chromium Code Reviews| 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_classifier.h" | 5 #include "chrome/renderer/safe_browsing/phishing_classifier.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 rule = model.add_rule(); | 86 rule = model.add_rule(); |
| 87 rule->add_feature(0); | 87 rule->add_feature(0); |
| 88 rule->add_feature(1); | 88 rule->add_feature(1); |
| 89 rule->add_feature(2); | 89 rule->add_feature(2); |
| 90 rule->set_weight(1.0); | 90 rule->set_weight(1.0); |
| 91 | 91 |
| 92 model.add_page_term(3); | 92 model.add_page_term(3); |
| 93 model.set_murmur_hash_seed(2777808611U); | 93 model.set_murmur_hash_seed(2777808611U); |
| 94 model.add_page_word(MurmurHash3String("login", model.murmur_hash_seed())); | 94 model.add_page_word(MurmurHash3String("login", model.murmur_hash_seed())); |
| 95 model.set_max_words_per_term(1); | 95 model.set_max_words_per_term(1); |
| 96 model.set_max_shingles_per_page(200); | |
|
noelutz
2014/05/06 21:40:18
Is this necessary since you're setting these as de
zysxqn
2014/05/07 19:29:19
Prefer to set a non-default value than removing it
| |
| 97 model.set_shingle_size(4); | |
| 96 | 98 |
| 97 clock_ = new MockFeatureExtractorClock; | 99 clock_ = new MockFeatureExtractorClock; |
| 98 scorer_.reset(Scorer::Create(model.SerializeAsString())); | 100 scorer_.reset(Scorer::Create(model.SerializeAsString())); |
| 99 ASSERT_TRUE(scorer_.get()); | 101 ASSERT_TRUE(scorer_.get()); |
| 100 | 102 |
| 101 classifier_.reset(new PhishingClassifier( | 103 classifier_.reset(new PhishingClassifier( |
| 102 content::RenderView::FromRoutingID(kRenderViewRoutingId), | 104 content::RenderView::FromRoutingID(kRenderViewRoutingId), |
| 103 clock_)); | 105 clock_)); |
| 104 } | 106 } |
| 105 | 107 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 288 // Now set the scorer. | 290 // Now set the scorer. |
| 289 classifier_->set_phishing_scorer(scorer_.get()); | 291 classifier_->set_phishing_scorer(scorer_.get()); |
| 290 EXPECT_TRUE(classifier_->is_ready()); | 292 EXPECT_TRUE(classifier_->is_ready()); |
| 291 | 293 |
| 292 // Set a NULL scorer, which turns detection back off. | 294 // Set a NULL scorer, which turns detection back off. |
| 293 classifier_->set_phishing_scorer(NULL); | 295 classifier_->set_phishing_scorer(NULL); |
| 294 EXPECT_FALSE(classifier_->is_ready()); | 296 EXPECT_FALSE(classifier_->is_ready()); |
| 295 } | 297 } |
| 296 | 298 |
| 297 } // namespace safe_browsing | 299 } // namespace safe_browsing |
| OLD | NEW |