Chromium Code Reviews| Index: chrome/browser/ssl/ssl_browser_tests.cc |
| diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc |
| index dbdefe17cda376f58dcdc4810d72c0383430e4ab..5892734fa607d1558377b38da79d1650fdbc8111 100644 |
| --- a/chrome/browser/ssl/ssl_browser_tests.cc |
| +++ b/chrome/browser/ssl/ssl_browser_tests.cc |
| @@ -5003,6 +5003,46 @@ IN_PROC_BROWSER_TEST_F(SuperfishSSLUITest, SuperfishInterstitial) { |
| interstitial_page, expected_title)); |
| } |
| +// Tests that the Superfish interstitial records metrics under the correct |
| +// prefix. |
| +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
|
| + base::HistogramTester histograms; |
| + const std::string decision_histogram = "interstitial.superfish.decision"; |
| + const std::string interaction_histogram = |
| + "interstitial.superfish.interaction"; |
| + |
| + base::test::ScopedFeatureList scoped_feature_list; |
| + scoped_feature_list.InitFromCommandLine("SuperfishInterstitial", |
| + std::string()); |
| + SetUpCertVerifier(true /* use superfish cert */); |
| + ui_test_utils::NavigateToURL(browser(), |
| + https_server_.GetURL("/ssl/google.html")); |
| + content::WebContents* tab = |
| + browser()->tab_strip_model()->GetActiveWebContents(); |
| + content::WaitForInterstitialAttach(tab); |
| + InterstitialPage* interstitial_page = tab->GetInterstitialPage(); |
| + ASSERT_TRUE(interstitial_page); |
| + EXPECT_TRUE(WaitForRenderFrameReady(interstitial_page->GetMainFrame())); |
| + EXPECT_EQ(SSLBlockingPage::kTypeForTesting, |
| + interstitial_page->GetDelegateForTesting()->GetTypeForTesting()); |
| + |
| + // Look for keywords on the page to check that the Superfish interstitial is |
| + // showing. |
| + const std::string expected_title = |
| + l10n_util::GetStringUTF8(IDS_SSL_SUPERFISH_HEADING); |
| + EXPECT_TRUE(chrome_browser_interstitials::IsInterstitialDisplayingText( |
| + interstitial_page, expected_title)); |
| + |
| + // Check that the correct histograms were recorded. |
| + histograms.ExpectTotalCount(decision_histogram, 1); |
| + histograms.ExpectBucketCount(decision_histogram, |
| + security_interstitials::MetricsHelper::SHOW, 1); |
| + histograms.ExpectTotalCount(interaction_histogram, 1); |
| + histograms.ExpectBucketCount( |
| + interaction_histogram, |
| + security_interstitials::MetricsHelper::TOTAL_VISITS, 1); |
| +} |
| + |
| // Tests that the Superfish interstitial is not shown when the Finch feature is |
| // disabled. |
| IN_PROC_BROWSER_TEST_F(SuperfishSSLUITest, SuperfishInterstitialDisabled) { |