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

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

Issue 1332633002: Add constructor to create SSLStatus from SSLInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: temp: debug logging for mac/win test failure Created 5 years, 3 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
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 2336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2347 2347
2348 ProceedThroughInterstitial(tab); 2348 ProceedThroughInterstitial(tab);
2349 EXPECT_TRUE(state->HasAllowException(https_server_host)); 2349 EXPECT_TRUE(state->HasAllowException(https_server_host));
2350 2350
2351 ui_test_utils::NavigateToURL(browser(), 2351 ui_test_utils::NavigateToURL(browser(),
2352 https_server_.GetURL("files/ssl/google.html")); 2352 https_server_.GetURL("files/ssl/google.html"));
2353 ASSERT_FALSE(tab->GetInterstitialPage()); 2353 ASSERT_FALSE(tab->GetInterstitialPage());
2354 EXPECT_FALSE(state->HasAllowException(https_server_host)); 2354 EXPECT_FALSE(state->HasAllowException(https_server_host));
2355 } 2355 }
2356 2356
2357 // Tests that the SSLStatus of a navigation entry for an interstitial
2358 // matches the navigation entry once the interstitial is clicked
2359 // through. https://crbug.com/529456
2360 IN_PROC_BROWSER_TEST_F(SSLUITest,
2361 SSLStatusMatchesOnInterstitialAndAfterProceed) {
2362 ASSERT_TRUE(https_server_expired_.Start());
2363 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2364 ASSERT_TRUE(tab);
2365
2366 ui_test_utils::NavigateToURL(
2367 browser(), https_server_expired_.GetURL("files/ssl/google.html"));
2368 content::WaitForInterstitialAttach(tab);
2369 EXPECT_TRUE(tab->ShowingInterstitialPage());
2370
2371 content::NavigationEntry* entry = tab->GetController().GetActiveEntry();
2372 ASSERT_TRUE(entry);
2373 content::SSLStatus interstitial_ssl_status = entry->GetSSL();
2374
2375 ProceedThroughInterstitial(tab);
2376 EXPECT_FALSE(tab->ShowingInterstitialPage());
2377 entry = tab->GetController().GetActiveEntry();
2378 ASSERT_TRUE(entry);
2379
2380 content::SSLStatus after_interstitial_ssl_status = entry->GetSSL();
2381
2382 LOG(ERROR) << "Interstitial status: " << interstitial_ssl_status.security_styl e << ", " << interstitial_ssl_status.cert_id << ", " << interstitial_ssl_status. cert_status << ", " << interstitial_ssl_status.security_bits << ", " << intersti tial_ssl_status.connection_status << ", " << interstitial_ssl_status.content_sta tus;
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.
2383 LOG(ERROR) << "After Interstitial status: " << after_interstitial_ssl_status .security_style << ", " << after_interstitial_ssl_status.cert_id << ", " << afte r_interstitial_ssl_status.cert_status << ", " << after_interstitial_ssl_status.s ecurity_bits << ", " << after_interstitial_ssl_status.connection_status << ", " << after_interstitial_ssl_status.content_status;
2384 EXPECT_TRUE(interstitial_ssl_status.Equals(after_interstitial_ssl_status));
2385 }
2386
2387 // Same as previous test but for the bad clock interstitial.
2388 IN_PROC_BROWSER_TEST_F(SSLUITest,
2389 SSLStatusMatchesonClockInterstitialAndAfterProceed) {
2390 ASSERT_TRUE(https_server_expired_.Start());
2391 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2392 ASSERT_TRUE(tab);
2393
2394 // Set up the build and current clock times to be more than a year apart.
2395 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.
2396 mock_clock->SetNow(base::Time::NowFromSystemTime());
2397 mock_clock->Advance(base::TimeDelta::FromDays(367));
2398 SSLErrorHandler::SetClockForTest(mock_clock.get());
2399 SSLErrorClassification::SetBuildTimeForTesting(
2400 base::Time::NowFromSystemTime());
2401
2402 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/"));
2403 content::WaitForInterstitialAttach(tab);
2404 InterstitialPage* clock_interstitial = tab->GetInterstitialPage();
2405 ASSERT_TRUE(clock_interstitial);
2406 EXPECT_EQ(BadClockBlockingPage::kTypeForTesting,
2407 clock_interstitial->GetDelegateForTesting()->GetTypeForTesting());
2408
2409 // Grab the SSLStatus on the clock interstitial.
2410 content::NavigationEntry* entry = tab->GetController().GetActiveEntry();
2411 ASSERT_TRUE(entry);
2412 content::SSLStatus clock_interstitial_ssl_status = entry->GetSSL();
2413
2414 // Put the clock back to normal, trigger a normal SSL interstitial,
2415 // 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.
2416 mock_clock->SetNow(base::Time::NowFromSystemTime());
2417 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/"));
2418 content::WaitForInterstitialAttach(tab);
2419 InterstitialPage* ssl_interstitial = tab->GetInterstitialPage();
2420 ASSERT_TRUE(ssl_interstitial);
2421 EXPECT_EQ(SSLBlockingPage::kTypeForTesting,
2422 ssl_interstitial->GetDelegateForTesting()->GetTypeForTesting());
2423 ProceedThroughInterstitial(tab);
2424 EXPECT_FALSE(tab->ShowingInterstitialPage());
2425
2426 // Grab the SSLStatus from the page and check that it is the same as
2427 // on the clock interstitial.
2428 entry = tab->GetController().GetActiveEntry();
2429 ASSERT_TRUE(entry);
2430 content::SSLStatus after_interstitial_ssl_status = entry->GetSSL();
2431 EXPECT_TRUE(
2432 after_interstitial_ssl_status.Equals(clock_interstitial_ssl_status));
2433 }
2434
2357 class CommonNameMismatchBrowserTest : public CertVerifierBrowserTest { 2435 class CommonNameMismatchBrowserTest : public CertVerifierBrowserTest {
2358 public: 2436 public:
2359 CommonNameMismatchBrowserTest() : CertVerifierBrowserTest() {} 2437 CommonNameMismatchBrowserTest() : CertVerifierBrowserTest() {}
2360 ~CommonNameMismatchBrowserTest() override {} 2438 ~CommonNameMismatchBrowserTest() override {}
2361 2439
2362 void SetUpCommandLine(base::CommandLine* command_line) override { 2440 void SetUpCommandLine(base::CommandLine* command_line) override {
2363 // Enable finch experiment for SSL common name mismatch handling. 2441 // Enable finch experiment for SSL common name mismatch handling.
2364 command_line->AppendSwitchASCII(switches::kForceFieldTrials, 2442 command_line->AppendSwitchASCII(switches::kForceFieldTrials,
2365 "SSLCommonNameMismatchHandling/Enabled/"); 2443 "SSLCommonNameMismatchHandling/Enabled/");
2366 } 2444 }
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
2734 2812
2735 // Visit a page over https that contains a frame with a redirect. 2813 // Visit a page over https that contains a frame with a redirect.
2736 2814
2737 // XMLHttpRequest insecure content in synchronous mode. 2815 // XMLHttpRequest insecure content in synchronous mode.
2738 2816
2739 // XMLHttpRequest insecure content in asynchronous mode. 2817 // XMLHttpRequest insecure content in asynchronous mode.
2740 2818
2741 // XMLHttpRequest over bad ssl in synchronous mode. 2819 // XMLHttpRequest over bad ssl in synchronous mode.
2742 2820
2743 // XMLHttpRequest over OK ssl in synchronous mode. 2821 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698