| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/test/ppapi/ppapi_test.h" | 5 #include "chrome/test/ppapi/ppapi_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 RunTestURL(url); | 169 RunTestURL(url); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) { | 172 void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) { |
| 173 base::FilePath document_root; | 173 base::FilePath document_root; |
| 174 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&document_root)); | 174 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&document_root)); |
| 175 base::FilePath http_document_root; | 175 base::FilePath http_document_root; |
| 176 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); | 176 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); |
| 177 net::TestServer http_server(net::TestServer::TYPE_HTTP, | 177 net::TestServer http_server(net::TestServer::TYPE_HTTP, |
| 178 net::TestServer::kLocalhost, | 178 net::TestServer::kLocalhost, |
| 179 document_root); | 179 net::TestServer::GetSourceRelativePath( |
| 180 document_root)); |
| 180 ASSERT_TRUE(http_server.Start()); | 181 ASSERT_TRUE(http_server.Start()); |
| 181 RunTestURL(GetTestURL(http_server, test_case, "")); | 182 RunTestURL(GetTestURL(http_server, test_case, "")); |
| 182 } | 183 } |
| 183 | 184 |
| 184 void PPAPITestBase::RunTestWithSSLServer(const std::string& test_case) { | 185 void PPAPITestBase::RunTestWithSSLServer(const std::string& test_case) { |
| 185 base::FilePath http_document_root; | 186 base::FilePath http_document_root; |
| 186 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); | 187 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); |
| 187 net::TestServer http_server(net::TestServer::TYPE_HTTP, | 188 net::TestServer http_server(net::TestServer::TYPE_HTTP, |
| 188 net::TestServer::kLocalhost, | 189 net::TestServer::kLocalhost, |
| 189 http_document_root); | 190 net::TestServer::GetSourceRelativePath( |
| 191 http_document_root)); |
| 190 net::TestServer ssl_server(net::TestServer::TYPE_HTTPS, | 192 net::TestServer ssl_server(net::TestServer::TYPE_HTTPS, |
| 191 net::BaseTestServer::SSLOptions(), | 193 net::BaseTestServer::SSLOptions(), |
| 192 http_document_root); | 194 net::TestServer::GetSourceRelativePath( |
| 195 http_document_root)); |
| 193 // Start the servers in parallel. | 196 // Start the servers in parallel. |
| 194 ASSERT_TRUE(http_server.StartInBackground()); | 197 ASSERT_TRUE(http_server.StartInBackground()); |
| 195 ASSERT_TRUE(ssl_server.StartInBackground()); | 198 ASSERT_TRUE(ssl_server.StartInBackground()); |
| 196 // Wait until they are both finished before continuing. | 199 // Wait until they are both finished before continuing. |
| 197 ASSERT_TRUE(http_server.BlockUntilStarted()); | 200 ASSERT_TRUE(http_server.BlockUntilStarted()); |
| 198 ASSERT_TRUE(ssl_server.BlockUntilStarted()); | 201 ASSERT_TRUE(ssl_server.BlockUntilStarted()); |
| 199 | 202 |
| 200 uint16_t port = ssl_server.host_port_pair().port(); | 203 uint16_t port = ssl_server.host_port_pair().port(); |
| 201 RunTestURL(GetTestURL(http_server, | 204 RunTestURL(GetTestURL(http_server, |
| 202 test_case, | 205 test_case, |
| 203 StringPrintf("ssl_server_port=%d", port))); | 206 StringPrintf("ssl_server_port=%d", port))); |
| 204 } | 207 } |
| 205 | 208 |
| 206 void PPAPITestBase::RunTestWithWebSocketServer(const std::string& test_case) { | 209 void PPAPITestBase::RunTestWithWebSocketServer(const std::string& test_case) { |
| 207 base::FilePath http_document_root; | 210 base::FilePath http_document_root; |
| 208 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); | 211 ASSERT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&http_document_root)); |
| 209 net::TestServer http_server(net::TestServer::TYPE_HTTP, | 212 net::TestServer http_server(net::TestServer::TYPE_HTTP, |
| 210 net::TestServer::kLocalhost, | 213 net::TestServer::kLocalhost, |
| 211 http_document_root); | 214 net::TestServer::GetSourceRelativePath( |
| 215 http_document_root)); |
| 212 net::TestServer ws_server(net::TestServer::TYPE_WS, | 216 net::TestServer ws_server(net::TestServer::TYPE_WS, |
| 213 net::TestServer::kLocalhost, | 217 net::TestServer::kLocalhost, |
| 214 net::GetWebSocketTestDataDirectory()); | 218 net::TestServer::GetSourceRelativePath( |
| 219 net::GetWebSocketTestDataDirectory())); |
| 215 // Start the servers in parallel. | 220 // Start the servers in parallel. |
| 216 ASSERT_TRUE(http_server.StartInBackground()); | 221 ASSERT_TRUE(http_server.StartInBackground()); |
| 217 ASSERT_TRUE(ws_server.StartInBackground()); | 222 ASSERT_TRUE(ws_server.StartInBackground()); |
| 218 // Wait until they are both finished before continuing. | 223 // Wait until they are both finished before continuing. |
| 219 ASSERT_TRUE(http_server.BlockUntilStarted()); | 224 ASSERT_TRUE(http_server.BlockUntilStarted()); |
| 220 ASSERT_TRUE(ws_server.BlockUntilStarted()); | 225 ASSERT_TRUE(ws_server.BlockUntilStarted()); |
| 221 | 226 |
| 222 uint16_t port = ws_server.host_port_pair().port(); | 227 uint16_t port = ws_server.host_port_pair().port(); |
| 223 RunTestURL(GetTestURL(http_server, | 228 RunTestURL(GetTestURL(http_server, |
| 224 test_case, | 229 test_case, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 const std::string& base, | 356 const std::string& base, |
| 352 const std::string& test_case) { | 357 const std::string& test_case) { |
| 353 return StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), | 358 return StringPrintf("%smode=nacl_newlib&testcase=%s", base.c_str(), |
| 354 test_case.c_str()); | 359 test_case.c_str()); |
| 355 } | 360 } |
| 356 | 361 |
| 357 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { | 362 void PPAPIBrokerInfoBarTest::SetUpOnMainThread() { |
| 358 // The default content setting for the PPAPI broker is ASK. We purposefully | 363 // The default content setting for the PPAPI broker is ASK. We purposefully |
| 359 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. | 364 // don't call PPAPITestBase::SetUpOnMainThread() to keep it that way. |
| 360 } | 365 } |
| OLD | NEW |