summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authortoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-14 13:07:34 +0000
committertoyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-14 13:07:34 +0000
commit21de9cb27bf484aa7e276ab58673c26a1b9bb2d3 (patch)
treee4d5c141856a416e5606fcada0d7810ecc448062 /ppapi
parent29e8270f48ca99207b52481c334c5481082bd014 (diff)
downloadchromium_src-21de9cb27bf484aa7e276ab58673c26a1b9bb2d3.zip
chromium_src-21de9cb27bf484aa7e276ab58673c26a1b9bb2d3.tar.gz
chromium_src-21de9cb27bf484aa7e276ab58673c26a1b9bb2d3.tar.bz2
PPAPI/WS: use server providing hostname as test serevr hostname
'localhost' can be resolved as IPv6 address and IPv4 address. On the other hands, a test server listens at '127.0.0.1' by default. Chrome want to connect using IPv6 address firstly. So if the server listens at only IPv4 address, Chrome connects IPv4 address after IPv6 timeout. This change passes server proviting host to PPAPI tests, then makes it available from WebSocket related PPAPI tests. BUG=175237 TEST=browser_tests --gtest_filter='*.WebSocket_*' Review URL: https://codereview.chromium.org/12252004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182452 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/tests/test_case.html6
-rw-r--r--ppapi/tests/test_websocket.cc9
-rw-r--r--ppapi/tests/testing_instance.cc2
-rw-r--r--ppapi/tests/testing_instance.h4
4 files changed, 19 insertions, 2 deletions
diff --git a/ppapi/tests/test_case.html b/ppapi/tests/test_case.html
index 0334878..9f897d0 100644
--- a/ppapi/tests/test_case.html
+++ b/ppapi/tests/test_case.html
@@ -33,11 +33,14 @@ function AppendFrame(testcase, i) {
var frame = document.createElement("IFRAME");
var mode = ExtractSearchParameter("mode");
+ var websocket_host = ExtractSearchParameter("websocket_host");
var websocket_port = ExtractSearchParameter("websocket_port");
var ssl_server_port = ExtractSearchParameter("ssl_server_port");
var src = "?testcase=" + testcase;
if (mode == "nacl")
src += "&mode=nacl";
+ if (websocket_host != "")
+ src += "&websocket_host=" + websocket_host;
if (websocket_port != "")
src += "&websocket_port=" + websocket_port;
if (ssl_server_port != "")
@@ -249,6 +252,9 @@ onload = function() {
obj.setAttribute("id", "plugin");
obj.setAttribute("testcase", testcase);
obj.setAttribute("protocol", window.location.protocol);
+ var websocket_host = ExtractSearchParameter("websocket_host");
+ if (websocket_host != "")
+ obj.setAttribute("websocket_host", websocket_host);
var websocket_port = ExtractSearchParameter("websocket_port");
if (websocket_port != "")
obj.setAttribute("websocket_port", websocket_port);
diff --git a/ppapi/tests/test_websocket.cc b/ppapi/tests/test_websocket.cc
index acbad3e..5b400ee 100644
--- a/ppapi/tests/test_websocket.cc
+++ b/ppapi/tests/test_websocket.cc
@@ -240,8 +240,13 @@ void TestWebSocket::RunTests(const std::string& filter) {
}
std::string TestWebSocket::GetFullURL(const char* url) {
- std::string rv = "ws://localhost";
- // Some WebSocket tests don't start the server so there'll be no port.
+ std::string rv = "ws://";
+ // Some WebSocket tests don't start the server so there'll be no host and
+ // port.
+ if (instance_->websocket_host().empty())
+ rv += "127.0.0.1";
+ else
+ rv += instance_->websocket_host();
if (instance_->websocket_port() != -1) {
char buffer[10];
sprintf(buffer, ":%d", instance_->websocket_port());
diff --git a/ppapi/tests/testing_instance.cc b/ppapi/tests/testing_instance.cc
index a6fa0dd..7874d20 100644
--- a/ppapi/tests/testing_instance.cc
+++ b/ppapi/tests/testing_instance.cc
@@ -52,6 +52,8 @@ bool TestingInstance::Init(uint32_t argc,
nacl_mode_ = true;
} else if (std::strcmp(argn[i], "protocol") == 0) {
protocol_ = argv[i];
+ } else if (std::strcmp(argn[i], "websocket_host") == 0) {
+ websocket_host_ = argv[i];
} else if (std::strcmp(argn[i], "websocket_port") == 0) {
websocket_port_ = atoi(argv[i]);
} else if (std::strcmp(argn[i], "ssl_server_port") == 0) {
diff --git a/ppapi/tests/testing_instance.h b/ppapi/tests/testing_instance.h
index 013c694..2ce6c4b 100644
--- a/ppapi/tests/testing_instance.h
+++ b/ppapi/tests/testing_instance.h
@@ -90,6 +90,7 @@ pp::InstancePrivate {
int ssl_server_port() { return ssl_server_port_; }
+ const std::string& websocket_host() { return websocket_host_; }
int websocket_port() { return websocket_port_; }
// Posts a message to the test page to eval() the script.
@@ -166,6 +167,9 @@ pp::InstancePrivate {
// SSL server port.
int ssl_server_port_;
+ // WebSocket host.
+ std::string websocket_host_;
+
// WebSocket port.
int websocket_port_;