OLD | NEW |
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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 | 727 |
728 // data URLs are also not supported, but not listed here, as it's not possible | 728 // data URLs are also not supported, but not listed here, as it's not possible |
729 // for a page to redirect to them after https://crbug.com/594215 is fixed. | 729 // for a page to redirect to them after https://crbug.com/594215 is fixed. |
730 const char* unsupported_urls[] = {"ftp://example.com/", "chrome://settings", | 730 const char* unsupported_urls[] = {"ftp://example.com/", "chrome://settings", |
731 "chrome-extension://some-extension", | 731 "chrome-extension://some-extension", |
732 "file:///var/www/index.html"}; | 732 "file:///var/www/index.html"}; |
733 const char* supported_urls[] = {"http://example.test", | 733 const char* supported_urls[] = {"http://example.test", |
734 "https://example.test"}; | 734 "https://example.test"}; |
735 for (auto* url : unsupported_urls) { | 735 for (auto* url : unsupported_urls) { |
736 SCOPED_TRACE(url); | 736 SCOPED_TRACE(url); |
| 737 ActivationDecision expected_decision = |
| 738 ActivationDecision::UNSUPPORTED_SCHEME; |
| 739 // We only log UNSUPPORTED_SCHEME if the navigation would have otherwise |
| 740 // activated. Note that non http/s URLs will never match an activation list. |
| 741 if (test_data.expected_activation_decision == |
| 742 ActivationDecision::ACTIVATION_CONDITIONS_NOT_MET || |
| 743 test_data.activation_scope == ActivationScope::ACTIVATION_LIST) { |
| 744 expected_decision = ActivationDecision::ACTIVATION_CONDITIONS_NOT_MET; |
| 745 } |
737 NavigateAndExpectActivation({test_data.url_matches_activation_list}, | 746 NavigateAndExpectActivation({test_data.url_matches_activation_list}, |
738 {GURL(url)}, | 747 {GURL(url)}, expected_decision); |
739 ActivationDecision::UNSUPPORTED_SCHEME); | |
740 } | 748 } |
741 for (auto* url : supported_urls) { | 749 for (auto* url : supported_urls) { |
742 SCOPED_TRACE(url); | 750 SCOPED_TRACE(url); |
743 NavigateAndExpectActivation({test_data.url_matches_activation_list}, | 751 NavigateAndExpectActivation({test_data.url_matches_activation_list}, |
744 {GURL(url)}, | 752 {GURL(url)}, |
745 test_data.expected_activation_decision); | 753 test_data.expected_activation_decision); |
746 } | 754 } |
747 }; | 755 }; |
748 | 756 |
749 INSTANTIATE_TEST_CASE_P(NoSocEngHit, | 757 INSTANTIATE_TEST_CASE_P(NoSocEngHit, |
750 ContentSubresourceFilterDriverFactoryThreatTypeTest, | 758 ContentSubresourceFilterDriverFactoryThreatTypeTest, |
751 ::testing::ValuesIn(kActivationListTestData)); | 759 ::testing::ValuesIn(kActivationListTestData)); |
752 | 760 |
753 INSTANTIATE_TEST_CASE_P( | 761 INSTANTIATE_TEST_CASE_P( |
754 ActivationScopeTest, | 762 ActivationScopeTest, |
755 ContentSubresourceFilterDriverFactoryActivationScopeTest, | 763 ContentSubresourceFilterDriverFactoryActivationScopeTest, |
756 ::testing::ValuesIn(kActivationScopeTestData)); | 764 ::testing::ValuesIn(kActivationScopeTestData)); |
757 | 765 |
758 INSTANTIATE_TEST_CASE_P( | 766 INSTANTIATE_TEST_CASE_P( |
759 ActivationLevelTest, | 767 ActivationLevelTest, |
760 ContentSubresourceFilterDriverFactoryActivationLevelTest, | 768 ContentSubresourceFilterDriverFactoryActivationLevelTest, |
761 ::testing::ValuesIn(kActivationLevelTestData)); | 769 ::testing::ValuesIn(kActivationLevelTestData)); |
762 | 770 |
763 } // namespace subresource_filter | 771 } // namespace subresource_filter |
OLD | NEW |