| 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 <map> | 5 #include <map> |
| 6 #include <memory> | 6 #include <memory> |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 static_cast<int>(ActivationDecision::ACTIVATED), 2); | 1383 static_cast<int>(ActivationDecision::ACTIVATED), 2); |
| 1384 | 1384 |
| 1385 tester.ExpectTotalCount( | 1385 tester.ExpectTotalCount( |
| 1386 internal::kHistogramSubresourceFilterActivationDecisionReload, 1); | 1386 internal::kHistogramSubresourceFilterActivationDecisionReload, 1); |
| 1387 tester.ExpectBucketCount( | 1387 tester.ExpectBucketCount( |
| 1388 internal::kHistogramSubresourceFilterActivationDecisionReload, | 1388 internal::kHistogramSubresourceFilterActivationDecisionReload, |
| 1389 static_cast<int>(ActivationDecision::ACTIVATED), 1); | 1389 static_cast<int>(ActivationDecision::ACTIVATED), 1); |
| 1390 } | 1390 } |
| 1391 | 1391 |
| 1392 IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest, | 1392 IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest, |
| 1393 WhiteliseSiteOnReload_ActivationDisabledOnReload) { | 1393 WhitelistSiteOnReload_ActivationDisabledOnReload) { |
| 1394 GURL url(GetTestUrl("subresource_filter/frame_with_included_script.html")); | 1394 GURL url(GetTestUrl("subresource_filter/frame_with_included_script.html")); |
| 1395 ConfigureAsPhishingURL(url); | 1395 ConfigureAsPhishingURL(url); |
| 1396 ASSERT_NO_FATAL_FAILURE( | 1396 ASSERT_NO_FATAL_FAILURE( |
| 1397 SetRulesetToDisallowURLsWithPathSuffix("included_script.js")); | 1397 SetRulesetToDisallowURLsWithPathSuffix("included_script.js")); |
| 1398 ResetConfigurationToEnableOnPhishingSites( | 1398 ResetConfigurationToEnableOnPhishingSites( |
| 1399 false /* measure_performance */, true /* whitelist_site_on_reload */); | 1399 false /* measure_performance */, true /* whitelist_site_on_reload */); |
| 1400 base::HistogramTester tester; | 1400 base::HistogramTester tester; |
| 1401 ui_test_utils::NavigateToURL(browser(), url); | 1401 ui_test_utils::NavigateToURL(browser(), url); |
| 1402 EXPECT_FALSE(WasParsedScriptElementLoaded(web_contents()->GetMainFrame())); | 1402 EXPECT_FALSE(WasParsedScriptElementLoaded(web_contents()->GetMainFrame())); |
| 1403 | 1403 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1419 | 1419 |
| 1420 tester.ExpectTotalCount( | 1420 tester.ExpectTotalCount( |
| 1421 internal::kHistogramSubresourceFilterActivationDecisionReload, 1); | 1421 internal::kHistogramSubresourceFilterActivationDecisionReload, 1); |
| 1422 tester.ExpectBucketCount( | 1422 tester.ExpectBucketCount( |
| 1423 internal::kHistogramSubresourceFilterActivationDecisionReload, | 1423 internal::kHistogramSubresourceFilterActivationDecisionReload, |
| 1424 static_cast<int>(ActivationDecision::URL_WHITELISTED), 1); | 1424 static_cast<int>(ActivationDecision::URL_WHITELISTED), 1); |
| 1425 } | 1425 } |
| 1426 | 1426 |
| 1427 IN_PROC_BROWSER_TEST_F( | 1427 IN_PROC_BROWSER_TEST_F( |
| 1428 SubresourceFilterBrowserTest, | 1428 SubresourceFilterBrowserTest, |
| 1429 WhiteliseSiteOnReload_ActivationDisabledOnReloadFromScript) { | 1429 WhitelistSiteOnReload_ActivationDisabledOnReloadFromScript) { |
| 1430 GURL url(GetTestUrl("subresource_filter/frame_with_included_script.html")); | 1430 GURL url(GetTestUrl("subresource_filter/frame_with_included_script.html")); |
| 1431 ConfigureAsPhishingURL(url); | 1431 ConfigureAsPhishingURL(url); |
| 1432 ASSERT_NO_FATAL_FAILURE( | 1432 ASSERT_NO_FATAL_FAILURE( |
| 1433 SetRulesetToDisallowURLsWithPathSuffix("included_script.js")); | 1433 SetRulesetToDisallowURLsWithPathSuffix("included_script.js")); |
| 1434 ResetConfigurationToEnableOnPhishingSites( | 1434 ResetConfigurationToEnableOnPhishingSites( |
| 1435 false /* measure_performance */, true /* whitelist_site_on_reload */); | 1435 false /* measure_performance */, true /* whitelist_site_on_reload */); |
| 1436 base::HistogramTester tester; | 1436 base::HistogramTester tester; |
| 1437 ui_test_utils::NavigateToURL(browser(), url); | 1437 ui_test_utils::NavigateToURL(browser(), url); |
| 1438 EXPECT_FALSE(WasParsedScriptElementLoaded(web_contents()->GetMainFrame())); | 1438 EXPECT_FALSE(WasParsedScriptElementLoaded(web_contents()->GetMainFrame())); |
| 1439 | 1439 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1457 | 1457 |
| 1458 tester.ExpectTotalCount( | 1458 tester.ExpectTotalCount( |
| 1459 internal::kHistogramSubresourceFilterActivationDecisionReload, 1); | 1459 internal::kHistogramSubresourceFilterActivationDecisionReload, 1); |
| 1460 tester.ExpectBucketCount( | 1460 tester.ExpectBucketCount( |
| 1461 internal::kHistogramSubresourceFilterActivationDecisionReload, | 1461 internal::kHistogramSubresourceFilterActivationDecisionReload, |
| 1462 static_cast<int>(ActivationDecision::URL_WHITELISTED), 1); | 1462 static_cast<int>(ActivationDecision::URL_WHITELISTED), 1); |
| 1463 } | 1463 } |
| 1464 | 1464 |
| 1465 IN_PROC_BROWSER_TEST_F( | 1465 IN_PROC_BROWSER_TEST_F( |
| 1466 SubresourceFilterBrowserTest, | 1466 SubresourceFilterBrowserTest, |
| 1467 WhiteliseSiteOnReload_ActivationDisabledOnNavigationToSameURL) { | 1467 WhitelistSiteOnReload_ActivationDisabledOnNavigationToSameURL) { |
| 1468 GURL url(GetTestUrl("subresource_filter/frame_with_included_script.html")); | 1468 GURL url(GetTestUrl("subresource_filter/frame_with_included_script.html")); |
| 1469 ConfigureAsPhishingURL(url); | 1469 ConfigureAsPhishingURL(url); |
| 1470 ASSERT_NO_FATAL_FAILURE( | 1470 ASSERT_NO_FATAL_FAILURE( |
| 1471 SetRulesetToDisallowURLsWithPathSuffix("included_script.js")); | 1471 SetRulesetToDisallowURLsWithPathSuffix("included_script.js")); |
| 1472 ResetConfigurationToEnableOnPhishingSites( | 1472 ResetConfigurationToEnableOnPhishingSites( |
| 1473 false /* measure_performance */, true /* whitelist_site_on_reload */); | 1473 false /* measure_performance */, true /* whitelist_site_on_reload */); |
| 1474 base::HistogramTester tester; | 1474 base::HistogramTester tester; |
| 1475 ui_test_utils::NavigateToURL(browser(), url); | 1475 ui_test_utils::NavigateToURL(browser(), url); |
| 1476 EXPECT_FALSE(WasParsedScriptElementLoaded(web_contents()->GetMainFrame())); | 1476 EXPECT_FALSE(WasParsedScriptElementLoaded(web_contents()->GetMainFrame())); |
| 1477 | 1477 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1555 std::string(kSubresourceFilterOnlySuffix), | 1555 std::string(kSubresourceFilterOnlySuffix), |
| 1556 false, 1); | 1556 false, 1); |
| 1557 | 1557 |
| 1558 tester.ExpectUniqueSample(std::string(kMatchesPatternHistogramName) + | 1558 tester.ExpectUniqueSample(std::string(kMatchesPatternHistogramName) + |
| 1559 std::string(kPhishingInterstitialSuffix), | 1559 std::string(kPhishingInterstitialSuffix), |
| 1560 false, 1); | 1560 false, 1); |
| 1561 } | 1561 } |
| 1562 #endif | 1562 #endif |
| 1563 | 1563 |
| 1564 } // namespace subresource_filter | 1564 } // namespace subresource_filter |
| OLD | NEW |