New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert WebSocket tests to .any.js format #5148
Conversation
Notifying @Jxck, @jdm, @kristijanburnik, @zcorpan, and @zqzhang. (Learn how reviewing works.) |
These tests are now available on w3c-test.org |
This was done in an automated fashion using this Python script: import os, html5lib
path = "./"
for filename in os.listdir(path):
filename_tuple = os.path.splitext(filename)
if filename_tuple[1] == ".htm" or filename_tuple[1] == ".html":
output = u""
with open(filename, "r") as f:
root = html5lib.parse(f, "etree")
for script in root.iter("{http://www.w3.org/1999/xhtml}script"):
if u"src" in script.attrib:
if script.attrib[u"src"] in (u"/resources/testharness.js", u"/resources/testharnessreport.js"):
continue
else:
output += u"// META: script=" + script.attrib[u"src"] + u"\n"
else:
output += u"\n" + script.text.strip("\n")
new_file_name = filename_tuple[0] + ".any.js"
os.rename(os.path.join(path,filename),os.path.join(path,new_file_name))
with open(new_file_name, "w") as f:
f.write(output.strip().encode("utf-8"))
f.write(u"\n") |
<script src=/resources/testharnessreport.js></script> | ||
<script src=constants.js?pipe=sub></script> | ||
<meta name="variant" content=""> | ||
<meta name="variant" content="?wss"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder about these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks okay, found a couple of minor potential issues, two of which need fixing before landing.
|
||
var testOpen = async_test("W3C WebSocket API - Send unicode data on a WebSocket - Connection should be opened"); | ||
var testMessage = async_test("W3C WebSocket API - Send unicode data on a WebSocket - Message should be received"); | ||
var testClose = async_test("W3C WebSocket API - Send unicode data on a WebSocket - Connection should be closed"); | ||
|
||
var data = "¥¥¥¥¥¥"; | ||
var data = "¥¥¥¥¥¥"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a fixup before landing.
<script src=/resources/testharnessreport.js></script> | ||
<script src=constants.js?pipe=sub></script> | ||
<meta name="variant" content=""> | ||
<meta name="variant" content="?wss"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unclear if these meta elements were important.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. They cause the runner to run the test once with nothing appended to the URL and once with ?wss
appended (which tests wss:
instead of ws:
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ms2ger I guess we need to introduce // META: variant= for these? Do you want to do that or provide me with a pointer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdm what would you output though for the worker case? I'd know for https://github.com/w3c/wpt-tools/blob/6bc43a7c185137ccdfdfe114528e43784fc94c43/serve/serve.py#L115 which also needs changing. I filed w3c/wpt-tools#185 since @Ms2ger said he'd get to it.
|
||
var testOpen = async_test("W3C WebSocket API - Send unicode data on a Secure WebSocket - Connection should be opened"); | ||
var testMessage = async_test("W3C WebSocket API - Send unicode data on a Secure WebSocket - Message should be received"); | ||
var testClose = async_test("W3C WebSocket API - Send unicode data on a Secure WebSocket - Connection should be closed"); | ||
|
||
var data = "¥¥¥¥¥¥"; | ||
var data = "¥¥¥¥¥¥"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a fixup before landing.
Firefox (nightly channel)Testing web-platform-tests at revision 185b066 |
Chrome (unstable channel)Testing web-platform-tests at revision 185b066 |
@@ -0,0 +1,9 @@ | |||
// META: script=websocket.sub.js | |||
|
|||
if(window.WebSocket) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use self
?
Reviewed 152 of 152 files at r1. Comments from Reviewable |
This is now #10598. |
Fixes #2557.