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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page_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 <list> 5 #include <list>
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" 9 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
10 #include "chrome/browser/safe_browsing/test_safe_browsing_service.h" 10 #include "chrome/browser/safe_browsing/test_safe_browsing_service.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 bool is_subresource, 210 bool is_subresource,
211 const GURL& url) { 211 const GURL& url) {
212 resource->callback = 212 resource->callback =
213 base::Bind(&SafeBrowsingBlockingPageTest::OnBlockingPageComplete, 213 base::Bind(&SafeBrowsingBlockingPageTest::OnBlockingPageComplete,
214 base::Unretained(this)); 214 base::Unretained(this));
215 resource->callback_thread = content::BrowserThread::GetTaskRunnerForThread( 215 resource->callback_thread = content::BrowserThread::GetTaskRunnerForThread(
216 content::BrowserThread::IO); 216 content::BrowserThread::IO);
217 resource->url = url; 217 resource->url = url;
218 resource->is_subresource = is_subresource; 218 resource->is_subresource = is_subresource;
219 resource->threat_type = SB_THREAT_TYPE_URL_MALWARE; 219 resource->threat_type = SB_THREAT_TYPE_URL_MALWARE;
220 resource->render_process_host_id = 220 resource->web_contents_getter =
221 web_contents()->GetRenderProcessHost()->GetID(); 221 SafeBrowsingUIManager::UnsafeResource::GetWebContentsGetter(
222 resource->render_frame_id = web_contents()->GetMainFrame()->GetRoutingID(); 222 web_contents()->GetRenderProcessHost()->GetID(),
223 web_contents()->GetMainFrame()->GetRoutingID());
223 resource->threat_source = safe_browsing::ThreatSource::LOCAL_PVER3; 224 resource->threat_source = safe_browsing::ThreatSource::LOCAL_PVER3;
224 } 225 }
225 226
226 UserResponse user_response_; 227 UserResponse user_response_;
227 TestSafeBrowsingBlockingPageFactory factory_; 228 TestSafeBrowsingBlockingPageFactory factory_;
228 }; 229 };
229 230
230 231
231 // Tests showing a blocking page for a malware page and not proceeding. 232 // Tests showing a blocking page for a malware page and not proceeding.
232 TEST_F(SafeBrowsingBlockingPageTest, MalwarePageDontProceed) { 233 TEST_F(SafeBrowsingBlockingPageTest, MalwarePageDontProceed) {
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 856
856 // No report should have been sent. 857 // No report should have been sent.
857 EXPECT_EQ(0u, ui_manager_->GetThreatDetails()->size()); 858 EXPECT_EQ(0u, ui_manager_->GetThreatDetails()->size());
858 ui_manager_->GetThreatDetails()->clear(); 859 ui_manager_->GetThreatDetails()->clear();
859 } 860 }
860 861
861 // TODO(mattm): Add test for extended reporting not shown or sent in incognito 862 // TODO(mattm): Add test for extended reporting not shown or sent in incognito
862 // window. 863 // window.
863 864
864 } // namespace safe_browsing 865 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698