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 #include <utility> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 embedded_test_server()->base_url().ReplaceComponents(replace_host)); | 193 embedded_test_server()->base_url().ReplaceComponents(replace_host)); |
193 } | 194 } |
194 | 195 |
195 scoped_ptr<net::test_server::HttpResponse> | 196 scoped_ptr<net::test_server::HttpResponse> |
196 HandleRequest(const net::test_server::HttpRequest& request) { | 197 HandleRequest(const net::test_server::HttpRequest& request) { |
197 scoped_ptr<net::test_server::BasicHttpResponse> http_response( | 198 scoped_ptr<net::test_server::BasicHttpResponse> http_response( |
198 new net::test_server::BasicHttpResponse()); | 199 new net::test_server::BasicHttpResponse()); |
199 http_response->set_code(net::HTTP_OK); | 200 http_response->set_code(net::HTTP_OK); |
200 http_response->set_content_type("text/html"); | 201 http_response->set_content_type("text/html"); |
201 http_response->set_content(response_content_); | 202 http_response->set_content(response_content_); |
202 return http_response.Pass(); | 203 return std::move(http_response); |
203 } | 204 } |
204 | 205 |
205 std::string response_content_; | 206 std::string response_content_; |
206 scoped_ptr<Scorer> scorer_; | 207 scoped_ptr<Scorer> scorer_; |
207 scoped_ptr<PhishingClassifier> classifier_; | 208 scoped_ptr<PhishingClassifier> classifier_; |
208 MockFeatureExtractorClock* clock_; // Owned by classifier_. | 209 MockFeatureExtractorClock* clock_; // Owned by classifier_. |
209 | 210 |
210 // Features that are in the model. | 211 // Features that are in the model. |
211 const std::string url_tld_token_net_; | 212 const std::string url_tld_token_net_; |
212 const std::string page_link_domain_phishing_; | 213 const std::string page_link_domain_phishing_; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 #endif | 352 #endif |
352 IN_PROC_BROWSER_TEST_F(PhishingClassifierTest, MAYBE_DisableDetection) { | 353 IN_PROC_BROWSER_TEST_F(PhishingClassifierTest, MAYBE_DisableDetection) { |
353 EXPECT_TRUE(classifier_->is_ready()); | 354 EXPECT_TRUE(classifier_->is_ready()); |
354 | 355 |
355 // Set a NULL scorer, which turns detection back off. | 356 // Set a NULL scorer, which turns detection back off. |
356 classifier_->set_phishing_scorer(NULL); | 357 classifier_->set_phishing_scorer(NULL); |
357 EXPECT_FALSE(classifier_->is_ready()); | 358 EXPECT_FALSE(classifier_->is_ready()); |
358 } | 359 } |
359 | 360 |
360 } // namespace safe_browsing | 361 } // namespace safe_browsing |
OLD | NEW |