OLD | NEW |
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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 }; | 52 }; |
53 | 53 |
54 // Test that fetching a URL using TLS client auth doesn't crash, hang, or | 54 // Test that fetching a URL using TLS client auth doesn't crash, hang, or |
55 // prompt. | 55 // prompt. |
56 IN_PROC_BROWSER_TEST_F(BackgroundXhrTest, TlsClientAuth) { | 56 IN_PROC_BROWSER_TEST_F(BackgroundXhrTest, TlsClientAuth) { |
57 // Install a null ClientCertStore so the client auth prompt isn't bypassed due | 57 // Install a null ClientCertStore so the client auth prompt isn't bypassed due |
58 // to the system certificate store returning no certificates. | 58 // to the system certificate store returning no certificates. |
59 base::RunLoop loop; | 59 base::RunLoop loop; |
60 content::BrowserThread::PostTaskAndReply( | 60 content::BrowserThread::PostTaskAndReply( |
61 content::BrowserThread::IO, FROM_HERE, | 61 content::BrowserThread::IO, FROM_HERE, |
62 base::Bind(&InstallNullCertStoreFactoryOnIOThread, | 62 base::BindOnce(&InstallNullCertStoreFactoryOnIOThread, |
63 browser()->profile()->GetResourceContext()), | 63 browser()->profile()->GetResourceContext()), |
64 loop.QuitClosure()); | 64 loop.QuitClosure()); |
65 loop.Run(); | 65 loop.Run(); |
66 | 66 |
67 // Launch HTTPS server. | 67 // Launch HTTPS server. |
68 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); | 68 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); |
69 net::SSLServerConfig ssl_config; | 69 net::SSLServerConfig ssl_config; |
70 ssl_config.client_cert_type = | 70 ssl_config.client_cert_type = |
71 net::SSLServerConfig::ClientCertType::REQUIRE_CLIENT_CERT; | 71 net::SSLServerConfig::ClientCertType::REQUIRE_CLIENT_CERT; |
72 https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config); | 72 https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config); |
73 https_server.ServeFilesFromSourceDirectory("content/test/data"); | 73 https_server.ServeFilesFromSourceDirectory("content/test/data"); |
74 ASSERT_TRUE(https_server.Start()); | 74 ASSERT_TRUE(https_server.Start()); |
75 | 75 |
76 ASSERT_NO_FATAL_FAILURE( | 76 ASSERT_NO_FATAL_FAILURE( |
77 RunTest("test_tls_client_auth.html", https_server.GetURL("/"))); | 77 RunTest("test_tls_client_auth.html", https_server.GetURL("/"))); |
78 } | 78 } |
79 | 79 |
80 // Test that fetching a URL using HTTP auth doesn't crash, hang, or prompt. | 80 // Test that fetching a URL using HTTP auth doesn't crash, hang, or prompt. |
81 IN_PROC_BROWSER_TEST_F(BackgroundXhrTest, HttpAuth) { | 81 IN_PROC_BROWSER_TEST_F(BackgroundXhrTest, HttpAuth) { |
82 ASSERT_TRUE(embedded_test_server()->Start()); | 82 ASSERT_TRUE(embedded_test_server()->Start()); |
83 ASSERT_NO_FATAL_FAILURE(RunTest( | 83 ASSERT_NO_FATAL_FAILURE(RunTest( |
84 "test_http_auth.html", embedded_test_server()->GetURL("/auth-basic"))); | 84 "test_http_auth.html", embedded_test_server()->GetURL("/auth-basic"))); |
85 } | 85 } |
OLD | NEW |