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

Side by Side Diff: chrome/browser/ssl/ssl_browser_tests.cc

Issue 2966903002: Specialize Superfish interstitial metrics (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « chrome/browser/ssl/ssl_blocking_page.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <utility> 5 #include <utility>
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/base_switches.h" 8 #include "base/base_switches.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 4985 matching lines...) Expand 10 before | Expand all | Expand 10 after
4996 interstitial_page->GetDelegateForTesting()->GetTypeForTesting()); 4996 interstitial_page->GetDelegateForTesting()->GetTypeForTesting());
4997 4997
4998 // Look for keywords on the page to check that the Superfish interstitial is 4998 // Look for keywords on the page to check that the Superfish interstitial is
4999 // showing. 4999 // showing.
5000 const std::string expected_title = 5000 const std::string expected_title =
5001 l10n_util::GetStringUTF8(IDS_SSL_SUPERFISH_HEADING); 5001 l10n_util::GetStringUTF8(IDS_SSL_SUPERFISH_HEADING);
5002 EXPECT_TRUE(chrome_browser_interstitials::IsInterstitialDisplayingText( 5002 EXPECT_TRUE(chrome_browser_interstitials::IsInterstitialDisplayingText(
5003 interstitial_page, expected_title)); 5003 interstitial_page, expected_title));
5004 } 5004 }
5005 5005
5006 // Tests that the Superfish interstitial records metrics under the correct
5007 // prefix.
5008 IN_PROC_BROWSER_TEST_F(SuperfishSSLUITest, SuperfishInterstitialUMA) {
meacer 2017/06/30 22:40:28 This test subsumes the one above (SuperfishSSLUITe
estark 2017/06/30 22:50:48 Done, just added the metrics checks to the origina
5009 base::HistogramTester histograms;
5010 const std::string decision_histogram = "interstitial.superfish.decision";
5011 const std::string interaction_histogram =
5012 "interstitial.superfish.interaction";
5013
5014 base::test::ScopedFeatureList scoped_feature_list;
5015 scoped_feature_list.InitFromCommandLine("SuperfishInterstitial",
5016 std::string());
5017 SetUpCertVerifier(true /* use superfish cert */);
5018 ui_test_utils::NavigateToURL(browser(),
5019 https_server_.GetURL("/ssl/google.html"));
5020 content::WebContents* tab =
5021 browser()->tab_strip_model()->GetActiveWebContents();
5022 content::WaitForInterstitialAttach(tab);
5023 InterstitialPage* interstitial_page = tab->GetInterstitialPage();
5024 ASSERT_TRUE(interstitial_page);
5025 EXPECT_TRUE(WaitForRenderFrameReady(interstitial_page->GetMainFrame()));
5026 EXPECT_EQ(SSLBlockingPage::kTypeForTesting,
5027 interstitial_page->GetDelegateForTesting()->GetTypeForTesting());
5028
5029 // Look for keywords on the page to check that the Superfish interstitial is
5030 // showing.
5031 const std::string expected_title =
5032 l10n_util::GetStringUTF8(IDS_SSL_SUPERFISH_HEADING);
5033 EXPECT_TRUE(chrome_browser_interstitials::IsInterstitialDisplayingText(
5034 interstitial_page, expected_title));
5035
5036 // Check that the correct histograms were recorded.
5037 histograms.ExpectTotalCount(decision_histogram, 1);
5038 histograms.ExpectBucketCount(decision_histogram,
5039 security_interstitials::MetricsHelper::SHOW, 1);
5040 histograms.ExpectTotalCount(interaction_histogram, 1);
5041 histograms.ExpectBucketCount(
5042 interaction_histogram,
5043 security_interstitials::MetricsHelper::TOTAL_VISITS, 1);
5044 }
5045
5006 // Tests that the Superfish interstitial is not shown when the Finch feature is 5046 // Tests that the Superfish interstitial is not shown when the Finch feature is
5007 // disabled. 5047 // disabled.
5008 IN_PROC_BROWSER_TEST_F(SuperfishSSLUITest, SuperfishInterstitialDisabled) { 5048 IN_PROC_BROWSER_TEST_F(SuperfishSSLUITest, SuperfishInterstitialDisabled) {
5009 base::test::ScopedFeatureList scoped_feature_list; 5049 base::test::ScopedFeatureList scoped_feature_list;
5010 scoped_feature_list.InitFromCommandLine(std::string(), 5050 scoped_feature_list.InitFromCommandLine(std::string(),
5011 "SuperfishInterstitial"); 5051 "SuperfishInterstitial");
5012 SetUpCertVerifier(true /* use superfish cert */); 5052 SetUpCertVerifier(true /* use superfish cert */);
5013 ui_test_utils::NavigateToURL(browser(), 5053 ui_test_utils::NavigateToURL(browser(),
5014 https_server_.GetURL("/ssl/google.html")); 5054 https_server_.GetURL("/ssl/google.html"));
5015 content::WebContents* tab = 5055 content::WebContents* tab =
(...skipping 17 matching lines...) Expand all
5033 5073
5034 // Visit a page over https that contains a frame with a redirect. 5074 // Visit a page over https that contains a frame with a redirect.
5035 5075
5036 // XMLHttpRequest insecure content in synchronous mode. 5076 // XMLHttpRequest insecure content in synchronous mode.
5037 5077
5038 // XMLHttpRequest insecure content in asynchronous mode. 5078 // XMLHttpRequest insecure content in asynchronous mode.
5039 5079
5040 // XMLHttpRequest over bad ssl in synchronous mode. 5080 // XMLHttpRequest over bad ssl in synchronous mode.
5041 5081
5042 // XMLHttpRequest over OK ssl in synchronous mode. 5082 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_blocking_page.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698