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 // Note that although this is not a "browser" test, it runs as part of | 5 // Note that although this is not a "browser" test, it runs as part of |
6 // browser_tests. This is because WebKit does not work properly if it is | 6 // browser_tests. This is because WebKit does not work properly if it is |
7 // shutdown and re-initialized. Since browser_tests runs each test in a | 7 // shutdown and re-initialized. Since browser_tests runs each test in a |
8 // new process, this avoids the problem. | 8 // new process, this avoids the problem. |
9 | 9 |
10 #include "chrome/renderer/safe_browsing/phishing_dom_feature_extractor.h" | 10 #include "chrome/renderer/safe_browsing/phishing_dom_feature_extractor.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 std::map<std::string, std::string>::const_iterator it = | 151 std::map<std::string, std::string>::const_iterator it = |
152 responses_.find(url); | 152 responses_.find(url); |
153 if (it == responses_.end()) | 153 if (it == responses_.end()) |
154 return scoped_ptr<net::test_server::HttpResponse>(); | 154 return scoped_ptr<net::test_server::HttpResponse>(); |
155 | 155 |
156 scoped_ptr<net::test_server::BasicHttpResponse> http_response( | 156 scoped_ptr<net::test_server::BasicHttpResponse> http_response( |
157 new net::test_server::BasicHttpResponse()); | 157 new net::test_server::BasicHttpResponse()); |
158 http_response->set_code(net::HTTP_OK); | 158 http_response->set_code(net::HTTP_OK); |
159 http_response->set_content_type("text/html"); | 159 http_response->set_content_type("text/html"); |
160 http_response->set_content(it->second); | 160 http_response->set_content(it->second); |
161 return http_response.PassAs<net::test_server::HttpResponse>(); | 161 return http_response.Pass(); |
162 } | 162 } |
163 | 163 |
164 GURL GetURL(const std::string& host, const std::string& path) { | 164 GURL GetURL(const std::string& host, const std::string& path) { |
165 GURL::Replacements replace; | 165 GURL::Replacements replace; |
166 replace.SetHostStr(host); | 166 replace.SetHostStr(host); |
167 replace.SetPathStr(path); | 167 replace.SetPathStr(path); |
168 return embedded_test_server_->base_url().ReplaceComponents(replace); | 168 return embedded_test_server_->base_url().ReplaceComponents(replace); |
169 } | 169 } |
170 | 170 |
171 // Returns the URL that was loaded. | 171 // Returns the URL that was loaded. |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 LoadHtml( | 514 LoadHtml( |
515 "host.com", | 515 "host.com", |
516 "<html><head></head><body>" | 516 "<html><head></head><body>" |
517 "<iframe src=\"frame.html\" id=\"frame1\"></iframe>" | 517 "<iframe src=\"frame.html\" id=\"frame1\"></iframe>" |
518 "<form></form></body></html>"); | 518 "<form></form></body></html>"); |
519 ASSERT_TRUE(ExtractFeatures(&features)); | 519 ASSERT_TRUE(ExtractFeatures(&features)); |
520 ExpectFeatureMapsAreEqual(features, expected_features); | 520 ExpectFeatureMapsAreEqual(features, expected_features); |
521 } | 521 } |
522 | 522 |
523 } // namespace safe_browsing | 523 } // namespace safe_browsing |
OLD | NEW |