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 465d7ab86bd8de73a92f5a000bc5d94a97a1a100..5a44e2af31d2f066e5432b3eb5e1f7f4d829565a 100644 | 
| --- a/chrome/browser/ssl/ssl_browser_tests.cc | 
| +++ b/chrome/browser/ssl/ssl_browser_tests.cc | 
| @@ -2354,6 +2354,84 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, BadCertFollowedByGoodCert) { | 
| EXPECT_FALSE(state->HasAllowException(https_server_host)); | 
| } | 
| +// Tests that the SSLStatus of a navigation entry for an interstitial | 
| +// matches the navigation entry once the interstitial is clicked | 
| +// through. https://crbug.com/529456 | 
| +IN_PROC_BROWSER_TEST_F(SSLUITest, | 
| + SSLStatusMatchesOnInterstitialAndAfterProceed) { | 
| + ASSERT_TRUE(https_server_expired_.Start()); | 
| + WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 
| + ASSERT_TRUE(tab); | 
| + | 
| + ui_test_utils::NavigateToURL( | 
| + browser(), https_server_expired_.GetURL("files/ssl/google.html")); | 
| + content::WaitForInterstitialAttach(tab); | 
| + EXPECT_TRUE(tab->ShowingInterstitialPage()); | 
| + | 
| + content::NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 
| + ASSERT_TRUE(entry); | 
| + content::SSLStatus interstitial_ssl_status = entry->GetSSL(); | 
| + | 
| + ProceedThroughInterstitial(tab); | 
| + EXPECT_FALSE(tab->ShowingInterstitialPage()); | 
| + entry = tab->GetController().GetActiveEntry(); | 
| + ASSERT_TRUE(entry); | 
| + | 
| + content::SSLStatus after_interstitial_ssl_status = entry->GetSSL(); | 
| + | 
| + LOG(ERROR) << "Interstitial status: " << interstitial_ssl_status.security_style << ", " << interstitial_ssl_status.cert_id << ", " << interstitial_ssl_status.cert_status << ", " << interstitial_ssl_status.security_bits << ", " << interstitial_ssl_status.connection_status << ", " << interstitial_ssl_status.content_status; | 
| 
 
meacer
2015/09/09 18:26:07
I see you're done debugging on the trybots :) Don'
 
estark
2015/09/10 14:32:05
Done.
 
 | 
| + LOG(ERROR) << "After Interstitial status: " << after_interstitial_ssl_status.security_style << ", " << after_interstitial_ssl_status.cert_id << ", " << after_interstitial_ssl_status.cert_status << ", " << after_interstitial_ssl_status.security_bits << ", " << after_interstitial_ssl_status.connection_status << ", " << after_interstitial_ssl_status.content_status; | 
| + EXPECT_TRUE(interstitial_ssl_status.Equals(after_interstitial_ssl_status)); | 
| +} | 
| + | 
| +// Same as previous test but for the bad clock interstitial. | 
| +IN_PROC_BROWSER_TEST_F(SSLUITest, | 
| + SSLStatusMatchesonClockInterstitialAndAfterProceed) { | 
| + ASSERT_TRUE(https_server_expired_.Start()); | 
| + WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 
| + ASSERT_TRUE(tab); | 
| + | 
| + // Set up the build and current clock times to be more than a year apart. | 
| + scoped_ptr<base::SimpleTestClock> mock_clock(new base::SimpleTestClock()); | 
| 
 
meacer
2015/09/09 18:26:07
nit: This could just be |base::SimpleTestClock moc
 
estark
2015/09/10 14:32:05
Done.
 
 | 
| + mock_clock->SetNow(base::Time::NowFromSystemTime()); | 
| + mock_clock->Advance(base::TimeDelta::FromDays(367)); | 
| + SSLErrorHandler::SetClockForTest(mock_clock.get()); | 
| + SSLErrorClassification::SetBuildTimeForTesting( | 
| + base::Time::NowFromSystemTime()); | 
| + | 
| + ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/")); | 
| + content::WaitForInterstitialAttach(tab); | 
| + InterstitialPage* clock_interstitial = tab->GetInterstitialPage(); | 
| + ASSERT_TRUE(clock_interstitial); | 
| + EXPECT_EQ(BadClockBlockingPage::kTypeForTesting, | 
| + clock_interstitial->GetDelegateForTesting()->GetTypeForTesting()); | 
| + | 
| + // Grab the SSLStatus on the clock interstitial. | 
| + content::NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 
| + ASSERT_TRUE(entry); | 
| + content::SSLStatus clock_interstitial_ssl_status = entry->GetSSL(); | 
| + | 
| + // Put the clock back to normal, trigger a normal SSL interstitial, | 
| + // and proceed through it. | 
| 
 
meacer
2015/09/09 18:26:07
nit: Seems like this part is extra on top of the p
 
estark
2015/09/10 14:32:05
Done.
 
 | 
| + mock_clock->SetNow(base::Time::NowFromSystemTime()); | 
| + ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/")); | 
| + content::WaitForInterstitialAttach(tab); | 
| + InterstitialPage* ssl_interstitial = tab->GetInterstitialPage(); | 
| + ASSERT_TRUE(ssl_interstitial); | 
| + EXPECT_EQ(SSLBlockingPage::kTypeForTesting, | 
| + ssl_interstitial->GetDelegateForTesting()->GetTypeForTesting()); | 
| + ProceedThroughInterstitial(tab); | 
| + EXPECT_FALSE(tab->ShowingInterstitialPage()); | 
| + | 
| + // Grab the SSLStatus from the page and check that it is the same as | 
| + // on the clock interstitial. | 
| + entry = tab->GetController().GetActiveEntry(); | 
| + ASSERT_TRUE(entry); | 
| + content::SSLStatus after_interstitial_ssl_status = entry->GetSSL(); | 
| + EXPECT_TRUE( | 
| + after_interstitial_ssl_status.Equals(clock_interstitial_ssl_status)); | 
| +} | 
| + | 
| class CommonNameMismatchBrowserTest : public CertVerifierBrowserTest { | 
| public: | 
| CommonNameMismatchBrowserTest() : CertVerifierBrowserTest() {} |