Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
| 15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 16 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/test/histogram_tester.h" | 20 #include "base/test/histogram_tester.h" |
| 21 #include "base/test/simple_test_clock.h" | 21 #include "base/test/simple_test_clock.h" |
| 22 #include "base/threading/thread_task_runner_handle.h" | 22 #include "base/threading/thread_task_runner_handle.h" |
| 23 #include "base/time/default_clock.h" | |
| 24 #include "base/time/default_tick_clock.h" | |
| 23 #include "base/time/time.h" | 25 #include "base/time/time.h" |
| 24 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 25 #include "chrome/app/chrome_command_ids.h" | 27 #include "chrome/app/chrome_command_ids.h" |
| 26 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
| 27 #include "chrome/browser/chrome_notification_types.h" | 29 #include "chrome/browser/chrome_notification_types.h" |
| 28 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 30 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 29 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" | 31 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" |
| 30 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
| 31 #include "chrome/browser/ssl/bad_clock_blocking_page.h" | 33 #include "chrome/browser/ssl/bad_clock_blocking_page.h" |
| 32 #include "chrome/browser/ssl/cert_report_helper.h" | 34 #include "chrome/browser/ssl/cert_report_helper.h" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 43 #include "chrome/browser/ui/browser_navigator.h" | 45 #include "chrome/browser/ui/browser_navigator.h" |
| 44 #include "chrome/browser/ui/browser_navigator_params.h" | 46 #include "chrome/browser/ui/browser_navigator_params.h" |
| 45 #include "chrome/browser/ui/browser_tabstrip.h" | 47 #include "chrome/browser/ui/browser_tabstrip.h" |
| 46 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 48 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 47 #include "chrome/common/chrome_paths.h" | 49 #include "chrome/common/chrome_paths.h" |
| 48 #include "chrome/common/chrome_switches.h" | 50 #include "chrome/common/chrome_switches.h" |
| 49 #include "chrome/common/pref_names.h" | 51 #include "chrome/common/pref_names.h" |
| 50 #include "chrome/test/base/in_process_browser_test.h" | 52 #include "chrome/test/base/in_process_browser_test.h" |
| 51 #include "chrome/test/base/ui_test_utils.h" | 53 #include "chrome/test/base/ui_test_utils.h" |
| 52 #include "components/content_settings/core/browser/host_content_settings_map.h" | 54 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 55 #include "components/network_time/network_time_test_utils.h" | |
| 53 #include "components/network_time/network_time_tracker.h" | 56 #include "components/network_time/network_time_tracker.h" |
| 54 #include "components/prefs/pref_service.h" | 57 #include "components/prefs/testing_pref_service.h" |
| 55 #include "components/security_interstitials/core/controller_client.h" | 58 #include "components/security_interstitials/core/controller_client.h" |
| 56 #include "components/security_interstitials/core/metrics_helper.h" | 59 #include "components/security_interstitials/core/metrics_helper.h" |
| 57 #include "components/security_state/security_state_model.h" | 60 #include "components/security_state/security_state_model.h" |
| 58 #include "components/security_state/switches.h" | 61 #include "components/security_state/switches.h" |
| 59 #include "components/ssl_errors/error_classification.h" | 62 #include "components/ssl_errors/error_classification.h" |
| 60 #include "components/variations/variations_associated_data.h" | 63 #include "components/variations/variations_associated_data.h" |
| 61 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 64 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 62 #include "content/public/browser/browser_context.h" | 65 #include "content/public/browser/browser_context.h" |
| 63 #include "content/public/browser/interstitial_page.h" | 66 #include "content/public/browser/interstitial_page.h" |
| 64 #include "content/public/browser/navigation_controller.h" | 67 #include "content/public/browser/navigation_controller.h" |
| (...skipping 2781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2846 | 2849 |
| 2847 // Grab the SSLStatus from the page and check that it is the same as | 2850 // Grab the SSLStatus from the page and check that it is the same as |
| 2848 // on the clock interstitial. | 2851 // on the clock interstitial. |
| 2849 entry = tab->GetController().GetActiveEntry(); | 2852 entry = tab->GetController().GetActiveEntry(); |
| 2850 ASSERT_TRUE(entry); | 2853 ASSERT_TRUE(entry); |
| 2851 content::SSLStatus after_interstitial_ssl_status = entry->GetSSL(); | 2854 content::SSLStatus after_interstitial_ssl_status = entry->GetSSL(); |
| 2852 ASSERT_NO_FATAL_FAILURE( | 2855 ASSERT_NO_FATAL_FAILURE( |
| 2853 after_interstitial_ssl_status.Equals(clock_interstitial_ssl_status)); | 2856 after_interstitial_ssl_status.Equals(clock_interstitial_ssl_status)); |
| 2854 } | 2857 } |
| 2855 | 2858 |
| 2859 // A fixture for testing on-demand network time queries on SSL | |
| 2860 // certificate date errors. | |
|
meacer
2016/11/01 22:20:18
nit: Can you also document the capabilities of thi
estark
2016/11/02 19:58:12
Done.
| |
| 2861 class SSLNetworkTimeBrowserTest : public SSLUITest { | |
| 2862 public: | |
| 2863 SSLNetworkTimeBrowserTest() | |
| 2864 : SSLUITest(), | |
| 2865 field_trial_test_( | |
| 2866 network_time::FieldTrialTest::CreateForBrowserTest()) {} | |
| 2867 ~SSLNetworkTimeBrowserTest() override {} | |
| 2868 | |
| 2869 protected: | |
| 2870 enum TimeServerBehavior { | |
| 2871 TIME_SERVER_GOOD_RESPONSE, | |
| 2872 TIME_SERVER_HANG, | |
| 2873 }; | |
| 2874 | |
| 2875 network_time::FieldTrialTest* field_trial_test() { | |
|
meacer
2016/11/01 22:20:17
const method
estark
2016/11/02 19:58:13
Done.
| |
| 2876 return field_trial_test_.get(); | |
| 2877 } | |
| 2878 | |
| 2879 // Returns a response that hangs. | |
| 2880 static std::unique_ptr<net::test_server::HttpResponse> HangingResponseHandler( | |
| 2881 const net::test_server::HttpRequest& request) { | |
| 2882 return base::MakeUnique<net::test_server::HungResponse>(); | |
| 2883 } | |
| 2884 | |
| 2885 // Returns a valid time response when |run_loop| quits. | |
| 2886 static std::unique_ptr<net::test_server::HttpResponse> | |
| 2887 WaitingGoodTimeResponseHandler(base::RunLoop* run_loop, | |
|
meacer
2016/11/01 22:20:18
nit: Waiting -> Delayed? (I don't feel strongly ab
estark
2016/11/02 19:58:12
Done.
| |
| 2888 const net::test_server::HttpRequest& request) { | |
| 2889 run_loop->Run(); | |
| 2890 return network_time::GoodTimeResponseHandler(request); | |
| 2891 } | |
| 2892 | |
| 2893 void SetUpNetworkTimeServer(TimeServerBehavior behavior) { | |
| 2894 field_trial_test()->SetNetworkQueriesWithVariationsService( | |
| 2895 true, 0.0, network_time::FieldTrialTest::FETCHES_ON_DEMAND_ONLY); | |
| 2896 | |
| 2897 switch (behavior) { | |
| 2898 case TIME_SERVER_GOOD_RESPONSE: | |
| 2899 embedded_test_server()->RegisterRequestHandler(base::Bind( | |
| 2900 &SSLNetworkTimeBrowserTest::WaitingGoodTimeResponseHandler, | |
| 2901 &waiting_good_time_run_loop_)); | |
| 2902 break; | |
| 2903 case TIME_SERVER_HANG: | |
| 2904 embedded_test_server()->RegisterRequestHandler( | |
| 2905 base::Bind(&SSLNetworkTimeBrowserTest::HangingResponseHandler)); | |
| 2906 break; | |
| 2907 } | |
| 2908 ASSERT_TRUE(embedded_test_server()->Start()); | |
| 2909 g_browser_process->network_time_tracker()->SetTimeServerURLForTesting( | |
| 2910 embedded_test_server()->GetURL("/")); | |
| 2911 } | |
| 2912 | |
| 2913 void TriggerGoodTimeResponse() { | |
| 2914 waiting_good_time_run_loop_.QuitClosure().Run(); | |
| 2915 } | |
| 2916 | |
| 2917 private: | |
| 2918 std::unique_ptr<network_time::FieldTrialTest> field_trial_test_; | |
| 2919 base::RunLoop waiting_good_time_run_loop_; | |
| 2920 | |
| 2921 DISALLOW_COPY_AND_ASSIGN(SSLNetworkTimeBrowserTest); | |
| 2922 }; | |
| 2923 | |
| 2924 // Tests that if an on-demand network time fetch returns that the clock | |
| 2925 // is okay, a normal SSL interstitial is shown. | |
| 2926 IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest, OnDemandFetchClockOk) { | |
| 2927 ASSERT_TRUE(https_server_expired_.Start()); | |
| 2928 SetUpNetworkTimeServer(TIME_SERVER_GOOD_RESPONSE); | |
| 2929 // Use a testing clock set to the time that GoodTimeResponseHandler | |
| 2930 // returns, to simulate the system clock matching the network time. | |
| 2931 base::SimpleTestClock testing_clock; | |
| 2932 SSLErrorHandler::SetClockForTest(&testing_clock); | |
| 2933 testing_clock.SetNow( | |
| 2934 base::Time::FromJsTime(network_time::kGoodTimeResponseHandlerTime)); | |
| 2935 | |
| 2936 // Set a long timeout to ensure that the on-demand time fetch completes. | |
| 2937 SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta::FromHours(1)); | |
| 2938 | |
| 2939 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | |
| 2940 ASSERT_TRUE(contents); | |
| 2941 SSLInterstitialTimerObserver interstitial_timer_observer(contents); | |
| 2942 | |
| 2943 content::WindowedNotificationObserver observer( | |
| 2944 content::NOTIFICATION_LOAD_STOP, | |
| 2945 content::NotificationService::AllSources()); | |
| 2946 ui_test_utils::NavigateToURLWithDisposition( | |
| 2947 browser(), https_server_expired_.GetURL("/"), | |
| 2948 WindowOpenDisposition::CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); | |
| 2949 | |
| 2950 // Once |interstitial_timer_observer| has fired, the request has been | |
| 2951 // sent. Override the nonce that NetworkTimeTracker expects so that | |
| 2952 // when the response comes back, it will validate. The nonce can only | |
| 2953 // be overriden for the current in-flight request, so the test must | |
| 2954 // call OverrideNonceForTesting() after the request has been sent and | |
| 2955 // before the response has been received. | |
| 2956 interstitial_timer_observer.WaitForTimerStarted(); | |
| 2957 g_browser_process->network_time_tracker()->OverrideNonceForTesting(123123123); | |
| 2958 TriggerGoodTimeResponse(); | |
| 2959 | |
| 2960 EXPECT_TRUE(contents->IsLoading()); | |
| 2961 observer.Wait(); | |
| 2962 | |
| 2963 EXPECT_TRUE(contents->ShowingInterstitialPage()); | |
| 2964 InterstitialPage* interstitial_page = contents->GetInterstitialPage(); | |
| 2965 ASSERT_TRUE(interstitial_page); | |
| 2966 ASSERT_EQ(SSLBlockingPage::kTypeForTesting, | |
| 2967 interstitial_page->GetDelegateForTesting()->GetTypeForTesting()); | |
| 2968 } | |
| 2969 | |
| 2970 // Tests that if an on-demand network time fetch returns that the clock | |
| 2971 // is wrong, a bad clock interstitial is shown. | |
| 2972 IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest, OnDemandFetchClockWrong) { | |
|
meacer
2016/11/01 22:20:18
My understanding is that this test sets the clock
estark
2016/11/02 19:58:13
The purpose of setting the test clock is actually
| |
| 2973 ASSERT_TRUE(https_server_expired_.Start()); | |
| 2974 SetUpNetworkTimeServer(TIME_SERVER_GOOD_RESPONSE); | |
| 2975 // Use a testing clock set to a time that is different from what | |
| 2976 // GoodTimeResponseHandler returns, simulating a system clock that is | |
| 2977 // 30 days ahead of the network time. | |
| 2978 base::SimpleTestClock testing_clock; | |
| 2979 SSLErrorHandler::SetClockForTest(&testing_clock); | |
| 2980 testing_clock.SetNow( | |
| 2981 base::Time::FromJsTime(network_time::kGoodTimeResponseHandlerTime)); | |
|
meacer
2016/11/01 22:20:17
Is there a particular reason to use JS time and ma
estark
2016/11/02 19:58:12
My thinking here is that it should be relatively e
meacer
2016/11/02 22:43:22
Ah, okay. Would it help to rename kGoodTimeRespons
| |
| 2982 testing_clock.Advance(base::TimeDelta::FromDays(30)); | |
| 2983 | |
| 2984 // Set a long timeout to ensure that the on-demand time fetch completes. | |
| 2985 SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta::FromHours(1)); | |
| 2986 | |
| 2987 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | |
| 2988 ASSERT_TRUE(contents); | |
| 2989 SSLInterstitialTimerObserver interstitial_timer_observer(contents); | |
| 2990 | |
| 2991 content::WindowedNotificationObserver observer( | |
| 2992 content::NOTIFICATION_LOAD_STOP, | |
| 2993 content::NotificationService::AllSources()); | |
| 2994 | |
| 2995 ui_test_utils::NavigateToURLWithDisposition( | |
| 2996 browser(), https_server_expired_.GetURL("/"), | |
| 2997 WindowOpenDisposition::CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); | |
| 2998 | |
| 2999 // Once |interstitial_timer_observer| has fired, the request has been | |
| 3000 // sent. Override the nonce that NetworkTimeTracker expects so that | |
| 3001 // when the response comes back, it will validate. The nonce can only | |
| 3002 // be overriden for the current in-flight request, so the test must | |
| 3003 // call OverrideNonceForTesting() after the request has been sent and | |
| 3004 // before the response has been received. | |
| 3005 interstitial_timer_observer.WaitForTimerStarted(); | |
| 3006 g_browser_process->network_time_tracker()->OverrideNonceForTesting(123123123); | |
| 3007 TriggerGoodTimeResponse(); | |
| 3008 | |
| 3009 EXPECT_TRUE(contents->IsLoading()); | |
| 3010 observer.Wait(); | |
|
meacer
2016/11/01 22:20:18
You might also want to put a WaitForInterstitialAt
estark
2016/11/02 19:58:12
Done.
| |
| 3011 | |
| 3012 EXPECT_TRUE(contents->ShowingInterstitialPage()); | |
| 3013 InterstitialPage* interstitial_page = contents->GetInterstitialPage(); | |
| 3014 ASSERT_TRUE(interstitial_page); | |
| 3015 ASSERT_EQ(BadClockBlockingPage::kTypeForTesting, | |
| 3016 interstitial_page->GetDelegateForTesting()->GetTypeForTesting()); | |
| 3017 } | |
| 3018 | |
| 3019 // Tests that if the timeout expires before the network time fetch | |
| 3020 // returns, then a normal SSL intersitial is shown. | |
| 3021 IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest, | |
| 3022 TimeoutExpiresBeforeFetchCompletes) { | |
| 3023 ASSERT_TRUE(https_server_expired_.Start()); | |
| 3024 SetUpNetworkTimeServer(TIME_SERVER_HANG); | |
| 3025 // Set the timer to fire immediately. | |
| 3026 SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta()); | |
| 3027 | |
| 3028 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/")); | |
| 3029 | |
| 3030 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | |
| 3031 ASSERT_TRUE(contents); | |
| 3032 EXPECT_TRUE(contents->ShowingInterstitialPage()); | |
| 3033 InterstitialPage* interstitial_page = contents->GetInterstitialPage(); | |
| 3034 ASSERT_TRUE(interstitial_page); | |
| 3035 ASSERT_EQ(SSLBlockingPage::kTypeForTesting, | |
| 3036 interstitial_page->GetDelegateForTesting()->GetTypeForTesting()); | |
| 3037 } | |
| 3038 | |
| 3039 // Tests that if the user stops the page load before either the network | |
| 3040 // time fetch completes or the timeout expires, then there is no interstitial. | |
| 3041 IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest, StopBeforeTimeoutExpires) { | |
| 3042 ASSERT_TRUE(https_server_expired_.Start()); | |
| 3043 SetUpNetworkTimeServer(TIME_SERVER_HANG); | |
| 3044 // Set the timer to a long delay. | |
| 3045 SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta::FromHours(1)); | |
| 3046 | |
| 3047 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | |
| 3048 ASSERT_TRUE(contents); | |
| 3049 SSLInterstitialTimerObserver interstitial_timer_observer(contents); | |
| 3050 | |
| 3051 ui_test_utils::NavigateToURLWithDisposition( | |
| 3052 browser(), https_server_expired_.GetURL("/"), | |
| 3053 WindowOpenDisposition::CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); | |
|
meacer
2016/11/01 22:20:17
Is there a reason not to use ui_test_utils::Naviga
estark
2016/11/02 19:58:12
This is based on CommonNameMismatchBrowserTest.Int
meacer
2016/11/02 22:43:22
Hmm, the documentation of this method says that th
| |
| 3054 interstitial_timer_observer.WaitForTimerStarted(); | |
| 3055 | |
| 3056 EXPECT_TRUE(contents->IsLoading()); | |
| 3057 content::WindowedNotificationObserver observer( | |
| 3058 content::NOTIFICATION_LOAD_STOP, | |
| 3059 content::NotificationService::AllSources()); | |
| 3060 contents->Stop(); | |
| 3061 observer.Wait(); | |
| 3062 | |
| 3063 SSLErrorHandler* ssl_error_handler = | |
| 3064 SSLErrorHandler::FromWebContents(contents); | |
| 3065 // Make sure that the |SSLErrorHandler| is deleted. | |
| 3066 EXPECT_FALSE(ssl_error_handler); | |
|
meacer
2016/11/01 22:20:17
Nit: single line?
EXPECT_FALSE(SSLErrorHandler::Fr
estark
2016/11/02 19:58:12
Done.
| |
| 3067 EXPECT_FALSE(contents->ShowingInterstitialPage()); | |
| 3068 EXPECT_FALSE(contents->IsLoading()); | |
| 3069 } | |
| 3070 | |
| 3071 // Tests that if the user reloads the page before either the network | |
| 3072 // time fetch completes or the timeout expires, then there is no interstitial. | |
| 3073 IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest, ReloadBeforeTimeoutExpires) { | |
| 3074 ASSERT_TRUE(https_server_expired_.Start()); | |
| 3075 SetUpNetworkTimeServer(TIME_SERVER_HANG); | |
| 3076 // Set the timer to a long delay. | |
| 3077 SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta::FromHours(1)); | |
| 3078 | |
| 3079 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | |
| 3080 SSLInterstitialTimerObserver interstitial_timer_observer(contents); | |
| 3081 | |
| 3082 ui_test_utils::NavigateToURLWithDisposition( | |
| 3083 browser(), https_server_expired_.GetURL("/"), | |
| 3084 WindowOpenDisposition::CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); | |
|
meacer
2016/11/01 22:20:18
Same as above: ui_test_utils::NavigateToURL?
estark
2016/11/02 19:58:13
See above
| |
| 3085 interstitial_timer_observer.WaitForTimerStarted(); | |
| 3086 | |
| 3087 EXPECT_TRUE(contents->IsLoading()); | |
| 3088 content::TestNavigationObserver observer(contents, 1); | |
| 3089 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); | |
| 3090 observer.Wait(); | |
| 3091 | |
| 3092 SSLErrorHandler* ssl_error_handler = | |
| 3093 SSLErrorHandler::FromWebContents(contents); | |
|
meacer
2016/11/01 22:20:17
Same as above: single line?
estark
2016/11/02 19:58:13
Done.
| |
| 3094 // Make sure that the |SSLErrorHandler| is deleted. | |
| 3095 EXPECT_FALSE(ssl_error_handler); | |
| 3096 EXPECT_FALSE(contents->ShowingInterstitialPage()); | |
| 3097 EXPECT_FALSE(contents->IsLoading()); | |
| 3098 } | |
| 3099 | |
| 3100 // Tests that if the user navigates away before either the network time | |
| 3101 // fetch completes or the timeout expires, then there is no | |
|
meacer
2016/11/01 22:20:18
I think we can improve test and the ones above. We
estark
2016/11/02 19:58:13
Done. This turns out to be a nice simplification b
| |
| 3102 // interstitial. | |
| 3103 IN_PROC_BROWSER_TEST_F(SSLNetworkTimeBrowserTest, | |
| 3104 NavigateAwayBeforeTimeoutExpires) { | |
| 3105 ASSERT_TRUE(https_server_expired_.Start()); | |
| 3106 ASSERT_TRUE(https_server_.Start()); | |
| 3107 SetUpNetworkTimeServer(TIME_SERVER_HANG); | |
| 3108 // Set the timer to a long delay. | |
| 3109 SSLErrorHandler::SetInterstitialDelayForTest(base::TimeDelta::FromHours(1)); | |
| 3110 | |
| 3111 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | |
| 3112 SSLInterstitialTimerObserver interstitial_timer_observer(contents); | |
| 3113 | |
| 3114 ui_test_utils::NavigateToURLWithDisposition( | |
| 3115 browser(), https_server_expired_.GetURL("/"), | |
| 3116 WindowOpenDisposition::CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); | |
| 3117 interstitial_timer_observer.WaitForTimerStarted(); | |
| 3118 | |
| 3119 EXPECT_TRUE(contents->IsLoading()); | |
| 3120 content::TestNavigationObserver observer(contents, 1); | |
| 3121 browser()->OpenURL(content::OpenURLParams( | |
| 3122 https_server_.GetURL("/"), content::Referrer(), | |
| 3123 WindowOpenDisposition::CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false)); | |
| 3124 observer.Wait(); | |
| 3125 | |
| 3126 SSLErrorHandler* ssl_error_handler = | |
| 3127 SSLErrorHandler::FromWebContents(contents); | |
| 3128 // Make sure that the |SSLErrorHandler| is deleted. | |
| 3129 EXPECT_FALSE(ssl_error_handler); | |
| 3130 EXPECT_FALSE(contents->ShowingInterstitialPage()); | |
| 3131 EXPECT_FALSE(contents->IsLoading()); | |
| 3132 } | |
| 3133 | |
|
meacer
2016/11/01 22:20:17
Maybe add another test where the tab is closed? Yo
estark
2016/11/02 19:58:13
Done.
| |
| 2856 class CommonNameMismatchBrowserTest : public CertVerifierBrowserTest { | 3134 class CommonNameMismatchBrowserTest : public CertVerifierBrowserTest { |
| 2857 public: | 3135 public: |
| 2858 CommonNameMismatchBrowserTest() : CertVerifierBrowserTest() {} | 3136 CommonNameMismatchBrowserTest() : CertVerifierBrowserTest() {} |
| 2859 ~CommonNameMismatchBrowserTest() override {} | 3137 ~CommonNameMismatchBrowserTest() override {} |
| 2860 | 3138 |
| 2861 void SetUpCommandLine(base::CommandLine* command_line) override { | 3139 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 2862 // Enable finch experiment for SSL common name mismatch handling. | 3140 // Enable finch experiment for SSL common name mismatch handling. |
| 2863 command_line->AppendSwitchASCII(switches::kForceFieldTrials, | 3141 command_line->AppendSwitchASCII(switches::kForceFieldTrials, |
| 2864 "SSLCommonNameMismatchHandling/Enabled/"); | 3142 "SSLCommonNameMismatchHandling/Enabled/"); |
| 2865 } | 3143 } |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3410 | 3688 |
| 3411 // Visit a page over https that contains a frame with a redirect. | 3689 // Visit a page over https that contains a frame with a redirect. |
| 3412 | 3690 |
| 3413 // XMLHttpRequest insecure content in synchronous mode. | 3691 // XMLHttpRequest insecure content in synchronous mode. |
| 3414 | 3692 |
| 3415 // XMLHttpRequest insecure content in asynchronous mode. | 3693 // XMLHttpRequest insecure content in asynchronous mode. |
| 3416 | 3694 |
| 3417 // XMLHttpRequest over bad ssl in synchronous mode. | 3695 // XMLHttpRequest over bad ssl in synchronous mode. |
| 3418 | 3696 |
| 3419 // XMLHttpRequest over OK ssl in synchronous mode. | 3697 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |