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

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

Issue 2241673002: Make UnsafeResource hold a WebContents getter instead of RenderFrame ids (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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
OLDNEW
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 228 }
229 229
230 protected: 230 protected:
231 void InitResource(UnsafeResource* resource, 231 void InitResource(UnsafeResource* resource,
232 SBThreatType threat_type, 232 SBThreatType threat_type,
233 bool is_subresource, 233 bool is_subresource,
234 const GURL& url) { 234 const GURL& url) {
235 resource->url = url; 235 resource->url = url;
236 resource->is_subresource = is_subresource; 236 resource->is_subresource = is_subresource;
237 resource->threat_type = threat_type; 237 resource->threat_type = threat_type;
238 resource->render_process_host_id = 238 resource->web_contents_getter =
239 web_contents()->GetRenderProcessHost()->GetID(); 239 SafeBrowsingUIManager::UnsafeResource::GetWebContentsGetter(
240 resource->render_frame_id = web_contents()->GetMainFrame()->GetRoutingID(); 240 web_contents()->GetRenderProcessHost()->GetID(),
241 web_contents()->GetMainFrame()->GetRoutingID());
241 } 242 }
242 243
243 void VerifyResults(const ClientSafeBrowsingReportRequest& report_pb, 244 void VerifyResults(const ClientSafeBrowsingReportRequest& report_pb,
244 const ClientSafeBrowsingReportRequest& expected_pb) { 245 const ClientSafeBrowsingReportRequest& expected_pb) {
245 EXPECT_EQ(expected_pb.type(), report_pb.type()); 246 EXPECT_EQ(expected_pb.type(), report_pb.type());
246 EXPECT_EQ(expected_pb.url(), report_pb.url()); 247 EXPECT_EQ(expected_pb.url(), report_pb.url());
247 EXPECT_EQ(expected_pb.page_url(), report_pb.page_url()); 248 EXPECT_EQ(expected_pb.page_url(), report_pb.page_url());
248 EXPECT_EQ(expected_pb.referrer_url(), report_pb.referrer_url()); 249 EXPECT_EQ(expected_pb.referrer_url(), report_pb.referrer_url());
249 EXPECT_EQ(expected_pb.did_proceed(), report_pb.did_proceed()); 250 EXPECT_EQ(expected_pb.did_proceed(), report_pb.did_proceed());
250 EXPECT_EQ(expected_pb.has_repeat_visit(), report_pb.has_repeat_visit()); 251 EXPECT_EQ(expected_pb.has_repeat_visit(), report_pb.has_repeat_visit());
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 pb_resource->set_parent_id(3); 885 pb_resource->set_parent_id(3);
885 pb_resource->set_url(kSecondRedirectURL); 886 pb_resource->set_url(kSecondRedirectURL);
886 pb_resource = expected.add_resources(); 887 pb_resource = expected.add_resources();
887 pb_resource->set_id(3); 888 pb_resource->set_id(3);
888 pb_resource->set_url(kFirstRedirectURL); 889 pb_resource->set_url(kFirstRedirectURL);
889 890
890 VerifyResults(actual, expected); 891 VerifyResults(actual, expected);
891 } 892 }
892 893
893 } // namespace safe_browsing 894 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc ('k') | chrome/browser/safe_browsing/ui_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698