| 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 <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" |
| 11 #include "chrome/browser/history/history_backend.h" | 11 #include "chrome/browser/history/history_backend.h" |
| 12 #include "chrome/browser/history/history_service_factory.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/safe_browsing/malware_details.h" | 14 #include "chrome/browser/safe_browsing/malware_details.h" |
| 14 #include "chrome/browser/safe_browsing/malware_details_history.h" | 15 #include "chrome/browser/safe_browsing/malware_details_history.h" |
| 15 #include "chrome/browser/safe_browsing/report.pb.h" | 16 #include "chrome/browser/safe_browsing/report.pb.h" |
| 16 #include "chrome/common/render_messages.h" | 17 #include "chrome/common/render_messages.h" |
| 17 #include "chrome/common/safe_browsing/safebrowsing_messages.h" | 18 #include "chrome/common/safe_browsing/safebrowsing_messages.h" |
| 18 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 19 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 19 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
| 20 #include "content/public/browser/render_process_host.h" | 21 #include "content/public/browser/render_process_host.h" |
| 21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 BrowserThread::IO, | 203 BrowserThread::IO, |
| 203 FROM_HERE, | 204 FROM_HERE, |
| 204 base::Bind(&MalwareDetails::FinishCollection, report)); | 205 base::Bind(&MalwareDetails::FinishCollection, report)); |
| 205 // Wait for the callback (SendSerializedMalwareDetails). | 206 // Wait for the callback (SendSerializedMalwareDetails). |
| 206 DVLOG(1) << "Waiting for SendSerializedMalwareDetails"; | 207 DVLOG(1) << "Waiting for SendSerializedMalwareDetails"; |
| 207 MessageLoop::current()->Run(); | 208 MessageLoop::current()->Run(); |
| 208 return sb_service_->GetSerialized(); | 209 return sb_service_->GetSerialized(); |
| 209 } | 210 } |
| 210 | 211 |
| 211 HistoryService* history_service() { | 212 HistoryService* history_service() { |
| 212 return profile()->GetHistoryService(Profile::EXPLICIT_ACCESS); | 213 return HistoryServiceFactory::GetForProfile(profile(), |
| 214 Profile::EXPLICIT_ACCESS); |
| 213 } | 215 } |
| 214 | 216 |
| 215 protected: | 217 protected: |
| 216 void InitResource(SafeBrowsingService::UnsafeResource* resource, | 218 void InitResource(SafeBrowsingService::UnsafeResource* resource, |
| 217 bool is_subresource, | 219 bool is_subresource, |
| 218 const GURL& url) { | 220 const GURL& url) { |
| 219 resource->url = url; | 221 resource->url = url; |
| 220 resource->is_subresource = is_subresource; | 222 resource->is_subresource = is_subresource; |
| 221 resource->threat_type = SafeBrowsingService::URL_MALWARE; | 223 resource->threat_type = SafeBrowsingService::URL_MALWARE; |
| 222 resource->render_process_host_id = contents()->GetRenderProcessHost()-> | 224 resource->render_process_host_id = contents()->GetRenderProcessHost()-> |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 pb_resource = expected.add_resources(); | 683 pb_resource = expected.add_resources(); |
| 682 pb_resource->set_id(2); | 684 pb_resource->set_id(2); |
| 683 pb_resource->set_parent_id(3); | 685 pb_resource->set_parent_id(3); |
| 684 pb_resource->set_url(kSecondRedirectURL); | 686 pb_resource->set_url(kSecondRedirectURL); |
| 685 pb_resource = expected.add_resources(); | 687 pb_resource = expected.add_resources(); |
| 686 pb_resource->set_id(3); | 688 pb_resource->set_id(3); |
| 687 pb_resource->set_url(kFirstRedirectURL); | 689 pb_resource->set_url(kFirstRedirectURL); |
| 688 | 690 |
| 689 VerifyResults(actual, expected); | 691 VerifyResults(actual, expected); |
| 690 } | 692 } |
| OLD | NEW |