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

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

Issue 1355413003: Move error classification into the ssl_errors component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove size_t / int mixing Created 5 years, 1 month 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') | chrome/browser/ssl/ssl_error_classification.h » ('j') | 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 "base/base_switches.h" 5 #include "base/base_switches.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 15 matching lines...) Expand all
26 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" 26 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h"
27 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/ssl/bad_clock_blocking_page.h" 28 #include "chrome/browser/ssl/bad_clock_blocking_page.h"
29 #include "chrome/browser/ssl/cert_report_helper.h" 29 #include "chrome/browser/ssl/cert_report_helper.h"
30 #include "chrome/browser/ssl/cert_verifier_browser_test.h" 30 #include "chrome/browser/ssl/cert_verifier_browser_test.h"
31 #include "chrome/browser/ssl/certificate_reporting_test_utils.h" 31 #include "chrome/browser/ssl/certificate_reporting_test_utils.h"
32 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" 32 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h"
33 #include "chrome/browser/ssl/common_name_mismatch_handler.h" 33 #include "chrome/browser/ssl/common_name_mismatch_handler.h"
34 #include "chrome/browser/ssl/security_state_model.h" 34 #include "chrome/browser/ssl/security_state_model.h"
35 #include "chrome/browser/ssl/ssl_blocking_page.h" 35 #include "chrome/browser/ssl/ssl_blocking_page.h"
36 #include "chrome/browser/ssl/ssl_error_classification.h"
37 #include "chrome/browser/ssl/ssl_error_handler.h" 36 #include "chrome/browser/ssl/ssl_error_handler.h"
38 #include "chrome/browser/ui/browser.h" 37 #include "chrome/browser/ui/browser.h"
39 #include "chrome/browser/ui/browser_commands.h" 38 #include "chrome/browser/ui/browser_commands.h"
40 #include "chrome/browser/ui/browser_navigator.h" 39 #include "chrome/browser/ui/browser_navigator.h"
41 #include "chrome/browser/ui/browser_navigator_params.h" 40 #include "chrome/browser/ui/browser_navigator_params.h"
42 #include "chrome/browser/ui/browser_tabstrip.h" 41 #include "chrome/browser/ui/browser_tabstrip.h"
43 #include "chrome/browser/ui/tabs/tab_strip_model.h" 42 #include "chrome/browser/ui/tabs/tab_strip_model.h"
44 #include "chrome/common/chrome_paths.h" 43 #include "chrome/common/chrome_paths.h"
45 #include "chrome/common/chrome_switches.h" 44 #include "chrome/common/chrome_switches.h"
46 #include "chrome/common/pref_names.h" 45 #include "chrome/common/pref_names.h"
47 #include "chrome/test/base/in_process_browser_test.h" 46 #include "chrome/test/base/in_process_browser_test.h"
48 #include "chrome/test/base/ui_test_utils.h" 47 #include "chrome/test/base/ui_test_utils.h"
49 #include "components/content_settings/core/browser/host_content_settings_map.h" 48 #include "components/content_settings/core/browser/host_content_settings_map.h"
50 #include "components/security_interstitials/core/metrics_helper.h" 49 #include "components/security_interstitials/core/metrics_helper.h"
50 #include "components/ssl_errors/error_classification.h"
51 #include "components/variations/variations_associated_data.h" 51 #include "components/variations/variations_associated_data.h"
52 #include "components/web_modal/web_contents_modal_dialog_manager.h" 52 #include "components/web_modal/web_contents_modal_dialog_manager.h"
53 #include "content/public/browser/browser_context.h" 53 #include "content/public/browser/browser_context.h"
54 #include "content/public/browser/cert_store.h" 54 #include "content/public/browser/cert_store.h"
55 #include "content/public/browser/interstitial_page.h" 55 #include "content/public/browser/interstitial_page.h"
56 #include "content/public/browser/navigation_controller.h" 56 #include "content/public/browser/navigation_controller.h"
57 #include "content/public/browser/navigation_entry.h" 57 #include "content/public/browser/navigation_entry.h"
58 #include "content/public/browser/notification_service.h" 58 #include "content/public/browser/notification_service.h"
59 #include "content/public/browser/render_frame_host.h" 59 #include "content/public/browser/render_frame_host.h"
60 #include "content/public/browser/render_view_host.h" 60 #include "content/public/browser/render_view_host.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 Browser* browser) { 500 Browser* browser) {
501 base::RunLoop run_loop; 501 base::RunLoop run_loop;
502 ASSERT_TRUE(https_server_expired_.Start()); 502 ASSERT_TRUE(https_server_expired_.Start());
503 ASSERT_NO_FATAL_FAILURE(SetUpMockReporter()); 503 ASSERT_NO_FATAL_FAILURE(SetUpMockReporter());
504 504
505 // Set up the build and current clock times to be more than a year apart. 505 // Set up the build and current clock times to be more than a year apart.
506 scoped_ptr<base::SimpleTestClock> mock_clock(new base::SimpleTestClock()); 506 scoped_ptr<base::SimpleTestClock> mock_clock(new base::SimpleTestClock());
507 mock_clock->SetNow(base::Time::NowFromSystemTime()); 507 mock_clock->SetNow(base::Time::NowFromSystemTime());
508 mock_clock->Advance(base::TimeDelta::FromDays(367)); 508 mock_clock->Advance(base::TimeDelta::FromDays(367));
509 SSLErrorHandler::SetClockForTest(mock_clock.get()); 509 SSLErrorHandler::SetClockForTest(mock_clock.get());
510 SSLErrorClassification::SetBuildTimeForTesting( 510 ssl_errors::SetBuildTimeForTesting(base::Time::NowFromSystemTime());
511 base::Time::NowFromSystemTime());
512 511
513 // Opt in to sending reports for invalid certificate chains. 512 // Opt in to sending reports for invalid certificate chains.
514 certificate_reporting_test_utils::SetCertReportingOptIn(browser, opt_in); 513 certificate_reporting_test_utils::SetCertReportingOptIn(browser, opt_in);
515 514
516 ui_test_utils::NavigateToURL(browser, https_server_expired_.GetURL("/")); 515 ui_test_utils::NavigateToURL(browser, https_server_expired_.GetURL("/"));
517 516
518 WebContents* tab = browser->tab_strip_model()->GetActiveWebContents(); 517 WebContents* tab = browser->tab_strip_model()->GetActiveWebContents();
519 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, 518 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
520 AuthState::SHOWING_INTERSTITIAL); 519 AuthState::SHOWING_INTERSTITIAL);
521 520
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 } 851 }
853 852
854 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorCausedByClock) { 853 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorCausedByClock) {
855 ASSERT_TRUE(https_server_expired_.Start()); 854 ASSERT_TRUE(https_server_expired_.Start());
856 855
857 // Set up the build and current clock times to be more than a year apart. 856 // Set up the build and current clock times to be more than a year apart.
858 scoped_ptr<base::SimpleTestClock> mock_clock(new base::SimpleTestClock()); 857 scoped_ptr<base::SimpleTestClock> mock_clock(new base::SimpleTestClock());
859 mock_clock->SetNow(base::Time::NowFromSystemTime()); 858 mock_clock->SetNow(base::Time::NowFromSystemTime());
860 mock_clock->Advance(base::TimeDelta::FromDays(367)); 859 mock_clock->Advance(base::TimeDelta::FromDays(367));
861 SSLErrorHandler::SetClockForTest(mock_clock.get()); 860 SSLErrorHandler::SetClockForTest(mock_clock.get());
862 SSLErrorClassification::SetBuildTimeForTesting( 861 ssl_errors::SetBuildTimeForTesting(base::Time::NowFromSystemTime());
863 base::Time::NowFromSystemTime());
864 862
865 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/")); 863 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/"));
866 WebContents* clock_tab = browser()->tab_strip_model()->GetActiveWebContents(); 864 WebContents* clock_tab = browser()->tab_strip_model()->GetActiveWebContents();
867 content::WaitForInterstitialAttach(clock_tab); 865 content::WaitForInterstitialAttach(clock_tab);
868 InterstitialPage* clock_interstitial = clock_tab->GetInterstitialPage(); 866 InterstitialPage* clock_interstitial = clock_tab->GetInterstitialPage();
869 ASSERT_TRUE(clock_interstitial); 867 ASSERT_TRUE(clock_interstitial);
870 EXPECT_EQ(BadClockBlockingPage::kTypeForTesting, 868 EXPECT_EQ(BadClockBlockingPage::kTypeForTesting,
871 clock_interstitial->GetDelegateForTesting()->GetTypeForTesting()); 869 clock_interstitial->GetDelegateForTesting()->GetTypeForTesting());
872 } 870 }
873 871
(...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after
2464 SSLStatusMatchesonClockInterstitialAndAfterProceed) { 2462 SSLStatusMatchesonClockInterstitialAndAfterProceed) {
2465 ASSERT_TRUE(https_server_expired_.Start()); 2463 ASSERT_TRUE(https_server_expired_.Start());
2466 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 2464 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2467 ASSERT_TRUE(tab); 2465 ASSERT_TRUE(tab);
2468 2466
2469 // Set up the build and current clock times to be more than a year apart. 2467 // Set up the build and current clock times to be more than a year apart.
2470 base::SimpleTestClock mock_clock; 2468 base::SimpleTestClock mock_clock;
2471 mock_clock.SetNow(base::Time::NowFromSystemTime()); 2469 mock_clock.SetNow(base::Time::NowFromSystemTime());
2472 mock_clock.Advance(base::TimeDelta::FromDays(367)); 2470 mock_clock.Advance(base::TimeDelta::FromDays(367));
2473 SSLErrorHandler::SetClockForTest(&mock_clock); 2471 SSLErrorHandler::SetClockForTest(&mock_clock);
2474 SSLErrorClassification::SetBuildTimeForTesting( 2472 ssl_errors::SetBuildTimeForTesting(base::Time::NowFromSystemTime());
2475 base::Time::NowFromSystemTime());
2476 2473
2477 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/")); 2474 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/"));
2478 content::WaitForInterstitialAttach(tab); 2475 content::WaitForInterstitialAttach(tab);
2479 InterstitialPage* clock_interstitial = tab->GetInterstitialPage(); 2476 InterstitialPage* clock_interstitial = tab->GetInterstitialPage();
2480 ASSERT_TRUE(clock_interstitial); 2477 ASSERT_TRUE(clock_interstitial);
2481 EXPECT_EQ(BadClockBlockingPage::kTypeForTesting, 2478 EXPECT_EQ(BadClockBlockingPage::kTypeForTesting,
2482 clock_interstitial->GetDelegateForTesting()->GetTypeForTesting()); 2479 clock_interstitial->GetDelegateForTesting()->GetTypeForTesting());
2483 2480
2484 // Grab the SSLStatus on the clock interstitial. 2481 // Grab the SSLStatus on the clock interstitial.
2485 content::NavigationEntry* entry = tab->GetController().GetActiveEntry(); 2482 content::NavigationEntry* entry = tab->GetController().GetActiveEntry();
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2881 2878
2882 // Visit a page over https that contains a frame with a redirect. 2879 // Visit a page over https that contains a frame with a redirect.
2883 2880
2884 // XMLHttpRequest insecure content in synchronous mode. 2881 // XMLHttpRequest insecure content in synchronous mode.
2885 2882
2886 // XMLHttpRequest insecure content in asynchronous mode. 2883 // XMLHttpRequest insecure content in asynchronous mode.
2887 2884
2888 // XMLHttpRequest over bad ssl in synchronous mode. 2885 // XMLHttpRequest over bad ssl in synchronous mode.
2889 2886
2890 // XMLHttpRequest over OK ssl in synchronous mode. 2887 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_blocking_page.cc ('k') | chrome/browser/ssl/ssl_error_classification.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698