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

Side by Side Diff: components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc

Issue 2889193003: [subresource_filter] Reland: Remove Forwarding NavigationThrottles (Closed)
Patch Set: Fix Created 3 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/subresource_filter/content/browser/content_subresource_filt er_driver_factory.h" 5 #include "components/subresource_filter/content/browser/content_subresource_filt er_driver_factory.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 base::HistogramTester tester; 304 base::HistogramTester tester;
305 EXPECT_CALL(*client(), ToggleNotificationVisibility(false)).Times(1); 305 EXPECT_CALL(*client(), ToggleNotificationVisibility(false)).Times(1);
306 306
307 std::unique_ptr<content::NavigationSimulator> navigation_simulator = 307 std::unique_ptr<content::NavigationSimulator> navigation_simulator =
308 content::NavigationSimulator::CreateRendererInitiated( 308 content::NavigationSimulator::CreateRendererInitiated(
309 navigation_chain.front(), main_rfh()); 309 navigation_chain.front(), main_rfh());
310 navigation_simulator->SetReferrer(referrer); 310 navigation_simulator->SetReferrer(referrer);
311 navigation_simulator->SetTransition(transition); 311 navigation_simulator->SetTransition(transition);
312 navigation_simulator->Start(); 312 navigation_simulator->Start();
313 313
314 if (blacklisted_urls.front()) { 314 ::testing::Mock::VerifyAndClearExpectations(client());
315 factory()->OnMainResourceMatchedSafeBrowsingBlacklist( 315 for (size_t i = 1; i < navigation_chain.size(); ++i)
316 navigation_chain.front(), threat_type, threat_type_metadata); 316 navigation_simulator->Redirect(navigation_chain[i]);
317
318 if (blacklisted_urls.size() != navigation_chain.size() ||
319 !blacklisted_urls.back()) {
320 threat_type = safe_browsing::SBThreatType::SB_THREAT_TYPE_SAFE;
321 threat_type_metadata = safe_browsing::ThreatPatternType::NONE;
317 } 322 }
318 ::testing::Mock::VerifyAndClearExpectations(client()); 323 factory()->OnSafeBrowsingMatchComputed(
319 324 navigation_simulator->GetNavigationHandle(), threat_type,
320 for (size_t i = 1; i < navigation_chain.size(); ++i) { 325 threat_type_metadata);
321 const GURL url = navigation_chain[i];
322 if (i < blacklisted_urls.size() && blacklisted_urls[i]) {
323 factory()->OnMainResourceMatchedSafeBrowsingBlacklist(
324 url, threat_type, threat_type_metadata);
325 }
326 navigation_simulator->Redirect(url);
327 }
328 std::string suffix; 326 std::string suffix;
329 ActivationList activation_list = 327 ActivationList activation_list =
330 GetListForThreatTypeAndMetadata(threat_type, threat_type_metadata); 328 GetListForThreatTypeAndMetadata(threat_type, threat_type_metadata);
331 suffix = blacklisted_urls.back() ? GetSuffixForList(activation_list) 329 suffix = blacklisted_urls.back() ? GetSuffixForList(activation_list)
332 : std::string(); 330 : std::string();
333 331
334 navigation_simulator->Commit(); 332 navigation_simulator->Commit();
335 ExpectActivationSignalForFrame(main_rfh(), expected_activation); 333 ExpectActivationSignalForFrame(main_rfh(), expected_activation);
336 EXPECT_EQ(expected_activation_decision, 334 EXPECT_EQ(expected_activation_decision,
337 factory()->GetActivationDecisionForLastCommittedPageLoad()); 335 factory()->GetActivationDecisionForLastCommittedPageLoad());
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 ActivationScopeTest, 754 ActivationScopeTest,
757 ContentSubresourceFilterDriverFactoryActivationScopeTest, 755 ContentSubresourceFilterDriverFactoryActivationScopeTest,
758 ::testing::ValuesIn(kActivationScopeTestData)); 756 ::testing::ValuesIn(kActivationScopeTestData));
759 757
760 INSTANTIATE_TEST_CASE_P( 758 INSTANTIATE_TEST_CASE_P(
761 ActivationLevelTest, 759 ActivationLevelTest,
762 ContentSubresourceFilterDriverFactoryActivationLevelTest, 760 ContentSubresourceFilterDriverFactoryActivationLevelTest,
763 ::testing::ValuesIn(kActivationLevelTestData)); 761 ::testing::ValuesIn(kActivationLevelTestData));
764 762
765 } // namespace subresource_filter 763 } // namespace subresource_filter
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698