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

Unified Diff: chrome/test/ui/ppapi_uitest.cc

Issue 9836015: Revert 128266 - Added a pepper test for SSLHandshake. This starts an SSL server which the test can … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 months 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/ui/ppapi_uitest.h ('k') | ppapi/tests/test_case.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/ui/ppapi_uitest.cc
===================================================================
--- chrome/test/ui/ppapi_uitest.cc (revision 128267)
+++ chrome/test/ui/ppapi_uitest.cc (working copy)
@@ -160,33 +160,61 @@
}
void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) {
- FilePath document_root;
- ASSERT_TRUE(GetHTTPDocumentRoot(&document_root));
- RunHTTPTestServer(document_root, test_case, "");
-}
+ // For HTTP tests, we use the output DIR to grab the generated files such
+ // as the NEXEs.
+ FilePath exe_dir = CommandLine::ForCurrentProcess()->GetProgram().DirName();
+ FilePath src_dir;
+ ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &src_dir));
-void PPAPITestBase::RunTestWithSSLServer(const std::string& test_case) {
- FilePath document_root;
- ASSERT_TRUE(GetHTTPDocumentRoot(&document_root));
- net::TestServer test_server(net::BaseTestServer::HTTPSOptions(),
- document_root);
+ // TestServer expects a path relative to source. So we must first
+ // generate absolute paths to SRC and EXE and from there generate
+ // a relative path.
+ if (!exe_dir.IsAbsolute()) file_util::AbsolutePath(&exe_dir);
+ if (!src_dir.IsAbsolute()) file_util::AbsolutePath(&src_dir);
+ ASSERT_TRUE(exe_dir.IsAbsolute());
+ ASSERT_TRUE(src_dir.IsAbsolute());
+
+ size_t match, exe_size, src_size;
+ std::vector<FilePath::StringType> src_parts, exe_parts;
+
+ // Determine point at which src and exe diverge, and create a relative path.
+ exe_dir.GetComponents(&exe_parts);
+ src_dir.GetComponents(&src_parts);
+ exe_size = exe_parts.size();
+ src_size = src_parts.size();
+ for (match = 0; match < exe_size && match < src_size; ++match) {
+ if (exe_parts[match] != src_parts[match])
+ break;
+ }
+ FilePath web_dir;
+ for (size_t tmp_itr = match; tmp_itr < src_size; ++tmp_itr) {
+ web_dir = web_dir.Append(FILE_PATH_LITERAL(".."));
+ }
+ for (; match < exe_size; ++match) {
+ web_dir = web_dir.Append(exe_parts[match]);
+ }
+
+ net::TestServer test_server(net::TestServer::TYPE_HTTP,
+ net::TestServer::kLocalhost,
+ web_dir);
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));
+ std::string query = BuildQuery("files/test_case.html?", test_case);
+
+ GURL url = test_server.GetURL(query);
+ RunTestURL(url);
}
void PPAPITestBase::RunTestWithWebSocketServer(const std::string& test_case) {
FilePath websocket_root_dir;
ASSERT_TRUE(
PathService::Get(content::DIR_LAYOUT_TESTS, &websocket_root_dir));
+
ui_test_utils::TestWebSocketServer server;
int port = server.UseRandomPort();
ASSERT_TRUE(server.Start(websocket_root_dir));
- FilePath http_document_root;
- ASSERT_TRUE(GetHTTPDocumentRoot(&http_document_root));
- RunHTTPTestServer(http_document_root, test_case,
- StringPrintf("websocket_port=%d", port));
+ std::string url = StringPrintf("%s&websocket_port=%d",
+ test_case.c_str(), port);
+ RunTestViaHTTP(url);
}
std::string PPAPITestBase::StripPrefixes(const std::string& test_name) {
@@ -214,61 +242,6 @@
EXPECT_STREQ("PASS", observer.result().c_str());
}
-void PPAPITestBase::RunHTTPTestServer(
- const FilePath& document_root,
- 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);
-}
-
-bool PPAPITestBase::GetHTTPDocumentRoot(FilePath* document_root) {
- // For HTTP tests, we use the output DIR to grab the generated files such
- // as the NEXEs.
- FilePath exe_dir = CommandLine::ForCurrentProcess()->GetProgram().DirName();
- FilePath src_dir;
- if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_dir))
- return false;
-
- // TestServer expects a path relative to source. So we must first
- // generate absolute paths to SRC and EXE and from there generate
- // a relative path.
- if (!exe_dir.IsAbsolute()) file_util::AbsolutePath(&exe_dir);
- if (!src_dir.IsAbsolute()) file_util::AbsolutePath(&src_dir);
- if (!exe_dir.IsAbsolute())
- return false;
- if (!src_dir.IsAbsolute())
- return false;
-
- size_t match, exe_size, src_size;
- std::vector<FilePath::StringType> src_parts, exe_parts;
-
- // Determine point at which src and exe diverge, and create a relative path.
- exe_dir.GetComponents(&exe_parts);
- src_dir.GetComponents(&src_parts);
- exe_size = exe_parts.size();
- src_size = src_parts.size();
- for (match = 0; match < exe_size && match < src_size; ++match) {
- if (exe_parts[match] != src_parts[match])
- break;
- }
- for (size_t tmp_itr = match; tmp_itr < src_size; ++tmp_itr) {
- *document_root = document_root->Append(FILE_PATH_LITERAL(".."));
- }
- for (; match < exe_size; ++match) {
- *document_root = document_root->Append(exe_parts[match]);
- }
- return true;
-}
-
PPAPITest::PPAPITest() {
}
@@ -374,16 +347,6 @@
RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
}
-// Similar macros that test with an SSL server.
-#define TEST_PPAPI_IN_PROCESS_WITH_SSL_SERVER(test_name) \
- IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \
- RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
- }
-#define TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(test_name) \
- IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, test_name) { \
- RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
- }
-
// Similar macros that test with WebSocket server
#define TEST_PPAPI_IN_PROCESS_WITH_WS(test_name) \
IN_PROC_BROWSER_TEST_F(PPAPITest, test_name) { \
@@ -413,12 +376,6 @@
RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
}
-// NaCl based PPAPI tests with SSL server
-#define TEST_PPAPI_NACL_VIA_HTTP_WITH_SSL_SERVER(test_name) \
- IN_PROC_BROWSER_TEST_F(PPAPINaClTest, test_name) { \
- RunTestWithSSLServer(STRIP_PREFIXES(test_name)); \
- }
-
// NaCl based PPAPI tests with WebSocket server
#define TEST_PPAPI_NACL_VIA_HTTP_WITH_WS(test_name) \
IN_PROC_BROWSER_TEST_F(PPAPINaClTest, test_name) { \
@@ -503,9 +460,9 @@
TEST_PPAPI_IN_PROCESS(Buffer)
TEST_PPAPI_OUT_OF_PROCESS(Buffer)
-TEST_PPAPI_OUT_OF_PROCESS_WITH_SSL_SERVER(TCPSocketPrivate)
-TEST_PPAPI_IN_PROCESS_WITH_SSL_SERVER(TCPSocketPrivate)
-TEST_PPAPI_NACL_VIA_HTTP_WITH_SSL_SERVER(TCPSocketPrivate)
+TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(TCPSocketPrivate)
+TEST_PPAPI_IN_PROCESS_VIA_HTTP(TCPSocketPrivate)
+TEST_PPAPI_NACL_VIA_HTTP(TCPSocketPrivate)
TEST_PPAPI_IN_PROCESS_VIA_HTTP(UDPSocketPrivate)
TEST_PPAPI_OUT_OF_PROCESS_VIA_HTTP(UDPSocketPrivate)
« no previous file with comments | « chrome/test/ui/ppapi_uitest.h ('k') | ppapi/tests/test_case.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698