Chromium Code Reviews| Index: chrome/test/ppapi/ppapi_test.cc |
| diff --git a/chrome/test/ppapi/ppapi_test.cc b/chrome/test/ppapi/ppapi_test.cc |
| index dbf75a3b4387d6975e9dc16bd61f38141af35c2c..0d38faf75903711b2194a1a300e2b434231795e1 100644 |
| --- a/chrome/test/ppapi/ppapi_test.cc |
| +++ b/chrome/test/ppapi/ppapi_test.cc |
| @@ -33,6 +33,8 @@ |
| #include "media/base/media_switches.h" |
| #include "net/base/filename_util.h" |
| #include "net/base/test_data_directory.h" |
| +#include "net/test/embedded_test_server/embedded_test_server.h" |
|
mmenke
2015/11/05 17:38:13
This is already included in the header for this fi
svaldez
2015/11/05 18:15:55
Done.
|
| +#include "net/test/spawned_test_server/spawned_test_server.h" |
| #include "ppapi/shared_impl/ppapi_switches.h" |
| #include "ui/gl/gl_switches.h" |
| @@ -175,9 +177,8 @@ void PPAPITestBase::RunTest(const std::string& test_case) { |
| void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) { |
| base::FilePath document_root; |
| ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&document_root)); |
| - net::SpawnedTestServer http_server(net::SpawnedTestServer::TYPE_HTTP, |
| - net::SpawnedTestServer::kLocalhost, |
| - document_root); |
| + net::EmbeddedTestServer http_server; |
| + http_server.AddDefaultHandlers(document_root); |
| ASSERT_TRUE(http_server.Start()); |
| RunTestURL(GetTestURL(http_server, test_case, std::string())); |
| } |
| @@ -185,18 +186,13 @@ void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) { |
| void PPAPITestBase::RunTestWithSSLServer(const std::string& test_case) { |
| base::FilePath http_document_root; |
| ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); |
| - net::SpawnedTestServer http_server(net::SpawnedTestServer::TYPE_HTTP, |
| - net::SpawnedTestServer::kLocalhost, |
| - http_document_root); |
| - net::SpawnedTestServer ssl_server(net::SpawnedTestServer::TYPE_HTTPS, |
| - net::BaseTestServer::SSLOptions(), |
| - http_document_root); |
| + net::EmbeddedTestServer http_server; |
| + http_server.AddDefaultHandlers(http_document_root); |
| + net::EmbeddedTestServer ssl_server(net::EmbeddedTestServer::TYPE_HTTPS); |
| + ssl_server.AddDefaultHandlers(http_document_root); |
| // Start the servers in parallel. |
|
mmenke
2015/11/05 17:38:13
Comment outdated.
svaldez
2015/11/05 18:15:55
Done.
|
| - ASSERT_TRUE(http_server.StartInBackground()); |
| - ASSERT_TRUE(ssl_server.StartInBackground()); |
| - // Wait until they are both finished before continuing. |
| - ASSERT_TRUE(http_server.BlockUntilStarted()); |
| - ASSERT_TRUE(ssl_server.BlockUntilStarted()); |
| + ASSERT_TRUE(http_server.Start()); |
| + ASSERT_TRUE(ssl_server.Start()); |
| uint16_t port = ssl_server.host_port_pair().port(); |
| RunTestURL(GetTestURL(http_server, |
| @@ -207,17 +203,15 @@ void PPAPITestBase::RunTestWithSSLServer(const std::string& test_case) { |
| void PPAPITestBase::RunTestWithWebSocketServer(const std::string& test_case) { |
| base::FilePath http_document_root; |
| ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); |
| - net::SpawnedTestServer http_server(net::SpawnedTestServer::TYPE_HTTP, |
| - net::SpawnedTestServer::kLocalhost, |
| - http_document_root); |
| + net::EmbeddedTestServer http_server; |
| + http_server.AddDefaultHandlers(http_document_root); |
| net::SpawnedTestServer ws_server(net::SpawnedTestServer::TYPE_WS, |
| net::SpawnedTestServer::kLocalhost, |
| net::GetWebSocketTestDataDirectory()); |
| // Start the servers in parallel. |
|
mmenke
2015/11/05 17:38:13
Remove comment.
svaldez
2015/11/05 18:15:55
Done.
|
| - ASSERT_TRUE(http_server.StartInBackground()); |
| + ASSERT_TRUE(http_server.Start()); |
| ASSERT_TRUE(ws_server.StartInBackground()); |
|
mmenke
2015/11/05 17:38:13
I don't think we get anything out of using calls h
svaldez
2015/11/05 18:15:55
Done.
|
| // Wait until they are both finished before continuing. |
| - ASSERT_TRUE(http_server.BlockUntilStarted()); |
| ASSERT_TRUE(ws_server.BlockUntilStarted()); |
| std::string host = ws_server.host_port_pair().HostForURL(); |
| @@ -266,11 +260,10 @@ void PPAPITestBase::RunTestURL(const GURL& test_url) { |
| EXPECT_STREQ("PASS", handler.message().c_str()); |
| } |
| -GURL PPAPITestBase::GetTestURL( |
| - const net::SpawnedTestServer& http_server, |
| - const std::string& test_case, |
| - const std::string& extra_params) { |
| - std::string query = BuildQuery("files/test_case.html?", test_case); |
| +GURL PPAPITestBase::GetTestURL(const net::EmbeddedTestServer& http_server, |
| + const std::string& test_case, |
| + const std::string& extra_params) { |
| + std::string query = BuildQuery("/test_case.html?", test_case); |
| if (!extra_params.empty()) |
| query = base::StringPrintf("%s&%s", query.c_str(), extra_params.c_str()); |