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

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

Issue 1244783006: Add Finch testing configs for ReportCertificateErrors study (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix GetLatestHostnameReported() const definition Created 5 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/ssl/certificate_reporting_test_utils.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/captive_portal_blocking_page.h" 5 #include "chrome/browser/ssl/captive_portal_blocking_page.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 272
273 // Same as above, with no SSID and no login URL. 273 // Same as above, with no SSID and no login URL.
274 IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageTest, 274 IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageTest,
275 WiFi_NoSSID_NoLoginURL) { 275 WiFi_NoSSID_NoLoginURL) {
276 const GURL kLandingUrl(captive_portal::CaptivePortalDetector::kDefaultURL); 276 const GURL kLandingUrl(captive_portal::CaptivePortalDetector::kDefaultURL);
277 TestInterstitial(true, std::string(), kLandingUrl, EXPECT_WIFI_YES, 277 TestInterstitial(true, std::string(), kLandingUrl, EXPECT_WIFI_YES,
278 EXPECT_WIFI_SSID_NO, EXPECT_LOGIN_URL_NO); 278 EXPECT_WIFI_SSID_NO, EXPECT_LOGIN_URL_NO);
279 } 279 }
280 280
281 IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageTest, CertReportingOptIn) { 281 IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageTest, CertReportingOptIn) {
282 CertificateReportingTestUtils::SetCertReportingFinchConfig( 282 // This test should only run if the Finch config is such that reports
283 CertReportHelper::kFinchGroupShowPossiblySend, "1.0"); 283 // will be sent when opted in. This tests that a report *is* sent when
284 TestCertReporting(CertificateReportingTestUtils::EXTENDED_REPORTING_OPT_IN); 284 // the user opts in under such a Finch config, and the below test
285 // tests that a report *is not* sent when the user doesn't opt in
286 // (under any Finch config).
287 if (CertificateReportingTestUtils::GetReportExpectedFromFinch() ==
288 CertificateReportingTestUtils::CERT_REPORT_EXPECTED) {
289 TestCertReporting(CertificateReportingTestUtils::EXTENDED_REPORTING_OPT_IN);
290 }
285 } 291 }
286 292
287 IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageTest, CertReportingOptOut) { 293 IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageTest, CertReportingOptOut) {
288 CertificateReportingTestUtils::SetCertReportingFinchConfig(
289 CertReportHelper::kFinchGroupShowPossiblySend, "1.0");
290 TestCertReporting( 294 TestCertReporting(
291 CertificateReportingTestUtils::EXTENDED_REPORTING_DO_NOT_OPT_IN); 295 CertificateReportingTestUtils::EXTENDED_REPORTING_DO_NOT_OPT_IN);
292 } 296 }
293 297
294 class CaptivePortalBlockingPageIDNTest : public SecurityInterstitialIDNTest { 298 class CaptivePortalBlockingPageIDNTest : public SecurityInterstitialIDNTest {
295 protected: 299 protected:
296 // SecurityInterstitialIDNTest implementation 300 // SecurityInterstitialIDNTest implementation
297 SecurityInterstitialPage* CreateInterstitial( 301 SecurityInterstitialPage* CreateInterstitial(
298 content::WebContents* contents, 302 content::WebContents* contents,
299 const GURL& request_url) const override { 303 const GURL& request_url) const override {
300 // Delegate is owned by the blocking page. 304 // Delegate is owned by the blocking page.
301 FakeConnectionInfoDelegate* delegate = 305 FakeConnectionInfoDelegate* delegate =
302 new FakeConnectionInfoDelegate(false, std::string()); 306 new FakeConnectionInfoDelegate(false, std::string());
303 net::SSLInfo empty_ssl_info; 307 net::SSLInfo empty_ssl_info;
304 // Blocking page is owned by the interstitial. 308 // Blocking page is owned by the interstitial.
305 CaptivePortalBlockingPage* blocking_page = new CaptivePortalBlockingPage( 309 CaptivePortalBlockingPage* blocking_page = new CaptivePortalBlockingPage(
306 contents, GURL(kBrokenSSL), request_url, nullptr, empty_ssl_info, 310 contents, GURL(kBrokenSSL), request_url, nullptr, empty_ssl_info,
307 base::Callback<void(bool)>()); 311 base::Callback<void(bool)>());
308 blocking_page->SetDelegate(delegate); 312 blocking_page->SetDelegate(delegate);
309 return blocking_page; 313 return blocking_page;
310 } 314 }
311 }; 315 };
312 316
313 // Test that an IDN login domain is decoded properly. 317 // Test that an IDN login domain is decoded properly.
314 IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageIDNTest, 318 IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageIDNTest,
315 ShowLoginIDNIfPortalRedirectsDetectionURL) { 319 ShowLoginIDNIfPortalRedirectsDetectionURL) {
316 EXPECT_TRUE(VerifyIDNDecoded()); 320 EXPECT_TRUE(VerifyIDNDecoded());
317 } 321 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ssl/certificate_reporting_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698