| OLD | NEW |
| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 GURL url = embedded_test_server()->GetURL("/workers/shared_worker_auth.html"); | 165 GURL url = embedded_test_server()->GetURL("/workers/shared_worker_auth.html"); |
| 166 NavigateAndWaitForAuth(url); | 166 NavigateAndWaitForAuth(url); |
| 167 } | 167 } |
| 168 | 168 |
| 169 // Tests that TLS client auth prompts for normal workers. | 169 // Tests that TLS client auth prompts for normal workers. |
| 170 IN_PROC_BROWSER_TEST_F(WorkerTest, WorkerTlsClientAuth) { | 170 IN_PROC_BROWSER_TEST_F(WorkerTest, WorkerTlsClientAuth) { |
| 171 // Launch HTTPS server. | 171 // Launch HTTPS server. |
| 172 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); | 172 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); |
| 173 https_server.ServeFilesFromSourceDirectory("content/test/data"); | 173 https_server.ServeFilesFromSourceDirectory("content/test/data"); |
| 174 net::SSLServerConfig ssl_config; | 174 net::SSLServerConfig ssl_config; |
| 175 ssl_config.require_client_cert = true; | 175 ssl_config.client_cert_type = |
| 176 net::SSLServerConfig::ClientCertType::REQUIRE_CLIENT_CERT; |
| 176 https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config); | 177 https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config); |
| 177 ASSERT_TRUE(https_server.Start()); | 178 ASSERT_TRUE(https_server.Start()); |
| 178 | 179 |
| 179 RunTest("worker_tls_client_auth.html", | 180 RunTest("worker_tls_client_auth.html", |
| 180 "url=" + net::EscapeQueryParamValue(https_server.GetURL("/").spec(), | 181 "url=" + net::EscapeQueryParamValue(https_server.GetURL("/").spec(), |
| 181 true)); | 182 true)); |
| 182 EXPECT_EQ(1, select_certificate_count()); | 183 EXPECT_EQ(1, select_certificate_count()); |
| 183 } | 184 } |
| 184 | 185 |
| 185 // Tests that TLS client auth does not prompt for a shared worker; shared | 186 // Tests that TLS client auth does not prompt for a shared worker; shared |
| 186 // workers are not associated with a WebContents. | 187 // workers are not associated with a WebContents. |
| 187 IN_PROC_BROWSER_TEST_F(WorkerTest, SharedWorkerTlsClientAuth) { | 188 IN_PROC_BROWSER_TEST_F(WorkerTest, SharedWorkerTlsClientAuth) { |
| 188 if (!SupportsSharedWorker()) | 189 if (!SupportsSharedWorker()) |
| 189 return; | 190 return; |
| 190 | 191 |
| 191 // Launch HTTPS server. | 192 // Launch HTTPS server. |
| 192 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); | 193 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); |
| 193 https_server.ServeFilesFromSourceDirectory("content/test/data"); | 194 https_server.ServeFilesFromSourceDirectory("content/test/data"); |
| 194 net::SSLServerConfig ssl_config; | 195 net::SSLServerConfig ssl_config; |
| 195 ssl_config.require_client_cert = true; | 196 ssl_config.client_cert_type = |
| 197 net::SSLServerConfig::ClientCertType::REQUIRE_CLIENT_CERT; |
| 196 https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config); | 198 https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config); |
| 197 ASSERT_TRUE(https_server.Start()); | 199 ASSERT_TRUE(https_server.Start()); |
| 198 | 200 |
| 199 RunTest("worker_tls_client_auth.html", | 201 RunTest("worker_tls_client_auth.html", |
| 200 "shared=true&url=" + net::EscapeQueryParamValue( | 202 "shared=true&url=" + net::EscapeQueryParamValue( |
| 201 https_server.GetURL("/").spec(), true)); | 203 https_server.GetURL("/").spec(), true)); |
| 202 EXPECT_EQ(0, select_certificate_count()); | 204 EXPECT_EQ(0, select_certificate_count()); |
| 203 } | 205 } |
| 204 | 206 |
| 205 IN_PROC_BROWSER_TEST_F(WorkerTest, WebSocketSharedWorker) { | 207 IN_PROC_BROWSER_TEST_F(WorkerTest, WebSocketSharedWorker) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 236 | 238 |
| 237 IN_PROC_BROWSER_TEST_F(WorkerTest, | 239 IN_PROC_BROWSER_TEST_F(WorkerTest, |
| 238 PassMessagePortToSharedWorkerDontWaitForConnect) { | 240 PassMessagePortToSharedWorkerDontWaitForConnect) { |
| 239 if (!SupportsSharedWorker()) | 241 if (!SupportsSharedWorker()) |
| 240 return; | 242 return; |
| 241 | 243 |
| 242 RunTest("pass_messageport_to_sharedworker_dont_wait_for_connect.html", ""); | 244 RunTest("pass_messageport_to_sharedworker_dont_wait_for_connect.html", ""); |
| 243 } | 245 } |
| 244 | 246 |
| 245 } // namespace content | 247 } // namespace content |
| OLD | NEW |