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

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: 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 13 matching lines...) Expand all
24 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" 24 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h"
25 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/ssl/bad_clock_blocking_page.h" 26 #include "chrome/browser/ssl/bad_clock_blocking_page.h"
27 #include "chrome/browser/ssl/cert_report_helper.h" 27 #include "chrome/browser/ssl/cert_report_helper.h"
28 #include "chrome/browser/ssl/cert_verifier_browser_test.h" 28 #include "chrome/browser/ssl/cert_verifier_browser_test.h"
29 #include "chrome/browser/ssl/certificate_reporting_test_utils.h" 29 #include "chrome/browser/ssl/certificate_reporting_test_utils.h"
30 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" 30 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h"
31 #include "chrome/browser/ssl/common_name_mismatch_handler.h" 31 #include "chrome/browser/ssl/common_name_mismatch_handler.h"
32 #include "chrome/browser/ssl/security_state_model.h" 32 #include "chrome/browser/ssl/security_state_model.h"
33 #include "chrome/browser/ssl/ssl_blocking_page.h" 33 #include "chrome/browser/ssl/ssl_blocking_page.h"
34 #include "chrome/browser/ssl/ssl_error_classification.h"
35 #include "chrome/browser/ssl/ssl_error_handler.h" 34 #include "chrome/browser/ssl/ssl_error_handler.h"
36 #include "chrome/browser/ui/browser.h" 35 #include "chrome/browser/ui/browser.h"
37 #include "chrome/browser/ui/browser_commands.h" 36 #include "chrome/browser/ui/browser_commands.h"
38 #include "chrome/browser/ui/browser_navigator.h" 37 #include "chrome/browser/ui/browser_navigator.h"
39 #include "chrome/browser/ui/browser_tabstrip.h" 38 #include "chrome/browser/ui/browser_tabstrip.h"
40 #include "chrome/browser/ui/tabs/tab_strip_model.h" 39 #include "chrome/browser/ui/tabs/tab_strip_model.h"
41 #include "chrome/common/chrome_paths.h" 40 #include "chrome/common/chrome_paths.h"
42 #include "chrome/common/chrome_switches.h" 41 #include "chrome/common/chrome_switches.h"
43 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
44 #include "chrome/test/base/in_process_browser_test.h" 43 #include "chrome/test/base/in_process_browser_test.h"
45 #include "chrome/test/base/ui_test_utils.h" 44 #include "chrome/test/base/ui_test_utils.h"
46 #include "components/content_settings/core/browser/host_content_settings_map.h" 45 #include "components/content_settings/core/browser/host_content_settings_map.h"
47 #include "components/security_interstitials/core/metrics_helper.h" 46 #include "components/security_interstitials/core/metrics_helper.h"
47 #include "components/ssl_errors/error_classification.h"
48 #include "components/variations/variations_associated_data.h" 48 #include "components/variations/variations_associated_data.h"
49 #include "components/web_modal/web_contents_modal_dialog_manager.h" 49 #include "components/web_modal/web_contents_modal_dialog_manager.h"
50 #include "content/public/browser/browser_context.h" 50 #include "content/public/browser/browser_context.h"
51 #include "content/public/browser/cert_store.h" 51 #include "content/public/browser/cert_store.h"
52 #include "content/public/browser/interstitial_page.h" 52 #include "content/public/browser/interstitial_page.h"
53 #include "content/public/browser/navigation_controller.h" 53 #include "content/public/browser/navigation_controller.h"
54 #include "content/public/browser/navigation_entry.h" 54 #include "content/public/browser/navigation_entry.h"
55 #include "content/public/browser/notification_service.h" 55 #include "content/public/browser/notification_service.h"
56 #include "content/public/browser/render_frame_host.h" 56 #include "content/public/browser/render_frame_host.h"
57 #include "content/public/browser/render_view_host.h" 57 #include "content/public/browser/render_view_host.h"
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 } 801 }
802 802
803 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorCausedByClock) { 803 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorCausedByClock) {
804 ASSERT_TRUE(https_server_expired_.Start()); 804 ASSERT_TRUE(https_server_expired_.Start());
805 805
806 // Set up the build and current clock times to be more than a year apart. 806 // Set up the build and current clock times to be more than a year apart.
807 scoped_ptr<base::SimpleTestClock> mock_clock(new base::SimpleTestClock()); 807 scoped_ptr<base::SimpleTestClock> mock_clock(new base::SimpleTestClock());
808 mock_clock->SetNow(base::Time::NowFromSystemTime()); 808 mock_clock->SetNow(base::Time::NowFromSystemTime());
809 mock_clock->Advance(base::TimeDelta::FromDays(367)); 809 mock_clock->Advance(base::TimeDelta::FromDays(367));
810 SSLErrorHandler::SetClockForTest(mock_clock.get()); 810 SSLErrorHandler::SetClockForTest(mock_clock.get());
811 SSLErrorClassification::SetBuildTimeForTesting( 811 ssl_errors::ErrorClassification::SetBuildTimeForTesting(
812 base::Time::NowFromSystemTime()); 812 base::Time::NowFromSystemTime());
813 813
814 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/")); 814 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/"));
815 WebContents* clock_tab = browser()->tab_strip_model()->GetActiveWebContents(); 815 WebContents* clock_tab = browser()->tab_strip_model()->GetActiveWebContents();
816 content::WaitForInterstitialAttach(clock_tab); 816 content::WaitForInterstitialAttach(clock_tab);
817 InterstitialPage* clock_interstitial = clock_tab->GetInterstitialPage(); 817 InterstitialPage* clock_interstitial = clock_tab->GetInterstitialPage();
818 ASSERT_TRUE(clock_interstitial); 818 ASSERT_TRUE(clock_interstitial);
819 EXPECT_EQ(BadClockBlockingPage::kTypeForTesting, 819 EXPECT_EQ(BadClockBlockingPage::kTypeForTesting,
820 clock_interstitial->GetDelegateForTesting()->GetTypeForTesting()); 820 clock_interstitial->GetDelegateForTesting()->GetTypeForTesting());
821 } 821 }
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after
2413 SSLStatusMatchesonClockInterstitialAndAfterProceed) { 2413 SSLStatusMatchesonClockInterstitialAndAfterProceed) {
2414 ASSERT_TRUE(https_server_expired_.Start()); 2414 ASSERT_TRUE(https_server_expired_.Start());
2415 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 2415 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2416 ASSERT_TRUE(tab); 2416 ASSERT_TRUE(tab);
2417 2417
2418 // Set up the build and current clock times to be more than a year apart. 2418 // Set up the build and current clock times to be more than a year apart.
2419 base::SimpleTestClock mock_clock; 2419 base::SimpleTestClock mock_clock;
2420 mock_clock.SetNow(base::Time::NowFromSystemTime()); 2420 mock_clock.SetNow(base::Time::NowFromSystemTime());
2421 mock_clock.Advance(base::TimeDelta::FromDays(367)); 2421 mock_clock.Advance(base::TimeDelta::FromDays(367));
2422 SSLErrorHandler::SetClockForTest(&mock_clock); 2422 SSLErrorHandler::SetClockForTest(&mock_clock);
2423 SSLErrorClassification::SetBuildTimeForTesting( 2423 ssl_errors::ErrorClassification::SetBuildTimeForTesting(
2424 base::Time::NowFromSystemTime()); 2424 base::Time::NowFromSystemTime());
2425 2425
2426 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/")); 2426 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/"));
2427 content::WaitForInterstitialAttach(tab); 2427 content::WaitForInterstitialAttach(tab);
2428 InterstitialPage* clock_interstitial = tab->GetInterstitialPage(); 2428 InterstitialPage* clock_interstitial = tab->GetInterstitialPage();
2429 ASSERT_TRUE(clock_interstitial); 2429 ASSERT_TRUE(clock_interstitial);
2430 EXPECT_EQ(BadClockBlockingPage::kTypeForTesting, 2430 EXPECT_EQ(BadClockBlockingPage::kTypeForTesting,
2431 clock_interstitial->GetDelegateForTesting()->GetTypeForTesting()); 2431 clock_interstitial->GetDelegateForTesting()->GetTypeForTesting());
2432 2432
2433 // Grab the SSLStatus on the clock interstitial. 2433 // Grab the SSLStatus on the clock interstitial.
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
2836 2836
2837 // Visit a page over https that contains a frame with a redirect. 2837 // Visit a page over https that contains a frame with a redirect.
2838 2838
2839 // XMLHttpRequest insecure content in synchronous mode. 2839 // XMLHttpRequest insecure content in synchronous mode.
2840 2840
2841 // XMLHttpRequest insecure content in asynchronous mode. 2841 // XMLHttpRequest insecure content in asynchronous mode.
2842 2842
2843 // XMLHttpRequest over bad ssl in synchronous mode. 2843 // XMLHttpRequest over bad ssl in synchronous mode.
2844 2844
2845 // XMLHttpRequest over OK ssl in synchronous mode. 2845 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698