Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6283)

Unified Diff: chrome/test/ppapi/ppapi_test.cc

Issue 1431653003: Migrating tests to use EmbeddedTestServer (misc) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing tests. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/ppapi/ppapi_test.h ('k') | components/cronet/android/test/native_test_server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7a7e308d5aae07ce2bad5eefbb4919d495b00e0c 100644
--- a/chrome/test/ppapi/ppapi_test.cc
+++ b/chrome/test/ppapi/ppapi_test.cc
@@ -33,6 +33,7 @@
#include "media/base/media_switches.h"
#include "net/base/filename_util.h"
#include "net/base/test_data_directory.h"
+#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 +176,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 +185,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);
- // 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());
+ net::EmbeddedTestServer http_server;
+ http_server.AddDefaultHandlers(http_document_root);
+ net::EmbeddedTestServer ssl_server(net::EmbeddedTestServer::TYPE_HTTPS);
+ ssl_server.AddDefaultHandlers(http_document_root);
+
+ ASSERT_TRUE(http_server.Start());
+ ASSERT_TRUE(ssl_server.Start());
uint16_t port = ssl_server.host_port_pair().port();
RunTestURL(GetTestURL(http_server,
@@ -207,18 +202,13 @@ 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.
- 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());
+ ASSERT_TRUE(http_server.Start());
+ ASSERT_TRUE(ws_server.Start());
std::string host = ws_server.host_port_pair().HostForURL();
uint16_t port = ws_server.host_port_pair().port();
@@ -266,11 +256,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());
« no previous file with comments | « chrome/test/ppapi/ppapi_test.h ('k') | components/cronet/android/test/native_test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698