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

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

Issue 2620203003: Add initial version of captive portal list checking. (Closed)
Patch Set: rsleevi comments Created 3 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/ssl/ssl_error_handler.h" 5 #include "chrome/browser/ssl/ssl_error_handler.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/test/histogram_tester.h" 12 #include "base/test/histogram_tester.h"
13 #include "base/test/scoped_feature_list.h"
13 #include "base/test/simple_test_clock.h" 14 #include "base/test/simple_test_clock.h"
14 #include "base/test/simple_test_tick_clock.h" 15 #include "base/test/simple_test_tick_clock.h"
15 #include "base/time/time.h" 16 #include "base/time/time.h"
16 #include "chrome/browser/captive_portal/captive_portal_service.h" 17 #include "chrome/browser/captive_portal/captive_portal_service.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ssl/common_name_mismatch_handler.h" 19 #include "chrome/browser/ssl/common_name_mismatch_handler.h"
20 #include "chrome/browser/ssl/ssl_error_assistant.pb.h"
19 #include "chrome/common/features.h" 21 #include "chrome/common/features.h"
20 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 22 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
21 #include "chrome/test/base/testing_profile.h" 23 #include "chrome/test/base/testing_profile.h"
22 #include "components/captive_portal/captive_portal_testing_utils.h" 24 #include "components/captive_portal/captive_portal_testing_utils.h"
23 #include "components/network_time/network_time_test_utils.h" 25 #include "components/network_time/network_time_test_utils.h"
24 #include "components/network_time/network_time_tracker.h" 26 #include "components/network_time/network_time_tracker.h"
25 #include "components/prefs/testing_pref_service.h" 27 #include "components/prefs/testing_pref_service.h"
26 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
27 #include "content/public/browser/notification_service.h" 29 #include "content/public/browser/notification_service.h"
28 #include "net/base/net_errors.h" 30 #include "net/base/net_errors.h"
29 #include "net/cert/cert_status_flags.h" 31 #include "net/cert/cert_status_flags.h"
30 #include "net/cert/x509_certificate.h" 32 #include "net/cert/x509_certificate.h"
31 #include "net/http/http_response_headers.h" 33 #include "net/http/http_response_headers.h"
32 #include "net/ssl/ssl_info.h" 34 #include "net/ssl/ssl_info.h"
33 #include "net/test/cert_test_util.h" 35 #include "net/test/cert_test_util.h"
34 #include "net/test/embedded_test_server/embedded_test_server.h" 36 #include "net/test/embedded_test_server/embedded_test_server.h"
35 #include "net/test/embedded_test_server/http_response.h" 37 #include "net/test/embedded_test_server/http_response.h"
36 #include "net/test/test_certificate_data.h" 38 #include "net/test/test_certificate_data.h"
37 #include "net/test/test_data_directory.h" 39 #include "net/test/test_data_directory.h"
38 #include "net/url_request/url_request_test_util.h" 40 #include "net/url_request/url_request_test_util.h"
39 #include "testing/gtest/include/gtest/gtest.h" 41 #include "testing/gtest/include/gtest/gtest.h"
40 42
41 namespace { 43 namespace {
42 44
43 const char kCertDateErrorHistogram[] = 45 const char kCertDateErrorHistogram[] =
44 "interstitial.ssl_error_handler.cert_date_error_delay"; 46 "interstitial.ssl_error_handler.cert_date_error_delay";
45 47
48 const net::SHA256HashValue kCertPublicKeyHashValue = {{0x01, 0x02}};
49
46 // Runs |quit_closure| on the UI thread once a URL request has been 50 // Runs |quit_closure| on the UI thread once a URL request has been
47 // seen. Returns a request that hangs. 51 // seen. Returns a request that hangs.
48 std::unique_ptr<net::test_server::HttpResponse> WaitForRequest( 52 std::unique_ptr<net::test_server::HttpResponse> WaitForRequest(
49 const base::Closure& quit_closure, 53 const base::Closure& quit_closure,
50 const net::test_server::HttpRequest& request) { 54 const net::test_server::HttpRequest& request) {
51 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 55 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
52 quit_closure); 56 quit_closure);
53 return base::MakeUnique<net::test_server::HungResponse>(); 57 return base::MakeUnique<net::test_server::HungResponse>();
54 } 58 }
55 59
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 bool captive_portal_interstitial_shown_; 184 bool captive_portal_interstitial_shown_;
181 bool redirected_to_suggested_url_; 185 bool redirected_to_suggested_url_;
182 bool is_overridable_error_; 186 bool is_overridable_error_;
183 CommonNameMismatchHandler::CheckUrlCallback suggested_url_callback_; 187 CommonNameMismatchHandler::CheckUrlCallback suggested_url_callback_;
184 188
185 DISALLOW_COPY_AND_ASSIGN(TestSSLErrorHandlerDelegate); 189 DISALLOW_COPY_AND_ASSIGN(TestSSLErrorHandlerDelegate);
186 }; 190 };
187 191
188 } // namespace 192 } // namespace
189 193
190 class SSLErrorHandlerNameMismatchTest : public ChromeRenderViewHostTestHarness { 194 template <net::CertStatus cert_status>
195 class SSLErrorHandlerCertStatusTestBase
196 : public ChromeRenderViewHostTestHarness {
191 public: 197 public:
192 SSLErrorHandlerNameMismatchTest() : field_trial_list_(nullptr) {} 198 SSLErrorHandlerCertStatusTestBase() : field_trial_list_(nullptr) {}
193 199
194 void SetUp() override { 200 void SetUp() override {
195 ChromeRenderViewHostTestHarness::SetUp(); 201 ChromeRenderViewHostTestHarness::SetUp();
202 SSLErrorHandler::ResetConfigForTesting();
196 SSLErrorHandler::SetInterstitialDelayForTesting(base::TimeDelta()); 203 SSLErrorHandler::SetInterstitialDelayForTesting(base::TimeDelta());
197 ssl_info_.cert = 204 ssl_info_.cert =
198 net::ImportCertFromFile(net::GetTestCertsDirectory(), "ok_cert.pem"); 205 net::ImportCertFromFile(net::GetTestCertsDirectory(), "ok_cert.pem");
199 ssl_info_.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID; 206 ssl_info_.cert_status = cert_status;
207 ssl_info_.public_key_hashes.push_back(
208 net::HashValue(kCertPublicKeyHashValue));
200 209
201 delegate_ = 210 delegate_ =
202 new TestSSLErrorHandlerDelegate(profile(), web_contents(), ssl_info_); 211 new TestSSLErrorHandlerDelegate(profile(), web_contents(), ssl_info_);
203 error_handler_.reset(new TestSSLErrorHandler( 212 error_handler_.reset(new TestSSLErrorHandler(
204 std::unique_ptr<SSLErrorHandler::Delegate>(delegate_), web_contents(), 213 std::unique_ptr<SSLErrorHandler::Delegate>(delegate_), web_contents(),
205 profile(), net::MapCertStatusToNetError(ssl_info_.cert_status), 214 profile(), net::MapCertStatusToNetError(ssl_info_.cert_status),
206 ssl_info_, 215 ssl_info_,
207 GURL(), // request_url 216 GURL(), // request_url
208 base::Callback<void(content::CertificateRequestResultType)>())); 217 base::Callback<void(content::CertificateRequestResultType)>()));
209 218
210 // Enable finch experiment for captive portal interstitials. 219 // Enable finch experiment for captive portal interstitials.
211 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( 220 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
212 "CaptivePortalInterstitial", "Enabled")); 221 "CaptivePortalInterstitial", "Enabled"));
213 // Enable finch experiment for SSL common name mismatch handling. 222 // Enable finch experiment for SSL common name mismatch handling.
214 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( 223 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
215 "SSLCommonNameMismatchHandling", "Enabled")); 224 "SSLCommonNameMismatchHandling", "Enabled"));
216 } 225 }
217 226
218 void TearDown() override { 227 void TearDown() override {
219 EXPECT_FALSE(error_handler()->IsTimerRunningForTesting()); 228 EXPECT_FALSE(error_handler()->IsTimerRunningForTesting());
220 error_handler_.reset(nullptr); 229 error_handler_.reset(nullptr);
230 SSLErrorHandler::ResetConfigForTesting();
221 ChromeRenderViewHostTestHarness::TearDown(); 231 ChromeRenderViewHostTestHarness::TearDown();
222 } 232 }
223 233
224 TestSSLErrorHandler* error_handler() { return error_handler_.get(); } 234 TestSSLErrorHandler* error_handler() { return error_handler_.get(); }
225 TestSSLErrorHandlerDelegate* delegate() { return delegate_; } 235 TestSSLErrorHandlerDelegate* delegate() { return delegate_; }
226 236
237 const net::SSLInfo& ssl_info() { return ssl_info_; }
238
227 private: 239 private:
228 net::SSLInfo ssl_info_; 240 net::SSLInfo ssl_info_;
229 std::unique_ptr<TestSSLErrorHandler> error_handler_; 241 std::unique_ptr<TestSSLErrorHandler> error_handler_;
230 TestSSLErrorHandlerDelegate* delegate_; 242 TestSSLErrorHandlerDelegate* delegate_;
231 base::FieldTrialList field_trial_list_; 243 base::FieldTrialList field_trial_list_;
232 244
233 DISALLOW_COPY_AND_ASSIGN(SSLErrorHandlerNameMismatchTest); 245 DISALLOW_COPY_AND_ASSIGN(SSLErrorHandlerCertStatusTestBase);
234 }; 246 };
235 247
248 using SSLErrorHandlerNameMismatchTest =
249 SSLErrorHandlerCertStatusTestBase<net::CERT_STATUS_COMMON_NAME_INVALID>;
250 using SSLErrorHandlerAuthorityInvalidTest =
251 SSLErrorHandlerCertStatusTestBase<net::CERT_STATUS_AUTHORITY_INVALID>;
252
236 class SSLErrorHandlerDateInvalidTest : public ChromeRenderViewHostTestHarness { 253 class SSLErrorHandlerDateInvalidTest : public ChromeRenderViewHostTestHarness {
237 public: 254 public:
238 SSLErrorHandlerDateInvalidTest() 255 SSLErrorHandlerDateInvalidTest()
239 : field_trial_test_(new network_time::FieldTrialTest()), 256 : field_trial_test_(new network_time::FieldTrialTest()),
240 clock_(new base::SimpleTestClock), 257 clock_(new base::SimpleTestClock),
241 tick_clock_(new base::SimpleTestTickClock), 258 tick_clock_(new base::SimpleTestTickClock),
242 test_server_(new net::EmbeddedTestServer) { 259 test_server_(new net::EmbeddedTestServer) {
243 SetThreadBundleOptions(content::TestBrowserThreadBundle::REAL_IO_THREAD); 260 SetThreadBundleOptions(content::TestBrowserThreadBundle::REAL_IO_THREAD);
244 network_time::NetworkTimeTracker::RegisterPrefs(pref_service_.registry()); 261 network_time::NetworkTimeTracker::RegisterPrefs(pref_service_.registry());
245 } 262 }
246 263
247 void SetUp() override { 264 void SetUp() override {
248 ChromeRenderViewHostTestHarness::SetUp(); 265 ChromeRenderViewHostTestHarness::SetUp();
266 SSLErrorHandler::ResetConfigForTesting();
249 267
250 field_trial_test()->SetNetworkQueriesWithVariationsService( 268 field_trial_test()->SetNetworkQueriesWithVariationsService(
251 false, 0.0, 269 false, 0.0,
252 network_time::NetworkTimeTracker::FETCHES_IN_BACKGROUND_ONLY); 270 network_time::NetworkTimeTracker::FETCHES_IN_BACKGROUND_ONLY);
253 tracker_.reset(new network_time::NetworkTimeTracker( 271 tracker_.reset(new network_time::NetworkTimeTracker(
254 std::unique_ptr<base::Clock>(clock_), 272 std::unique_ptr<base::Clock>(clock_),
255 std::unique_ptr<base::TickClock>(tick_clock_), &pref_service_, 273 std::unique_ptr<base::TickClock>(tick_clock_), &pref_service_,
256 new net::TestURLRequestContextGetter( 274 new net::TestURLRequestContextGetter(
257 content::BrowserThread::GetTaskRunnerForThread( 275 content::BrowserThread::GetTaskRunnerForThread(
258 content::BrowserThread::IO)))); 276 content::BrowserThread::IO))));
(...skipping 20 matching lines...) Expand all
279 // Fix flakiness in case system time is off and triggers a bad clock 297 // Fix flakiness in case system time is off and triggers a bad clock
280 // interstitial. https://crbug.com/666821#c50 298 // interstitial. https://crbug.com/666821#c50
281 ssl_errors::SetBuildTimeForTesting(base::Time::Now()); 299 ssl_errors::SetBuildTimeForTesting(base::Time::Now());
282 } 300 }
283 301
284 void TearDown() override { 302 void TearDown() override {
285 if (error_handler()) { 303 if (error_handler()) {
286 EXPECT_FALSE(error_handler()->IsTimerRunningForTesting()); 304 EXPECT_FALSE(error_handler()->IsTimerRunningForTesting());
287 error_handler_.reset(nullptr); 305 error_handler_.reset(nullptr);
288 } 306 }
307 SSLErrorHandler::ResetConfigForTesting();
289 ChromeRenderViewHostTestHarness::TearDown(); 308 ChromeRenderViewHostTestHarness::TearDown();
290 } 309 }
291 310
292 TestSSLErrorHandler* error_handler() { return error_handler_.get(); } 311 TestSSLErrorHandler* error_handler() { return error_handler_.get(); }
293 TestSSLErrorHandlerDelegate* delegate() { return delegate_; } 312 TestSSLErrorHandlerDelegate* delegate() { return delegate_; }
294 313
295 network_time::FieldTrialTest* field_trial_test() { 314 network_time::FieldTrialTest* field_trial_test() {
296 return field_trial_test_.get(); 315 return field_trial_test_.get();
297 } 316 }
298 317
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 // Check that the histogram for the delay was recorded. 691 // Check that the histogram for the delay was recorded.
673 histograms.ExpectTotalCount(kCertDateErrorHistogram, 1); 692 histograms.ExpectTotalCount(kCertDateErrorHistogram, 1);
674 693
675 // Clear the error handler to test that, when the request completes, 694 // Clear the error handler to test that, when the request completes,
676 // it doesn't try to call a callback on a deleted SSLErrorHandler. 695 // it doesn't try to call a callback on a deleted SSLErrorHandler.
677 ClearErrorHandler(); 696 ClearErrorHandler();
678 697
679 // Shut down the server to cancel the pending request. 698 // Shut down the server to cancel the pending request.
680 ASSERT_TRUE(test_server()->ShutdownAndWaitUntilComplete()); 699 ASSERT_TRUE(test_server()->ShutdownAndWaitUntilComplete());
681 } 700 }
701
702 // Tests that a certificate marked as a known captive portal certificate causes
703 // the captive portal interstitial to be shown.
704 TEST_F(SSLErrorHandlerNameMismatchTest, CaptivePortalCertificateList_Enabled) {
705 base::test::ScopedFeatureList scoped_feature_list;
706 scoped_feature_list.InitFromCommandLine(
707 "CaptivePortalCertificateList" /* enabled */, "" /* disabled */);
708
709 base::HistogramTester histograms;
710
711 EXPECT_FALSE(error_handler()->IsTimerRunningForTesting());
712 EXPECT_EQ(1u, ssl_info().public_key_hashes.size());
713
714 chrome_browser_ssl::SSLErrorAssistantConfig config_proto;
715 config_proto.add_captive_portal_cert()->set_sha256_hash(
716 "sha256/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
717 config_proto.add_captive_portal_cert()->set_sha256_hash(
718 ssl_info().public_key_hashes[0].ToString());
719 config_proto.add_captive_portal_cert()->set_sha256_hash(
720 "sha256/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
721 SSLErrorHandler::SetErrorAssistantProtoForTesting(config_proto);
722
723 error_handler()->StartHandlingError();
724
725 // Timer shouldn't start for a known captive portal certificate.
726 EXPECT_FALSE(error_handler()->IsTimerRunningForTesting());
727 EXPECT_FALSE(delegate()->captive_portal_checked());
728 EXPECT_FALSE(delegate()->ssl_interstitial_shown());
729 EXPECT_TRUE(delegate()->captive_portal_interstitial_shown());
730 EXPECT_FALSE(delegate()->suggested_url_checked());
731
732 // A buggy SSL error handler might have incorrectly started the timer. Run to
733 // completion to ensure the timer is expired.
734 base::RunLoop().RunUntilIdle();
735
736 EXPECT_FALSE(error_handler()->IsTimerRunningForTesting());
737 EXPECT_FALSE(delegate()->captive_portal_checked());
738 EXPECT_FALSE(delegate()->ssl_interstitial_shown());
739 EXPECT_TRUE(delegate()->captive_portal_interstitial_shown());
740 EXPECT_FALSE(delegate()->suggested_url_checked());
741
742 // Check that the histogram for the captive portal cert was recorded.
743 histograms.ExpectTotalCount(SSLErrorHandler::GetHistogramNameForTesting(), 3);
744 histograms.ExpectBucketCount(SSLErrorHandler::GetHistogramNameForTesting(),
745 SSLErrorHandler::HANDLE_ALL, 1);
746 histograms.ExpectBucketCount(
747 SSLErrorHandler::GetHistogramNameForTesting(),
748 SSLErrorHandler::SHOW_CAPTIVE_PORTAL_INTERSTITIAL_OVERRIDABLE, 1);
749 histograms.ExpectBucketCount(SSLErrorHandler::GetHistogramNameForTesting(),
750 SSLErrorHandler::CAPTIVE_PORTAL_CERT_FOUND, 1);
751 }
752
753 // Tests that a certificate marked as a known captive portal certificate does
754 // not cause the captive portal interstitial to be shown, if the feature is
755 // disabled.
756 TEST_F(SSLErrorHandlerNameMismatchTest, CaptivePortalCertificateList_Disabled) {
757 base::test::ScopedFeatureList scoped_feature_list;
758 scoped_feature_list.InitFromCommandLine(
759 "" /* enabled */, "CaptivePortalCertificateList" /* disabled */);
760
761 base::HistogramTester histograms;
762
763 EXPECT_FALSE(error_handler()->IsTimerRunningForTesting());
764 EXPECT_EQ(1u, ssl_info().public_key_hashes.size());
765
766 chrome_browser_ssl::SSLErrorAssistantConfig config_proto;
767 config_proto.add_captive_portal_cert()->set_sha256_hash(
768 "sha256/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
769 config_proto.add_captive_portal_cert()->set_sha256_hash(
770 ssl_info().public_key_hashes[0].ToString());
771 config_proto.add_captive_portal_cert()->set_sha256_hash(
772 "sha256/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
773 SSLErrorHandler::SetErrorAssistantProtoForTesting(config_proto);
774
775 error_handler()->StartHandlingError();
776
777 // Timer shouldn't start for a known captive portal certificate.
778 EXPECT_TRUE(error_handler()->IsTimerRunningForTesting());
779 EXPECT_TRUE(delegate()->captive_portal_checked());
780 EXPECT_FALSE(delegate()->ssl_interstitial_shown());
781 EXPECT_FALSE(delegate()->captive_portal_interstitial_shown());
782 EXPECT_FALSE(delegate()->suggested_url_checked());
783
784 // A buggy SSL error handler might have incorrectly started the timer. Run to
785 // completion to ensure the timer is expired.
786 base::RunLoop().RunUntilIdle();
787
788 EXPECT_FALSE(error_handler()->IsTimerRunningForTesting());
789 EXPECT_TRUE(delegate()->captive_portal_checked());
790 EXPECT_TRUE(delegate()->ssl_interstitial_shown());
791 EXPECT_FALSE(delegate()->captive_portal_interstitial_shown());
792 EXPECT_FALSE(delegate()->suggested_url_checked());
793
794 // Check that the histogram for the captive portal cert was recorded.
795 histograms.ExpectTotalCount(SSLErrorHandler::GetHistogramNameForTesting(), 2);
796 histograms.ExpectBucketCount(SSLErrorHandler::GetHistogramNameForTesting(),
797 SSLErrorHandler::HANDLE_ALL, 1);
798 histograms.ExpectBucketCount(
799 SSLErrorHandler::GetHistogramNameForTesting(),
800 SSLErrorHandler::SHOW_SSL_INTERSTITIAL_OVERRIDABLE, 1);
801 }
802
803 // Tests that an error other than name mismatch does not cause a captive portal
804 // interstitial to be shown, even if the certificate is marked as a known
805 // captive portal certificate.
806 TEST_F(SSLErrorHandlerAuthorityInvalidTest,
807 CaptivePortalCertificateList_ShouldShowGenericInterstitial) {
808 base::test::ScopedFeatureList scoped_feature_list;
809 scoped_feature_list.InitFromCommandLine(
810 "CaptivePortalCertificateList" /* enabled */, "" /* disabled */);
811
812 base::HistogramTester histograms;
813
814 EXPECT_FALSE(error_handler()->IsTimerRunningForTesting());
815 EXPECT_EQ(1u, ssl_info().public_key_hashes.size());
816
817 chrome_browser_ssl::SSLErrorAssistantConfig config_proto;
818 config_proto.add_captive_portal_cert()->set_sha256_hash(
819 "sha256/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
820 config_proto.add_captive_portal_cert()->set_sha256_hash(
821 ssl_info().public_key_hashes[0].ToString());
822 config_proto.add_captive_portal_cert()->set_sha256_hash(
823 "sha256/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
824 SSLErrorHandler::SetErrorAssistantProtoForTesting(config_proto);
825
826 error_handler()->StartHandlingError();
827
828 // Timer should start for captive portal detection.
829 EXPECT_TRUE(error_handler()->IsTimerRunningForTesting());
830 EXPECT_TRUE(delegate()->captive_portal_checked());
831 EXPECT_FALSE(delegate()->ssl_interstitial_shown());
832 EXPECT_FALSE(delegate()->captive_portal_interstitial_shown());
833 EXPECT_FALSE(delegate()->suggested_url_checked());
834
835 base::RunLoop().RunUntilIdle();
836
837 EXPECT_FALSE(error_handler()->IsTimerRunningForTesting());
838 EXPECT_TRUE(delegate()->captive_portal_checked());
839 EXPECT_TRUE(delegate()->ssl_interstitial_shown());
840 EXPECT_FALSE(delegate()->captive_portal_interstitial_shown());
841 EXPECT_FALSE(delegate()->suggested_url_checked());
842
843 // Check that the histogram for the captive portal cert was recorded.
844 histograms.ExpectTotalCount(SSLErrorHandler::GetHistogramNameForTesting(), 2);
845 histograms.ExpectBucketCount(SSLErrorHandler::GetHistogramNameForTesting(),
846 SSLErrorHandler::HANDLE_ALL, 1);
847 histograms.ExpectBucketCount(
848 SSLErrorHandler::GetHistogramNameForTesting(),
849 SSLErrorHandler::SHOW_SSL_INTERSTITIAL_OVERRIDABLE, 1);
850 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698