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

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

Issue 2084153003: Remove the test-only X509Certificate constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixup .isolate for GYP build Created 4 years, 6 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 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 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" 15 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ssl/cert_report_helper.h" 17 #include "chrome/browser/ssl/cert_report_helper.h"
18 #include "chrome/browser/ssl/certificate_reporting_test_utils.h" 18 #include "chrome/browser/ssl/certificate_reporting_test_utils.h"
19 #include "chrome/browser/ssl/ssl_cert_reporter.h" 19 #include "chrome/browser/ssl/ssl_cert_reporter.h"
20 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
22 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
23 #include "chrome/test/base/in_process_browser_test.h" 23 #include "chrome/test/base/in_process_browser_test.h"
24 #include "components/captive_portal/captive_portal_detector.h" 24 #include "components/captive_portal/captive_portal_detector.h"
25 #include "components/prefs/pref_service.h" 25 #include "components/prefs/pref_service.h"
26 #include "content/public/browser/interstitial_page.h" 26 #include "content/public/browser/interstitial_page.h"
27 #include "content/public/browser/web_contents.h" 27 #include "content/public/browser/web_contents.h"
28 #include "content/public/test/browser_test_utils.h" 28 #include "content/public/test/browser_test_utils.h"
29 #include "net/base/test_data_directory.h"
29 #include "net/cert/x509_certificate.h" 30 #include "net/cert/x509_certificate.h"
31 #include "net/test/cert_test_util.h"
30 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
31 #include "url/gurl.h" 33 #include "url/gurl.h"
32 34
33 using chrome_browser_interstitials::IsInterstitialDisplayingText; 35 using chrome_browser_interstitials::IsInterstitialDisplayingText;
34 using chrome_browser_interstitials::SecurityInterstitialIDNTest; 36 using chrome_browser_interstitials::SecurityInterstitialIDNTest;
35 37
36 namespace { 38 namespace {
37 // Partial text in the captive portal interstitial's main paragraph when the 39 // Partial text in the captive portal interstitial's main paragraph when the
38 // login domain isn't displayed. 40 // login domain isn't displayed.
39 const char kGenericLoginURLText[] = "its login page"; 41 const char kGenericLoginURLText[] = "its login page";
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 const GURL& login_url, 127 const GURL& login_url,
126 ExpectWiFi expect_wifi, 128 ExpectWiFi expect_wifi,
127 ExpectWiFiSSID expect_wifi_ssid, 129 ExpectWiFiSSID expect_wifi_ssid,
128 ExpectLoginURL expect_login_url, 130 ExpectLoginURL expect_login_url,
129 std::unique_ptr<SSLCertReporter> ssl_cert_reporter, 131 std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
130 const std::string& expected_login_hostname) { 132 const std::string& expected_login_hostname) {
131 content::WebContents* contents = 133 content::WebContents* contents =
132 browser()->tab_strip_model()->GetActiveWebContents(); 134 browser()->tab_strip_model()->GetActiveWebContents();
133 DCHECK(contents); 135 DCHECK(contents);
134 net::SSLInfo ssl_info; 136 net::SSLInfo ssl_info;
135 ssl_info.cert = new net::X509Certificate( 137 ssl_info.cert =
136 login_url.host(), "CA", base::Time::Max(), base::Time::Max()); 138 net::ImportCertFromFile(net::GetTestCertsDirectory(), "ok_cert.pem");
137 // Blocking page is owned by the interstitial. 139 // Blocking page is owned by the interstitial.
138 CaptivePortalBlockingPage* blocking_page = 140 CaptivePortalBlockingPage* blocking_page =
139 new CaptivePortalBlockingPageForTesting( 141 new CaptivePortalBlockingPageForTesting(
140 contents, GURL(kBrokenSSL), login_url, std::move(ssl_cert_reporter), 142 contents, GURL(kBrokenSSL), login_url, std::move(ssl_cert_reporter),
141 ssl_info, base::Callback<void(bool)>(), is_wifi_connection, 143 ssl_info, base::Callback<void(bool)>(), is_wifi_connection,
142 wifi_ssid); 144 wifi_ssid);
143 blocking_page->Show(); 145 blocking_page->Show();
144 146
145 WaitForInterstitialAttach(contents); 147 WaitForInterstitialAttach(contents);
146 EXPECT_TRUE( 148 EXPECT_TRUE(
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 base::Callback<void(bool)>(), false, ""); 321 base::Callback<void(bool)>(), false, "");
320 return blocking_page; 322 return blocking_page;
321 } 323 }
322 }; 324 };
323 325
324 // Test that an IDN login domain is decoded properly. 326 // Test that an IDN login domain is decoded properly.
325 IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageIDNTest, 327 IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageIDNTest,
326 ShowLoginIDNIfPortalRedirectsDetectionURL) { 328 ShowLoginIDNIfPortalRedirectsDetectionURL) {
327 EXPECT_TRUE(VerifyIDNDecoded()); 329 EXPECT_TRUE(VerifyIDNDecoded());
328 } 330 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698