| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> |
| 9 |
| 8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 9 #include "base/location.h" | 11 #include "base/location.h" |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 13 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 14 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 16 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 17 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 std::string url = | 203 std::string url = |
| 202 std::string("http://") + host_it->second + request.relative_url; | 204 std::string("http://") + host_it->second + request.relative_url; |
| 203 if (response_url_.spec() != url) | 205 if (response_url_.spec() != url) |
| 204 return scoped_ptr<net::test_server::HttpResponse>(); | 206 return scoped_ptr<net::test_server::HttpResponse>(); |
| 205 | 207 |
| 206 scoped_ptr<net::test_server::BasicHttpResponse> http_response( | 208 scoped_ptr<net::test_server::BasicHttpResponse> http_response( |
| 207 new net::test_server::BasicHttpResponse()); | 209 new net::test_server::BasicHttpResponse()); |
| 208 http_response->set_code(net::HTTP_OK); | 210 http_response->set_code(net::HTTP_OK); |
| 209 http_response->set_content_type("text/html"); | 211 http_response->set_content_type("text/html"); |
| 210 http_response->set_content(response_content_); | 212 http_response->set_content(response_content_); |
| 211 return http_response.Pass(); | 213 return std::move(http_response); |
| 212 } | 214 } |
| 213 | 215 |
| 214 content::WebContents* GetWebContents() { | 216 content::WebContents* GetWebContents() { |
| 215 return browser()->tab_strip_model()->GetActiveWebContents(); | 217 return browser()->tab_strip_model()->GetActiveWebContents(); |
| 216 } | 218 } |
| 217 | 219 |
| 218 content::RenderFrame* GetRenderFrame() { | 220 content::RenderFrame* GetRenderFrame() { |
| 219 int render_frame_routing_id = | 221 int render_frame_routing_id = |
| 220 GetWebContents()->GetMainFrame()->GetRoutingID(); | 222 GetWebContents()->GetMainFrame()->GetRoutingID(); |
| 221 content::RenderFrame* render_frame = | 223 content::RenderFrame* render_frame = |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 RunClassificationDone(verdict); | 636 RunClassificationDone(verdict); |
| 635 ASSERT_TRUE(intercepting_filter_->verdict()); | 637 ASSERT_TRUE(intercepting_filter_->verdict()); |
| 636 EXPECT_EQ(verdict.SerializeAsString(), | 638 EXPECT_EQ(verdict.SerializeAsString(), |
| 637 intercepting_filter_->verdict()->SerializeAsString()); | 639 intercepting_filter_->verdict()->SerializeAsString()); |
| 638 | 640 |
| 639 // The delegate will cancel pending classification on destruction. | 641 // The delegate will cancel pending classification on destruction. |
| 640 EXPECT_CALL(*classifier_, CancelPendingClassification()); | 642 EXPECT_CALL(*classifier_, CancelPendingClassification()); |
| 641 } | 643 } |
| 642 | 644 |
| 643 } // namespace safe_browsing | 645 } // namespace safe_browsing |
| OLD | NEW |