-import cgi, encodings, os, re, sys, urllib
+import encodings, re
+
+from six import PY3
+
+from six.moves.urllib.parse import parse_qs, quote
+
+from wptserve.utils import isomorphic_decode, isomorphic_encode
# NOTE: These are intentionally very lax to permit testing
-DISALLOWED_IN_COOKIE_NAME_RE = re.compile(r'[;\0-\x1f\x7f]');
-DISALLOWED_IN_HEADER_RE = re.compile(r'[\0-\x1f\x7f]');
+DISALLOWED_IN_COOKIE_NAME_RE = re.compile(br'[;\0-\x1f\x7f]')
+DISALLOWED_IN_HEADER_RE = re.compile(br'[\0-\x1f\x7f]')
# Ensure common charset names do not end up with different
# capitalization or punctuation
CHARSET_OVERRIDES = {
encodings.codecs.lookup(charset).name: charset
- for charset in ('utf-8', 'iso-8859-1',)
+ for charset in (u'utf-8', u'iso-8859-1',)
}
+def quote_str(cookie_str):
+ if PY3:
+ return isomorphic_encode(quote(isomorphic_decode(cookie_str), u'', encoding=u'iso-8859-1'))
+ else:
+ return quote(cookie_str, b'')
+
+def parse_qs_str(query_str):
+ if PY3:
+ args = parse_qs(isomorphic_decode(query_str), keep_blank_values=True, encoding=u'iso-8859-1')
+ binary_args = {}
+ for key, val in args.items():
+ binary_args[isomorphic_encode(key)] = [isomorphic_encode(x) for x in val]
+ return binary_args
+ else:
+ return parse_qs(query_str, keep_blank_values=True)
+
def main(request, response):
assert request.method in (
- 'GET',
- 'POST',
- ), 'request method was neither GET nor POST: %r' % request.method
- qd = (request.url.split('#')[0].split('?', 1) + [''])[1]
- if request.method == 'POST':
- qd += '&' + request.body
- args = cgi.parse_qs(qd, keep_blank_values = True)
- charset = encodings.codecs.lookup(args.get('charset', ['utf-8'])[-1]).name
+ u'GET',
+ u'POST',
+ ), u'request method was neither GET nor POST: %r' % request.method
+ qd = (isomorphic_encode(request.url).split(b'#')[0].split(b'?', 1) + [b''])[1]
+ if request.method == u'POST':
+ qd += b'&' + request.body
+ args = parse_qs_str(qd)
+
+ charset = encodings.codecs.lookup([isomorphic_decode(x) for x in args.get(b'charset', [u'utf-8'])][-1]).name
charset = CHARSET_OVERRIDES.get(charset, charset)
- headers = [('content-type', 'text/plain; charset=' + charset)]
+ headers = [(b'content-type', b'text/plain; charset=' + isomorphic_encode(charset))]
body = []
- if request.method == 'POST':
- for set_cookie in args.get('set-cookie', []):
- if '=' in set_cookie.split(';', 1)[0]:
- name, rest = set_cookie.split('=', 1)
+ if request.method == u'POST':
+ for set_cookie in args.get(b'set-cookie', []):
+ if b'=' in set_cookie.split(b';', 1)[0]:
+ name, rest = set_cookie.split(b'=', 1)
assert re.search(
DISALLOWED_IN_COOKIE_NAME_RE,
name
- ) is None, 'name had disallowed characters: %r' % name
+ ) is None, b'name had disallowed characters: %r' % name
else:
rest = set_cookie
assert re.search(
DISALLOWED_IN_HEADER_RE,
rest
- ) is None, 'rest had disallowed characters: %r' % rest
- headers.append(('set-cookie', set_cookie))
- body.append('set-cookie=' + urllib.quote(set_cookie, ''))
+ ) is None, b'rest had disallowed characters: %r' % rest
+ headers.append((b'set-cookie', set_cookie))
+ body.append(b'set-cookie=' + quote_str(set_cookie))
+
else:
- cookie = request.headers.get('cookie')
+ cookie = request.headers.get(b'cookie')
if cookie is not None:
- body.append('cookie=' + urllib.quote(cookie, ''))
- body = '\r\n'.join(body)
- headers.append(('content-length', str(len(body))))
+ body.append(b'cookie=' + quote_str(cookie))
+ body = b'\r\n'.join(body)
+ headers.append((b'content-length', len(body)))
return 200, headers, body
diff --git a/tests/wpt/web-platform-tests/css/css-backgrounds/background-attachment-353.html b/tests/wpt/web-platform-tests/css/css-backgrounds/background-attachment-353.html
new file mode 100644
index 00000000000..c5ac06c0f57
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-backgrounds/background-attachment-353.html
@@ -0,0 +1,131 @@
+
+
+
+
+ CSS Background and Borders Test: 'background-attachment: local' and 'overflow: hidden'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Test passes if there is a filled green square and no red.
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/css-backgrounds/support/100x100-gr-rr.png b/tests/wpt/web-platform-tests/css/css-backgrounds/support/100x100-gr-rr.png
new file mode 100644
index 00000000000..dfd0593e3c4
Binary files /dev/null and b/tests/wpt/web-platform-tests/css/css-backgrounds/support/100x100-gr-rr.png differ
diff --git a/tests/wpt/web-platform-tests/css/css-flexbox/grid-flex-item-005.html b/tests/wpt/web-platform-tests/css/css-flexbox/grid-flex-item-005.html
new file mode 100644
index 00000000000..95c57d1429e
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-flexbox/grid-flex-item-005.html
@@ -0,0 +1,15 @@
+
+
+
+Test passes if there is a filled green square.
+
+
diff --git a/tests/wpt/web-platform-tests/css/css-grid/alignment/grid-place-content-001.html b/tests/wpt/web-platform-tests/css/css-grid/alignment/grid-place-content-001.html
new file mode 100644
index 00000000000..49bb63928be
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-grid/alignment/grid-place-content-001.html
@@ -0,0 +1,139 @@
+
+
+CSS Grid Layout Test: Grid containers support 'place-content'
+
+
+
+
+
+
+
+
+
+
+
+Small content area
+
+box-sizing: content-box
+
+
+
+
+
+
+
+box-sizing: border-box
+
+
+
+
+
+
+
+Big content area
+
+box-sizing: content-box
+
+
+
+
+
+
+
+box-sizing: border-box
+
+
+
+
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-001-manual.html b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-001-manual.html
new file mode 100644
index 00000000000..55001fe379f
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-001-manual.html
@@ -0,0 +1,37 @@
+
+
+
+
+ CSS Pseudo-Elements Test: active selection and color (basic)
+
+
+
+
+
+
+
+
+
+ Instructions: Select a few or all characters from the words "Text sample" using a variety of methods:
+
+
+ - Select by dragging (leftwardedly or rightwardedly) the mouse across the characters.
+
- Select by using shift + keyboard arrows when keyboard navigation / caret browsing is enabled.
+
- Double click a word to select it.
+
- Triple click the text to select it.
+
+
+ Test passes if, in every case, the selected characters become green and if there is no background color for the characters selection.
+
+
Text sample
diff --git a/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-002-manual.html b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-002-manual.html
new file mode 100644
index 00000000000..01cec72b2d4
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-002-manual.html
@@ -0,0 +1,47 @@
+
+
+
+
+ CSS Pseudo-Elements Test: active selection and background-color (basic)
+
+
+
+
+
+
+
+
+
+ Instructions: Select a few or all characters from the words "Text sample" using a variety of methods:
+
+
+ - Select by dragging (leftwardedly or rightwardedly) the mouse across the characters.
+
- Select by using shift + keyboard arrows when keyboard navigation / caret browsing is enabled.
+
- Double click a word to select it.
+
- Triple click the text to select it.
+
+
+ Test passes if, in every case, the background color of selected characters become green and if text color of selected characters remains aqua.
+
+
Text sample
diff --git a/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-003-manual.html b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-003-manual.html
new file mode 100644
index 00000000000..c56a301ef3a
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-003-manual.html
@@ -0,0 +1,42 @@
+
+
+
+
+ CSS Pseudo-Elements Test: active selection and cursor (basic)
+
+
+
+
+
+
+
+
+
+ Instructions: Select a few or all characters from the words "Text sample" using a variety of methods:
+
+
+ - Select by dragging (leftwardedly or rightwardedly) the mouse across the characters.
+
- Select by using shift + keyboard arrows when keyboard navigation / caret browsing is enabled.
+
- Double click a word to select it.
+
- Triple click the text to select it.
+
+
+ Test passes if, in every case, the cursor becomes
when hovering anywhere over the selection of "Text sample" and if the background color and color of the selected text are the same as when selecting text from these instructions.
+
+
Text sample
diff --git a/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-004-manual.html b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-004-manual.html
new file mode 100644
index 00000000000..ac7ba7da327
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-004-manual.html
@@ -0,0 +1,36 @@
+
+
+
+
+ CSS Pseudo-Elements Test: active selection and text-decoration (basic)
+
+
+
+
+
+
+
+
+
+ Instructions: Select a few or all characters from the words "Text sample" using a variety of methods:
+
+
+ - Select by dragging (leftwardedly or rightwardedly) the mouse across the characters.
+
- Select by using shift + keyboard arrows when keyboard navigation / caret browsing is enabled.
+
- Double click a word to select it.
+
- Triple click the text to select it.
+
+
+ Test passes if, in every case, the selected glyphs of "Text sample" are underlined with a fuchsia dotted line and if the background color and color of the selected text are the same as when selecting text from these instructions.
+
+
Text sample
diff --git a/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-011.html b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-011.html
new file mode 100644
index 00000000000..57335dc52d9
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-011.html
@@ -0,0 +1,43 @@
+
+
+
+
+ CSS Pseudo-Elements Test: active selection and color (basic)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Test passes if each glyph of "Selected Text" is green and not red while background color of each glyph of "Selected Text" is white.
+
+
Selected Text
diff --git a/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-012.html b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-012.html
new file mode 100644
index 00000000000..e40b0d2a0d2
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-012.html
@@ -0,0 +1,51 @@
+
+
+
+
+ CSS Pseudo-Elements Test: active selection and background-color (basic)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Test passes if the background color of each glyph of "Selected Text" is green and not red while each glyph of "Selected Text" is fuchsia.
+
+
Selected Text
diff --git a/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-014.html b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-014.html
new file mode 100644
index 00000000000..1bc244c800a
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-014.html
@@ -0,0 +1,55 @@
+
+
+
+
+ CSS Pseudo-Elements Test: active selection and text-decoration
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Test passes if each glyph of "Selected Text" is underlined and if color and background color of "Selected Text" are the OS-default highlight colors. The underline color must also be the same as the highlight color of "Selected Text".
+
+
Selected Text
diff --git a/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-016.html b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-016.html
new file mode 100644
index 00000000000..e5a56afe022
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-016.html
@@ -0,0 +1,46 @@
+
+
+
+
+ CSS Pseudo-Elements Test: active selection of partial text and color
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FAIL PASS FAIL
diff --git a/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-018.html b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-018.html
new file mode 100644
index 00000000000..ee7871c9503
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-pseudo/active-selection-018.html
@@ -0,0 +1,60 @@
+
+
+
+
+ CSS Pseudo-Elements Test: active selection, color and background-color
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Test passes if each glyph of "Selected Text" is green and if there is no red.
+
+
Selected Text FAIL
diff --git a/tests/wpt/web-platform-tests/css/css-pseudo/reference/active-selection-011-ref.html b/tests/wpt/web-platform-tests/css/css-pseudo/reference/active-selection-011-ref.html
new file mode 100644
index 00000000000..5c5fb091b85
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-pseudo/reference/active-selection-011-ref.html
@@ -0,0 +1,19 @@
+
+
+
+
+ CSS Reftest Reference
+
+
+
+
+
+ Test passes if each glyph of "Selected Text" is green and not red while background color of each glyph of "Selected Text" is white.
+
+
Selected Text
diff --git a/tests/wpt/web-platform-tests/css/css-pseudo/reference/active-selection-012-ref.html b/tests/wpt/web-platform-tests/css/css-pseudo/reference/active-selection-012-ref.html
new file mode 100644
index 00000000000..2faa69510d8
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-pseudo/reference/active-selection-012-ref.html
@@ -0,0 +1,21 @@
+
+
+
+
+ CSS Reftest Reference
+
+
+
+
+
+ Test passes if the background color of each glyph of "Selected Text" is green and not red while each glyph of "Selected Text" is fuchsia.
+
+
Selected Text
diff --git a/tests/wpt/web-platform-tests/css/css-pseudo/reference/active-selection-014-ref.html b/tests/wpt/web-platform-tests/css/css-pseudo/reference/active-selection-014-ref.html
new file mode 100644
index 00000000000..4a9dd309a01
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-pseudo/reference/active-selection-014-ref.html
@@ -0,0 +1,47 @@
+
+
+
+
+ CSS Reftest Reference
+
+
+
+
+
+
+
+
+
+ Test passes if each glyph of "Selected Text" is underlined and if color and background color of "Selected Text" are the OS-default highlight colors. The underline color must also be the same as the highlight color of "Selected Text".
+
+
Selected Text
diff --git a/tests/wpt/web-platform-tests/css/css-pseudo/reference/active-selection-016-ref.html b/tests/wpt/web-platform-tests/css/css-pseudo/reference/active-selection-016-ref.html
new file mode 100644
index 00000000000..cd80adb3c3b
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-pseudo/reference/active-selection-016-ref.html
@@ -0,0 +1,22 @@
+
+
+
+
+ CSS Reftest Reference
+
+
+
+
+
+ FAIL PASS
diff --git a/tests/wpt/web-platform-tests/css/css-pseudo/reference/selection-intercharacter-011-ref.html b/tests/wpt/web-platform-tests/css/css-pseudo/reference/selection-intercharacter-011-ref.html
index b0c60408f76..b3fa3531b3e 100644
--- a/tests/wpt/web-platform-tests/css/css-pseudo/reference/selection-intercharacter-011-ref.html
+++ b/tests/wpt/web-platform-tests/css/css-pseudo/reference/selection-intercharacter-011-ref.html
@@ -9,13 +9,16 @@
+
+
diff --git a/tests/wpt/web-platform-tests/fetch/range/resources/long-wav.py b/tests/wpt/web-platform-tests/fetch/range/resources/long-wav.py
index 8af2aca8a95..be7df7b83d8 100644
--- a/tests/wpt/web-platform-tests/fetch/range/resources/long-wav.py
+++ b/tests/wpt/web-platform-tests/fetch/range/resources/long-wav.py
@@ -118,12 +118,11 @@ def main(request, response):
bytes_remaining_to_send -= len(initial_write)
while bytes_remaining_to_send > 0:
- if not response.writer.flush():
- break
-
to_send = b'\x00' * min(bytes_remaining_to_send, sample_rate)
bytes_remaining_to_send -= len(to_send)
- response.writer.write(to_send)
+ if not response.writer.write(to_send):
+ break
+
# Throttle the stream
time.sleep(0.5)
diff --git a/tests/wpt/web-platform-tests/focus/focus-restoration-in-different-site-iframes.html b/tests/wpt/web-platform-tests/focus/focus-restoration-in-different-site-iframes.html
new file mode 100644
index 00000000000..3de05455651
--- /dev/null
+++ b/tests/wpt/web-platform-tests/focus/focus-restoration-in-different-site-iframes.html
@@ -0,0 +1,16 @@
+
+
+Test focus restoration
+
+
+
diff --git a/tests/wpt/web-platform-tests/focus/support/focus-restoration-in-different-site-iframes-inner.html b/tests/wpt/web-platform-tests/focus/support/focus-restoration-in-different-site-iframes-inner.html
new file mode 100644
index 00000000000..903b0c02858
--- /dev/null
+++ b/tests/wpt/web-platform-tests/focus/support/focus-restoration-in-different-site-iframes-inner.html
@@ -0,0 +1,37 @@
+
+
+
+
+ Inner document
+
+
+Inner
+
+
+
+
diff --git a/tests/wpt/web-platform-tests/focus/support/focus-restoration-in-different-site-iframes-other.html b/tests/wpt/web-platform-tests/focus/support/focus-restoration-in-different-site-iframes-other.html
new file mode 100644
index 00000000000..b302b909387
--- /dev/null
+++ b/tests/wpt/web-platform-tests/focus/support/focus-restoration-in-different-site-iframes-other.html
@@ -0,0 +1,7 @@
+
+
+
diff --git a/tests/wpt/web-platform-tests/focus/support/focus-restoration-in-different-site-iframes-outer.sub.html b/tests/wpt/web-platform-tests/focus/support/focus-restoration-in-different-site-iframes-outer.sub.html
new file mode 100644
index 00000000000..91ffed11075
--- /dev/null
+++ b/tests/wpt/web-platform-tests/focus/support/focus-restoration-in-different-site-iframes-outer.sub.html
@@ -0,0 +1,39 @@
+
+
+Focus restoration outer
+
+