Skip to content

Convert WebSocket tests to .any.js format - #5148

Closed
annevk wants to merge 1 commit into
masterfrom
annevk/websocket-anyjs
Closed

annevk wants to merge 1 commit into
masterfrom
annevk/websocket-anyjs

Conversation

@annevk

@annevk annevk commented Mar 15, 2017 •

Copy link
Copy Markdown
Member

Fixes #2557.

@wpt-pr-bot

Copy link
Copy Markdown
Collaborator

@ghost

ghost commented Mar 15, 2017

Copy link
Copy Markdown

These tests are now available on w3c-test.org

@annevk

annevk commented Mar 15, 2017 •

Copy link
Copy Markdown
Member Author

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">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder about these

@annevk annevk left a comment

Copy link
Copy Markdown
Member Author

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 testClose = async_test("W3C WebSocket API - Send unicode data on a WebSocket - Connection should be closed");

var data = "¥¥¥¥¥¥";
var data = "¥¥¥¥¥¥";

Copy link
Copy Markdown
Member Author

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">

Copy link
Copy Markdown
Member Author

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.

Copy link
Copy Markdown
Member

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:).

Copy link
Copy Markdown
Member Author

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

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 testClose = async_test("W3C WebSocket API - Send unicode data on a Secure WebSocket - Connection should be closed");

var data = "¥¥¥¥¥¥";
var data = "¥¥¥¥¥¥";

Copy link
Copy Markdown
Member Author

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.

@ghost

ghost commented Mar 15, 2017

Copy link
Copy Markdown

View the complete job log.

Firefox (nightly channel)

Testing web-platform-tests at revision 185b066
Using browser at version BuildID 20170314110401; SourceStamp 6d38ad302429c98115c354d643e81987ecec5d3c
Starting 10 test iterations
No tests run.

@ghost

ghost commented Mar 15, 2017

Copy link
Copy Markdown

View the complete job log.

Chrome (unstable channel)

Testing web-platform-tests at revision 185b066
Using browser at version 58.0.3029.19 dev
Starting 10 test iterations
No tests run.

@@ -0,0 +1,9 @@
// META: script=websocket.sub.js

if(window.WebSocket) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use self?

@unixbox08

Copy link
Copy Markdown

Reviewed 152 of 152 files at r1.
Review status: all files reviewed at latest revision, 3 unresolved discussions, all commit checks successful.


Comments from Reviewable

annevk added a commit that referenced this pull request Apr 24, 2018
Take 2 (see #5148 for take 1), fixes #2557.
@annevk

annevk commented Apr 24, 2018

Copy link
Copy Markdown
Member Author

This is now #10598.

@annevk annevk closed this Apr 24, 2018
@annevk
annevk deleted the annevk/websocket-anyjs branch April 24, 2018 13:13
jgraham pushed a commit that referenced this pull request Apr 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants