summaryrefslogtreecommitdiff
path: root/components/cronet/testing/test_server/test_server.cc
diff options
context:
space:
mode:
authorMohannad Farrag <aymanm@google.com>2024-01-16 11:19:54 +0000
committerMohannad Farrag <aymanm@google.com>2024-01-17 19:08:44 +0000
commit34b3ec101cb50ce6f2dcf61a8aa3bd2d1e66f9a3 (patch)
tree83e71be75aa49acde72ce540d2f736be3a2c9491 /components/cronet/testing/test_server/test_server.cc
parent85df65e544adb55193339418571fab7bd3fbf911 (diff)
downloadcronet-34b3ec101cb50ce6f2dcf61a8aa3bd2d1e66f9a3.tar.gz
Apply crrev/c/5177031
Bug: 304217500 Change-Id: Ib74b816862f4f853b3aeffdb9f1647c11ed3f00f
Diffstat (limited to 'components/cronet/testing/test_server/test_server.cc')
-rw-r--r--components/cronet/testing/test_server/test_server.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/components/cronet/testing/test_server/test_server.cc b/components/cronet/testing/test_server/test_server.cc
index 6fbe746eb..113b7955c 100644
--- a/components/cronet/testing/test_server/test_server.cc
+++ b/components/cronet/testing/test_server/test_server.cc
@@ -170,17 +170,19 @@ namespace cronet {
/* static */
bool TestServer::StartServeFilesFromDirectory(
- const base::FilePath& test_files_root) {
+ const base::FilePath& test_files_root,
+ net::EmbeddedTestServer::Type server_type,
+ net::EmbeddedTestServer::ServerCertificate server_certificate) {
// Shouldn't happen.
if (g_test_server)
return false;
- g_test_server = std::make_unique<net::EmbeddedTestServer>(
- net::EmbeddedTestServer::TYPE_HTTP);
+ g_test_server = std::make_unique<net::EmbeddedTestServer>(server_type);
g_test_server->RegisterRequestHandler(
base::BindRepeating(&CronetTestRequestHandler));
g_test_server->ServeFilesFromDirectory(test_files_root);
net::test_server::RegisterDefaultHandlers(g_test_server.get());
+ g_test_server->SetSSLConfig(server_certificate);
CHECK(g_test_server->Start());
return true;
}
@@ -189,7 +191,10 @@ bool TestServer::StartServeFilesFromDirectory(
bool TestServer::Start() {
base::FilePath src_root;
CHECK(base::PathService::Get(base::DIR_SRC_TEST_DATA_ROOT, &src_root));
- return StartServeFilesFromDirectory(src_root.Append(kTestDataRelativePath));
+ return StartServeFilesFromDirectory(
+ src_root.Append(kTestDataRelativePath),
+ net::test_server::EmbeddedTestServer::TYPE_HTTP,
+ net::test_server::EmbeddedTestServer::CERT_OK);
}
/* static */