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

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

Issue 2966903002: Specialize Superfish interstitial metrics (Closed)
Patch Set: string -> const char[] 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 4962 matching lines...) Expand 10 before | Expand all | Expand 10 after
4973 base::HistogramTester histograms; 4973 base::HistogramTester histograms;
4974 ui_test_utils::NavigateToURL(browser(), 4974 ui_test_utils::NavigateToURL(browser(),
4975 https_server_.GetURL("/ssl/google.html")); 4975 https_server_.GetURL("/ssl/google.html"));
4976 histograms.ExpectUniqueSample("interstitial.ssl_error_handler.superfish", 4976 histograms.ExpectUniqueSample("interstitial.ssl_error_handler.superfish",
4977 false, 1); 4977 false, 1);
4978 } 4978 }
4979 4979
4980 // Tests that the Superfish interstitial is shown when the Finch feature is 4980 // Tests that the Superfish interstitial is shown when the Finch feature is
4981 // enabled and the Superfish certificate is present. 4981 // enabled and the Superfish certificate is present.
4982 IN_PROC_BROWSER_TEST_F(SuperfishSSLUITest, SuperfishInterstitial) { 4982 IN_PROC_BROWSER_TEST_F(SuperfishSSLUITest, SuperfishInterstitial) {
4983 base::HistogramTester histograms;
4984 const char kDecisionHistogram[] = "interstitial.superfish.decision";
4985 const char kInteractionHistogram[] = "interstitial.superfish.interaction";
4986
4983 base::test::ScopedFeatureList scoped_feature_list; 4987 base::test::ScopedFeatureList scoped_feature_list;
4984 scoped_feature_list.InitFromCommandLine("SuperfishInterstitial", 4988 scoped_feature_list.InitFromCommandLine("SuperfishInterstitial",
4985 std::string()); 4989 std::string());
4986 SetUpCertVerifier(true /* use superfish cert */); 4990 SetUpCertVerifier(true /* use superfish cert */);
4987 ui_test_utils::NavigateToURL(browser(), 4991 ui_test_utils::NavigateToURL(browser(),
4988 https_server_.GetURL("/ssl/google.html")); 4992 https_server_.GetURL("/ssl/google.html"));
4989 content::WebContents* tab = 4993 content::WebContents* tab =
4990 browser()->tab_strip_model()->GetActiveWebContents(); 4994 browser()->tab_strip_model()->GetActiveWebContents();
4991 content::WaitForInterstitialAttach(tab); 4995 content::WaitForInterstitialAttach(tab);
4992 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); 4996 InterstitialPage* interstitial_page = tab->GetInterstitialPage();
4993 ASSERT_TRUE(interstitial_page); 4997 ASSERT_TRUE(interstitial_page);
4994 EXPECT_TRUE(WaitForRenderFrameReady(interstitial_page->GetMainFrame())); 4998 EXPECT_TRUE(WaitForRenderFrameReady(interstitial_page->GetMainFrame()));
4995 EXPECT_EQ(SSLBlockingPage::kTypeForTesting, 4999 EXPECT_EQ(SSLBlockingPage::kTypeForTesting,
4996 interstitial_page->GetDelegateForTesting()->GetTypeForTesting()); 5000 interstitial_page->GetDelegateForTesting()->GetTypeForTesting());
4997 5001
4998 // Look for keywords on the page to check that the Superfish interstitial is 5002 // Look for keywords on the page to check that the Superfish interstitial is
4999 // showing. 5003 // showing.
5000 const std::string expected_title = 5004 const std::string expected_title =
5001 l10n_util::GetStringUTF8(IDS_SSL_SUPERFISH_HEADING); 5005 l10n_util::GetStringUTF8(IDS_SSL_SUPERFISH_HEADING);
5002 EXPECT_TRUE(chrome_browser_interstitials::IsInterstitialDisplayingText( 5006 EXPECT_TRUE(chrome_browser_interstitials::IsInterstitialDisplayingText(
5003 interstitial_page, expected_title)); 5007 interstitial_page, expected_title));
5008
5009 // Check that the correct histograms were recorded.
5010 histograms.ExpectTotalCount(kDecisionHistogram, 1);
5011 histograms.ExpectBucketCount(kDecisionHistogram,
5012 security_interstitials::MetricsHelper::SHOW, 1);
5013 histograms.ExpectTotalCount(kInteractionHistogram, 1);
5014 histograms.ExpectBucketCount(
5015 kInteractionHistogram,
5016 security_interstitials::MetricsHelper::TOTAL_VISITS, 1);
5004 } 5017 }
5005 5018
5006 // Tests that the Superfish interstitial is not shown when the Finch feature is 5019 // Tests that the Superfish interstitial is not shown when the Finch feature is
5007 // disabled. 5020 // disabled.
5008 IN_PROC_BROWSER_TEST_F(SuperfishSSLUITest, SuperfishInterstitialDisabled) { 5021 IN_PROC_BROWSER_TEST_F(SuperfishSSLUITest, SuperfishInterstitialDisabled) {
5009 base::test::ScopedFeatureList scoped_feature_list; 5022 base::test::ScopedFeatureList scoped_feature_list;
5010 scoped_feature_list.InitFromCommandLine(std::string(), 5023 scoped_feature_list.InitFromCommandLine(std::string(),
5011 "SuperfishInterstitial"); 5024 "SuperfishInterstitial");
5012 SetUpCertVerifier(true /* use superfish cert */); 5025 SetUpCertVerifier(true /* use superfish cert */);
5013 ui_test_utils::NavigateToURL(browser(), 5026 ui_test_utils::NavigateToURL(browser(),
(...skipping 19 matching lines...) Expand all
5033 5046
5034 // Visit a page over https that contains a frame with a redirect. 5047 // Visit a page over https that contains a frame with a redirect.
5035 5048
5036 // XMLHttpRequest insecure content in synchronous mode. 5049 // XMLHttpRequest insecure content in synchronous mode.
5037 5050
5038 // XMLHttpRequest insecure content in asynchronous mode. 5051 // XMLHttpRequest insecure content in asynchronous mode.
5039 5052
5040 // XMLHttpRequest over bad ssl in synchronous mode. 5053 // XMLHttpRequest over bad ssl in synchronous mode.
5041 5054
5042 // XMLHttpRequest over OK ssl in synchronous mode. 5055 // 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