Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(534)

Side by Side Diff: chrome/browser/safe_browsing/malware_details_unittest.cc

Issue 6720050: Make contents settable in RVHTH. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 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 "chrome/browser/safe_browsing/malware_details.h" 7 #include "chrome/browser/safe_browsing/malware_details.h"
8 #include "chrome/browser/safe_browsing/report.pb.h" 8 #include "chrome/browser/safe_browsing/report.pb.h"
9 #include "chrome/common/safebrowsing_messages.h" 9 #include "chrome/common/safebrowsing_messages.h"
10 #include "content/browser/browser_thread.h" 10 #include "content/browser/browser_thread.h"
11 #include "content/browser/renderer_host/test_render_view_host.h" 11 #include "content/browser/renderer_host/test_render_view_host.h"
(...skipping 29 matching lines...) Expand all
41 } 41 }
42 42
43 protected: 43 protected:
44 void InitResource(SafeBrowsingService::UnsafeResource* resource, 44 void InitResource(SafeBrowsingService::UnsafeResource* resource,
45 ResourceType::Type resource_type, 45 ResourceType::Type resource_type,
46 const GURL& url) { 46 const GURL& url) {
47 resource->client = NULL; 47 resource->client = NULL;
48 resource->url = url; 48 resource->url = url;
49 resource->resource_type = resource_type; 49 resource->resource_type = resource_type;
50 resource->threat_type = SafeBrowsingService::URL_MALWARE; 50 resource->threat_type = SafeBrowsingService::URL_MALWARE;
51 resource->render_process_host_id = contents_->GetRenderProcessHost()->id(); 51 resource->render_process_host_id = contents()->GetRenderProcessHost()->id();
52 resource->render_view_id = contents_->render_view_host()->routing_id(); 52 resource->render_view_id = contents()->render_view_host()->routing_id();
53 } 53 }
54 54
55 void VerifyResults(const ClientMalwareReportRequest& report_pb, 55 void VerifyResults(const ClientMalwareReportRequest& report_pb,
56 const ClientMalwareReportRequest& expected_pb) { 56 const ClientMalwareReportRequest& expected_pb) {
57 EXPECT_EQ(expected_pb.malware_url(), report_pb.malware_url()); 57 EXPECT_EQ(expected_pb.malware_url(), report_pb.malware_url());
58 EXPECT_EQ(expected_pb.page_url(), report_pb.page_url()); 58 EXPECT_EQ(expected_pb.page_url(), report_pb.page_url());
59 EXPECT_EQ(expected_pb.referrer_url(), report_pb.referrer_url()); 59 EXPECT_EQ(expected_pb.referrer_url(), report_pb.referrer_url());
60 60
61 ASSERT_EQ(expected_pb.resources_size(), report_pb.resources_size()); 61 ASSERT_EQ(expected_pb.resources_size(), report_pb.resources_size());
62 // Sort the resources, to make the test deterministic 62 // Sort the resources, to make the test deterministic
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 pb_resource->set_url(kFirstRedirectURL); 283 pb_resource->set_url(kFirstRedirectURL);
284 pb_resource->set_parent_id(1); 284 pb_resource->set_parent_id(1);
285 285
286 pb_resource = expected.add_resources(); 286 pb_resource = expected.add_resources();
287 pb_resource->set_id(4); 287 pb_resource->set_id(4);
288 pb_resource->set_url(kSecondRedirectURL); 288 pb_resource->set_url(kSecondRedirectURL);
289 pb_resource->set_parent_id(3); 289 pb_resource->set_parent_id(3);
290 290
291 VerifyResults(actual, expected); 291 VerifyResults(actual, expected);
292 } 292 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698