| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 static const char* kMalwareData = "exploit();"; | 45 static const char* kMalwareData = "exploit();"; |
| 46 | 46 |
| 47 static const char* kLandingURL = "http://www.landingpage.com/"; | 47 static const char* kLandingURL = "http://www.landingpage.com/"; |
| 48 static const char* kLandingHeaders = | 48 static const char* kLandingHeaders = |
| 49 "HTTP/1.1 200 OK\n" | 49 "HTTP/1.1 200 OK\n" |
| 50 "Content-Type: text/html\n" | 50 "Content-Type: text/html\n" |
| 51 "Content-Length: 1024\n" | 51 "Content-Length: 1024\n" |
| 52 "Set-Cookie: tastycookie\n"; // This header is stripped. | 52 "Set-Cookie: tastycookie\n"; // This header is stripped. |
| 53 static const char* kLandingData = "<iframe src='http://www.malware.com'>"; | 53 static const char* kLandingData = "<iframe src='http://www.malware.com'>"; |
| 54 | 54 |
| 55 using content::BrowserThread; |
| 55 using safe_browsing::ClientMalwareReportRequest; | 56 using safe_browsing::ClientMalwareReportRequest; |
| 56 | 57 |
| 57 namespace { | 58 namespace { |
| 58 | 59 |
| 59 void WriteHeaders(disk_cache::Entry* entry, const std::string headers) { | 60 void WriteHeaders(disk_cache::Entry* entry, const std::string headers) { |
| 60 net::HttpResponseInfo responseinfo; | 61 net::HttpResponseInfo responseinfo; |
| 61 std::string raw_headers = net::HttpUtil::AssembleRawHeaders( | 62 std::string raw_headers = net::HttpUtil::AssembleRawHeaders( |
| 62 headers.c_str(), headers.size()); | 63 headers.c_str(), headers.size()); |
| 63 responseinfo.socket_address = net::HostPortPair("1.2.3.4", 80); | 64 responseinfo.socket_address = net::HostPortPair("1.2.3.4", 80); |
| 64 responseinfo.headers = new net::HttpResponseHeaders(raw_headers); | 65 responseinfo.headers = new net::HttpResponseHeaders(raw_headers); |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 pb_resource = expected.add_resources(); | 679 pb_resource = expected.add_resources(); |
| 679 pb_resource->set_id(2); | 680 pb_resource->set_id(2); |
| 680 pb_resource->set_parent_id(3); | 681 pb_resource->set_parent_id(3); |
| 681 pb_resource->set_url(kSecondRedirectURL); | 682 pb_resource->set_url(kSecondRedirectURL); |
| 682 pb_resource = expected.add_resources(); | 683 pb_resource = expected.add_resources(); |
| 683 pb_resource->set_id(3); | 684 pb_resource->set_id(3); |
| 684 pb_resource->set_url(kFirstRedirectURL); | 685 pb_resource->set_url(kFirstRedirectURL); |
| 685 | 686 |
| 686 VerifyResults(actual, expected); | 687 VerifyResults(actual, expected); |
| 687 } | 688 } |
| OLD | NEW |