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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 : url_tld_token_net_(features::kUrlTldToken + std::string("net")), | 48 : url_tld_token_net_(features::kUrlTldToken + std::string("net")), |
49 page_link_domain_phishing_(features::kPageLinkDomain + | 49 page_link_domain_phishing_(features::kPageLinkDomain + |
50 std::string("phishing.com")), | 50 std::string("phishing.com")), |
51 page_term_login_(features::kPageTerm + std::string("login")) { | 51 page_term_login_(features::kPageTerm + std::string("login")) { |
52 } | 52 } |
53 | 53 |
54 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 54 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
55 command_line->AppendSwitch(switches::kSingleProcess); | 55 command_line->AppendSwitch(switches::kSingleProcess); |
56 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
57 // Don't want to try to create a GPU process. | 57 // Don't want to try to create a GPU process. |
58 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); | 58 command_line->AppendSwitch(switches::kDisableGpu); |
59 #endif | 59 #endif |
60 } | 60 } |
61 | 61 |
62 virtual void SetUpOnMainThread() OVERRIDE { | 62 virtual void SetUpOnMainThread() OVERRIDE { |
63 // Construct a model to test with. We include one feature from each of | 63 // Construct a model to test with. We include one feature from each of |
64 // the feature extractors, which allows us to verify that they all ran. | 64 // the feature extractors, which allows us to verify that they all ran. |
65 ClientSideModel model; | 65 ClientSideModel model; |
66 | 66 |
67 model.add_hashes(crypto::SHA256HashString(url_tld_token_net_)); | 67 model.add_hashes(crypto::SHA256HashString(url_tld_token_net_)); |
68 model.add_hashes(crypto::SHA256HashString(page_link_domain_phishing_)); | 68 model.add_hashes(crypto::SHA256HashString(page_link_domain_phishing_)); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // Now set the scorer. | 288 // Now set the scorer. |
289 classifier_->set_phishing_scorer(scorer_.get()); | 289 classifier_->set_phishing_scorer(scorer_.get()); |
290 EXPECT_TRUE(classifier_->is_ready()); | 290 EXPECT_TRUE(classifier_->is_ready()); |
291 | 291 |
292 // Set a NULL scorer, which turns detection back off. | 292 // Set a NULL scorer, which turns detection back off. |
293 classifier_->set_phishing_scorer(NULL); | 293 classifier_->set_phishing_scorer(NULL); |
294 EXPECT_FALSE(classifier_->is_ready()); | 294 EXPECT_FALSE(classifier_->is_ready()); |
295 } | 295 } |
296 | 296 |
297 } // namespace safe_browsing | 297 } // namespace safe_browsing |
OLD | NEW |