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

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

Issue 2889913002: [subresource_filter] Remove Forwarding NavigationThrottles (Closed)
Patch Set: Remove silly forwarding throttles 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 base::HistogramTester tester; 306 base::HistogramTester tester;
307 EXPECT_CALL(*client(), ToggleNotificationVisibility(false)).Times(1); 307 EXPECT_CALL(*client(), ToggleNotificationVisibility(false)).Times(1);
308 308
309 std::unique_ptr<content::NavigationSimulator> navigation_simulator = 309 std::unique_ptr<content::NavigationSimulator> navigation_simulator =
310 content::NavigationSimulator::CreateRendererInitiated( 310 content::NavigationSimulator::CreateRendererInitiated(
311 navigation_chain.front(), main_rfh()); 311 navigation_chain.front(), main_rfh());
312 navigation_simulator->SetReferrer(referrer); 312 navigation_simulator->SetReferrer(referrer);
313 navigation_simulator->SetTransition(transition); 313 navigation_simulator->SetTransition(transition);
314 navigation_simulator->Start(); 314 navigation_simulator->Start();
315 315
316 if (blacklisted_urls.front()) { 316 ::testing::Mock::VerifyAndClearExpectations(client());
317 factory()->OnMainResourceMatchedSafeBrowsingBlacklist( 317 for (size_t i = 1; i < navigation_chain.size(); ++i)
318 navigation_chain.front(), threat_type, threat_type_metadata); 318 navigation_simulator->Redirect(navigation_chain[i]);
319
320 if (blacklisted_urls.size() != navigation_chain.size() ||
321 !blacklisted_urls.back()) {
322 threat_type = safe_browsing::SBThreatType::SB_THREAT_TYPE_SAFE;
323 threat_type_metadata = safe_browsing::ThreatPatternType::NONE;
319 } 324 }
320 ::testing::Mock::VerifyAndClearExpectations(client()); 325 factory()->OnMainResourceMatchedSafeBrowsingBlacklist(
321 326 navigation_simulator->GetNavigationHandle(), threat_type,
322 for (size_t i = 1; i < navigation_chain.size(); ++i) { 327 threat_type_metadata);
323 const GURL url = navigation_chain[i];
324 if (i < blacklisted_urls.size() && blacklisted_urls[i]) {
325 factory()->OnMainResourceMatchedSafeBrowsingBlacklist(
326 url, threat_type, threat_type_metadata);
327 }
328 navigation_simulator->Redirect(url);
329 }
330 std::string suffix; 328 std::string suffix;
331 ActivationList activation_list = 329 ActivationList activation_list =
332 GetListForThreatTypeAndMetadata(threat_type, threat_type_metadata); 330 GetListForThreatTypeAndMetadata(threat_type, threat_type_metadata);
333 suffix = blacklisted_urls.back() ? GetSuffixForList(activation_list) 331 suffix = blacklisted_urls.back() ? GetSuffixForList(activation_list)
334 : std::string(); 332 : std::string();
335 333
336 navigation_simulator->Commit(); 334 navigation_simulator->Commit();
337 ExpectActivationSignalForFrame(main_rfh(), expected_activation); 335 ExpectActivationSignalForFrame(main_rfh(), expected_activation);
338 EXPECT_EQ(expected_activation_decision, 336 EXPECT_EQ(expected_activation_decision,
339 factory()->GetActivationDecisionForLastCommittedPageLoad()); 337 factory()->GetActivationDecisionForLastCommittedPageLoad());
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 ActivationScopeTest, 756 ActivationScopeTest,
759 ContentSubresourceFilterDriverFactoryActivationScopeTest, 757 ContentSubresourceFilterDriverFactoryActivationScopeTest,
760 ::testing::ValuesIn(kActivationScopeTestData)); 758 ::testing::ValuesIn(kActivationScopeTestData));
761 759
762 INSTANTIATE_TEST_CASE_P( 760 INSTANTIATE_TEST_CASE_P(
763 ActivationLevelTest, 761 ActivationLevelTest,
764 ContentSubresourceFilterDriverFactoryActivationLevelTest, 762 ContentSubresourceFilterDriverFactoryActivationLevelTest,
765 ::testing::ValuesIn(kActivationLevelTestData)); 763 ::testing::ValuesIn(kActivationLevelTestData));
766 764
767 } // namespace subresource_filter 765 } // namespace subresource_filter
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698