| Index: chrome/test/ppapi/ppapi_test.cc
|
| diff --git a/chrome/test/ppapi/ppapi_test.cc b/chrome/test/ppapi/ppapi_test.cc
|
| index 018d0dd2e852c2615be31fb4d9948a230ae83513..198510d7fe38dce90ef5c9bb3b371734933d84eb 100644
|
| --- a/chrome/test/ppapi/ppapi_test.cc
|
| +++ b/chrome/test/ppapi/ppapi_test.cc
|
| @@ -34,7 +34,6 @@
|
| #include "content/public/test/browser_test_utils.h"
|
| #include "net/base/net_util.h"
|
| #include "net/base/test_data_directory.h"
|
| -#include "net/test/test_server.h"
|
| #include "ppapi/shared_impl/ppapi_switches.h"
|
| #include "ui/gl/gl_switches.h"
|
| #include "webkit/plugins/plugin_switches.h"
|
| @@ -173,31 +172,57 @@ void PPAPITestBase::RunTestAndReload(const std::string& test_case) {
|
| void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) {
|
| FilePath document_root;
|
| ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&document_root));
|
| - RunHTTPTestServer(document_root, test_case, "");
|
| + FilePath http_document_root;
|
| + ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root));
|
| + net::TestServer http_server(net::TestServer::TYPE_HTTP,
|
| + net::TestServer::kLocalhost,
|
| + document_root);
|
| + ASSERT_TRUE(http_server.Start());
|
| + RunTestURL(GetTestURL(http_server, test_case, ""));
|
| }
|
|
|
| void PPAPITestBase::RunTestWithSSLServer(const std::string& test_case) {
|
| - FilePath document_root;
|
| - ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&document_root));
|
| - net::TestServer test_server(net::TestServer::TYPE_HTTPS,
|
| - net::BaseTestServer::SSLOptions(),
|
| - document_root);
|
| - ASSERT_TRUE(test_server.Start());
|
| - uint16_t port = test_server.host_port_pair().port();
|
| - RunHTTPTestServer(document_root, test_case,
|
| - StringPrintf("ssl_server_port=%d", port));
|
| + FilePath http_document_root;
|
| + ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root));
|
| + net::TestServer http_server(net::TestServer::TYPE_HTTP,
|
| + net::TestServer::kLocalhost,
|
| + http_document_root);
|
| + net::TestServer ssl_server(net::TestServer::TYPE_HTTPS,
|
| + net::BaseTestServer::SSLOptions(),
|
| + http_document_root);
|
| + // Start the servers in parallel.
|
| + 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());
|
| +
|
| + uint16_t port = ssl_server.host_port_pair().port();
|
| + RunTestURL(GetTestURL(http_server,
|
| + test_case,
|
| + StringPrintf("ssl_server_port=%d", port)));
|
| }
|
|
|
| void PPAPITestBase::RunTestWithWebSocketServer(const std::string& test_case) {
|
| - net::TestServer server(net::TestServer::TYPE_WS,
|
| - net::TestServer::kLocalhost,
|
| - net::GetWebSocketTestDataDirectory());
|
| - ASSERT_TRUE(server.Start());
|
| - uint16_t port = server.host_port_pair().port();
|
| FilePath http_document_root;
|
| ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root));
|
| - RunHTTPTestServer(http_document_root, test_case,
|
| - StringPrintf("websocket_port=%d", port));
|
| + net::TestServer http_server(net::TestServer::TYPE_HTTP,
|
| + net::TestServer::kLocalhost,
|
| + http_document_root);
|
| + net::TestServer ws_server(net::TestServer::TYPE_WS,
|
| + net::TestServer::kLocalhost,
|
| + net::GetWebSocketTestDataDirectory());
|
| + // Start the servers in parallel.
|
| + ASSERT_TRUE(http_server.StartInBackground());
|
| + ASSERT_TRUE(ws_server.StartInBackground());
|
| + // Wait until they are both finished before continuing.
|
| + ASSERT_TRUE(http_server.BlockUntilStarted());
|
| + ASSERT_TRUE(ws_server.BlockUntilStarted());
|
| +
|
| + uint16_t port = ws_server.host_port_pair().port();
|
| + RunTestURL(GetTestURL(http_server,
|
| + test_case,
|
| + StringPrintf("websocket_port=%d", port)));
|
| }
|
|
|
| void PPAPITestBase::RunTestIfAudioOutputAvailable(
|
| @@ -236,20 +261,15 @@ void PPAPITestBase::RunTestURL(const GURL& test_url) {
|
| EXPECT_STREQ("PASS", handler.message().c_str());
|
| }
|
|
|
| -void PPAPITestBase::RunHTTPTestServer(
|
| - const FilePath& document_root,
|
| +GURL PPAPITestBase::GetTestURL(
|
| + const net::TestServer& http_server,
|
| const std::string& test_case,
|
| const std::string& extra_params) {
|
| - net::TestServer test_server(net::TestServer::TYPE_HTTP,
|
| - net::TestServer::kLocalhost,
|
| - document_root);
|
| - ASSERT_TRUE(test_server.Start());
|
| std::string query = BuildQuery("files/test_case.html?", test_case);
|
| if (!extra_params.empty())
|
| query = StringPrintf("%s&%s", query.c_str(), extra_params.c_str());
|
|
|
| - GURL url = test_server.GetURL(query);
|
| - RunTestURL(url);
|
| + return http_server.GetURL(query);
|
| }
|
|
|
| PPAPITest::PPAPITest() {
|
|
|