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_delegate.h" | 5 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 std::string url = | 208 std::string url = |
209 std::string("http://") + host_it->second + request.relative_url; | 209 std::string("http://") + host_it->second + request.relative_url; |
210 if (response_url_.spec() != url) | 210 if (response_url_.spec() != url) |
211 return scoped_ptr<net::test_server::HttpResponse>(); | 211 return scoped_ptr<net::test_server::HttpResponse>(); |
212 | 212 |
213 scoped_ptr<net::test_server::BasicHttpResponse> http_response( | 213 scoped_ptr<net::test_server::BasicHttpResponse> http_response( |
214 new net::test_server::BasicHttpResponse()); | 214 new net::test_server::BasicHttpResponse()); |
215 http_response->set_code(net::HTTP_OK); | 215 http_response->set_code(net::HTTP_OK); |
216 http_response->set_content_type("text/html"); | 216 http_response->set_content_type("text/html"); |
217 http_response->set_content(response_content_); | 217 http_response->set_content(response_content_); |
218 return http_response.PassAs<net::test_server::HttpResponse>(); | 218 return http_response.Pass(); |
219 } | 219 } |
220 | 220 |
221 content::WebContents* GetWebContents() { | 221 content::WebContents* GetWebContents() { |
222 return browser()->tab_strip_model()->GetActiveWebContents(); | 222 return browser()->tab_strip_model()->GetActiveWebContents(); |
223 } | 223 } |
224 | 224 |
225 // Returns the URL that was loaded. | 225 // Returns the URL that was loaded. |
226 GURL LoadHtml(const std::string& host, const std::string& content) { | 226 GURL LoadHtml(const std::string& host, const std::string& content) { |
227 GURL::Replacements replace_host; | 227 GURL::Replacements replace_host; |
228 replace_host.SetHostStr(host); | 228 replace_host.SetHostStr(host); |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 RunClassificationDone(verdict); | 633 RunClassificationDone(verdict); |
634 ASSERT_TRUE(intercepting_filter_->verdict()); | 634 ASSERT_TRUE(intercepting_filter_->verdict()); |
635 EXPECT_EQ(verdict.SerializeAsString(), | 635 EXPECT_EQ(verdict.SerializeAsString(), |
636 intercepting_filter_->verdict()->SerializeAsString()); | 636 intercepting_filter_->verdict()->SerializeAsString()); |
637 | 637 |
638 // The delegate will cancel pending classification on destruction. | 638 // The delegate will cancel pending classification on destruction. |
639 EXPECT_CALL(*classifier_, CancelPendingClassification()); | 639 EXPECT_CALL(*classifier_, CancelPendingClassification()); |
640 } | 640 } |
641 | 641 |
642 } // namespace safe_browsing | 642 } // namespace safe_browsing |
OLD | NEW |