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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 embedded_test_server()->base_url().ReplaceComponents(replace_host)); | 186 embedded_test_server()->base_url().ReplaceComponents(replace_host)); |
187 } | 187 } |
188 | 188 |
189 scoped_ptr<net::test_server::HttpResponse> | 189 scoped_ptr<net::test_server::HttpResponse> |
190 HandleRequest(const net::test_server::HttpRequest& request) { | 190 HandleRequest(const net::test_server::HttpRequest& request) { |
191 scoped_ptr<net::test_server::BasicHttpResponse> http_response( | 191 scoped_ptr<net::test_server::BasicHttpResponse> http_response( |
192 new net::test_server::BasicHttpResponse()); | 192 new net::test_server::BasicHttpResponse()); |
193 http_response->set_code(net::HTTP_OK); | 193 http_response->set_code(net::HTTP_OK); |
194 http_response->set_content_type("text/html"); | 194 http_response->set_content_type("text/html"); |
195 http_response->set_content(response_content_); | 195 http_response->set_content(response_content_); |
196 return http_response.PassAs<net::test_server::HttpResponse>(); | 196 return http_response.Pass(); |
197 } | 197 } |
198 | 198 |
199 std::string response_content_; | 199 std::string response_content_; |
200 scoped_ptr<Scorer> scorer_; | 200 scoped_ptr<Scorer> scorer_; |
201 scoped_ptr<PhishingClassifier> classifier_; | 201 scoped_ptr<PhishingClassifier> classifier_; |
202 MockFeatureExtractorClock* clock_; // Owned by classifier_. | 202 MockFeatureExtractorClock* clock_; // Owned by classifier_. |
203 content::RoutingIDManglingDisabler mangling_disabler_; | 203 content::RoutingIDManglingDisabler mangling_disabler_; |
204 | 204 |
205 // Features that are in the model. | 205 // Features that are in the model. |
206 const std::string url_tld_token_net_; | 206 const std::string url_tld_token_net_; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // Now set the scorer. | 298 // Now set the scorer. |
299 classifier_->set_phishing_scorer(scorer_.get()); | 299 classifier_->set_phishing_scorer(scorer_.get()); |
300 EXPECT_TRUE(classifier_->is_ready()); | 300 EXPECT_TRUE(classifier_->is_ready()); |
301 | 301 |
302 // Set a NULL scorer, which turns detection back off. | 302 // Set a NULL scorer, which turns detection back off. |
303 classifier_->set_phishing_scorer(NULL); | 303 classifier_->set_phishing_scorer(NULL); |
304 EXPECT_FALSE(classifier_->is_ready()); | 304 EXPECT_FALSE(classifier_->is_ready()); |
305 } | 305 } |
306 | 306 |
307 } // namespace safe_browsing | 307 } // namespace safe_browsing |
OLD | NEW |