Changeset 270032 in webkit


Ignore:
Timestamp:
Nov 19, 2020 8:34:39 AM (3 years ago)
Author:
Chris Dumez
Message:

Resync web-platform-tests/beacon tests from upstream
https://bugs.webkit.org/show_bug.cgi?id=219123

Reviewed by Sam Weinig.

Resync web-platform-tests/beacon tests from upstream dd35c2b21b76772123f7.

  • web-platform-tests/beacon/headers/header-content-type-and-body-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-expected.txt.
  • web-platform-tests/beacon/headers/header-content-type-and-body.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type.html.
  • web-platform-tests/beacon/headers/w3c-import.log:
  • web-platform-tests/beacon/resources/content-type-and-body.py: Renamed from LayoutTests/imported/w3c/web-platform-tests/beacon/resources/content-type.py.

(main):

  • web-platform-tests/beacon/resources/w3c-import.log:
Location:
trunk/LayoutTests
Files:
9 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/http/wpt/beacon/keepalive-after-navigation.html

    r220495 r270032  
    1414
    1515function pollResult(test, id) {
    16   var checkUrl = RESOURCES_DIR + "content-type.py?cmd=get&id=" + id;
     16  var checkUrl = RESOURCES_DIR + "content-type-and-body.py?cmd=get&id=" + id;
    1717
    1818  return new Promise(resolve => {
     
    3434
    3535    return pollResult(test, id).then(result => {
    36       assert_equals(result, "text/plain;charset=UTF-8", "Correct content-type header result");
     36      assert_equals(result, "text/plain;charset=UTF-8: test", "Correct content-type header result");
    3737    });
    3838  }, "Test that beacon sent from unload event handler is properly received");
  • trunk/LayoutTests/http/wpt/beacon/sendBeacon-in-pagehide.html

    r234684 r270032  
    1414
    1515function pollResult(test, id) {
    16   var checkUrl = RESOURCES_DIR + "content-type.py?cmd=get&id=" + id;
     16  var checkUrl = RESOURCES_DIR + "content-type-and-body.py?cmd=get&id=" + id;
    1717
    1818  return new Promise(resolve => {
     
    3737
    3838      return pollResult(test, id).then(result => {
    39         assert_equals(result, "text/plain;charset=UTF-8", "Correct content-type header result");
     39        assert_equals(result, "text/plain;charset=UTF-8: test", "Correct content-type header result");
    4040      });
    4141    }, "Test that beacon sent from pagehide event handler is properly received");
  • trunk/LayoutTests/http/wpt/beacon/support/sendBeacon-onpagehide-window.html

    r268400 r270032  
    1313<script>
    1414onpagehide = function() {
    15     const testUrl = RESOURCES_DIR + "content-type.py?cmd=put&id=" + id;
     15    const testUrl = RESOURCES_DIR + "content-type-and-body.py?cmd=put&id=" + id;
    1616    navigator.sendBeacon(testUrl, "test");   
    1717}
  • trunk/LayoutTests/http/wpt/beacon/support/sendBeacon-onunload-iframe.html

    r220304 r270032  
    1010
    1111function unload() {
    12     var testUrl = RESOURCES_DIR + "content-type.py?cmd=put&id=" + id;
     12    var testUrl = RESOURCES_DIR + "content-type-and-body.py?cmd=put&id=" + id;
    1313    navigator.sendBeacon(testUrl, "test");
    1414}
  • trunk/LayoutTests/http/wpt/fetch/fetch-in-pagehide.html

    r264698 r270032  
    1515function checkUrl(id)
    1616{
    17     return RESOURCES_DIR + "content-type.py?cmd=get&id=" + id;
     17    return RESOURCES_DIR + "content-type-and-body.py?cmd=get&id=" + id;
    1818}
    1919
     
    3232    assert_equals(response.status, 200);
    3333    const result = await response.text();
    34     assert_equals(result, "text/plain;charset=UTF-8", "Correct content-type header result");
     34    assert_equals(result, "text/plain;charset=UTF-8: test", "Correct content-type header result");
    3535}, "Test that fetch sent from pagehide event handler is properly received with keepalive");
    3636
  • trunk/LayoutTests/http/wpt/fetch/resources/fetch-in-pagehide-window.html

    r268400 r270032  
    1313<script>
    1414onpagehide = function() {
    15     const testUrl = RESOURCES_DIR + "content-type.py?cmd=put&id=" + id;
     15    const testUrl = RESOURCES_DIR + "content-type-and-body.py?cmd=put&id=" + id;
    1616    fetch(testUrl, { method : 'POST', headers : [["Content-Type", "text/plain;charset=UTF-8"]], body: 'test', keepalive : location.hash === "#keepalive" });   
    1717}
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r270031 r270032  
     12020-11-19  Chris Dumez  <cdumez@apple.com>
     2
     3        Resync web-platform-tests/beacon tests from upstream
     4        https://bugs.webkit.org/show_bug.cgi?id=219123
     5
     6        Reviewed by Sam Weinig.
     7
     8        Resync web-platform-tests/beacon tests from upstream dd35c2b21b76772123f7.
     9
     10        * web-platform-tests/beacon/headers/header-content-type-and-body-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-expected.txt.
     11        * web-platform-tests/beacon/headers/header-content-type-and-body.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type.html.
     12        * web-platform-tests/beacon/headers/w3c-import.log:
     13        * web-platform-tests/beacon/resources/content-type-and-body.py: Renamed from LayoutTests/imported/w3c/web-platform-tests/beacon/resources/content-type.py.
     14        (main):
     15        * web-platform-tests/beacon/resources/w3c-import.log:
     16
    1172020-11-19  Commit Queue  <commit-queue@webkit.org>
    218
  • trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-and-body.html

    r270031 r270032  
    1313const RESOURCES_DIR = "/beacon/resources/";
    1414
    15 function testContentTypeHeader(what, contentType, title) {
     15function testContentTypeAndBody(what, expected, title) {
    1616  function wait(ms) {
    1717    return new Promise(resolve => step_timeout(resolve, ms));
     
    1919  promise_test(async t => {
    2020    const id = self.token();
    21     const testUrl = new Request(RESOURCES_DIR + "content-type.py?cmd=put&id=" + id).url;
     21    const testUrl = new Request(RESOURCES_DIR + "content-type-and-body.py?cmd=put&id=" + id).url;
    2222    assert_equals(performance.getEntriesByName(testUrl).length, 0);
    2323    assert_true(navigator.sendBeacon(testUrl, what), "SendBeacon Succeeded");
     
    2727    } while (performance.getEntriesByName(testUrl).length === 0);
    2828    assert_equals(performance.getEntriesByName(testUrl).length, 1);
    29     const checkUrl = RESOURCES_DIR + "content-type.py?cmd=get&id=" + id;
     29    const checkUrl = RESOURCES_DIR + "content-type-and-body.py?cmd=get&id=" + id;
    3030    const response = await fetch(checkUrl);
    3131    const text = await response.text();
    32     if (contentType === "multipart/form-data") {
     32    if (expected.startsWith("multipart/form-data")) {
     33      const split = expected.split(":");
     34      const contentType = split[0];
     35      const contentDisposition = "Content-Disposition: form-data; name=\"" + split[1] + "\"; filename=\"blob\"";
    3336      assert_true(text.startsWith(contentType), "Correct Content-Type header result");
     37      assert_true(text.includes(contentDisposition), "Body included value");
    3438    } else {
    35       assert_equals(text, contentType, "Correct Content-Type header result");
     39      assert_equals(text, expected, "Correct Content-Type header result");
    3640    }
    3741  }, "Test content-type header for a body " + title);
     
    7579}
    7680
    77 testContentTypeHeader("hi!", "text/plain;charset=UTF-8", "string");
    78 testContentTypeHeader(stringToArrayBufferView("123"), "", "ArrayBufferView");
    79 testContentTypeHeader(stringToArrayBuffer("123"), "", "ArrayBuffer");
    80 testContentTypeHeader(stringToBlob("123"), "text/plain", "Blob");
    81 testContentTypeHeader(stringToFormData("qwerty"), "multipart/form-data", "FormData");
    82 testContentTypeHeader(stringToURLSearchParams("key1=value1&key2=value2"), "application/x-www-form-urlencoded;charset=UTF-8", "URLSearchParams");
     81testContentTypeAndBody("hi!", "text/plain;charset=UTF-8: hi!", "string");
     82testContentTypeAndBody(stringToArrayBufferView("123"), ": 1\0" + "2\0" + "3\0", "ArrayBufferView");
     83testContentTypeAndBody(stringToArrayBuffer("123"), ": 1\0" + "2\0" + "3\0", "ArrayBuffer");
     84testContentTypeAndBody(stringToBlob("123"), "text/plain: 123", "Blob");
     85testContentTypeAndBody(stringToFormData("qwerty"), "multipart/form-data:qwerty", "FormData");
     86testContentTypeAndBody(stringToURLSearchParams("key1=value1&key2=value2"), "application/x-www-form-urlencoded;charset=UTF-8: key1=value1&key2=value2", "URLSearchParams");
    8387    </script>
    8488  </body>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/w3c-import.log

    r253760 r270032  
    1515------------------------------------------------------------------------
    1616List of files:
    17 /LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type.html
     17/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-content-type-and-body.html
    1818/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-no-referrer-when-downgrade.https.html
    1919/LayoutTests/imported/w3c/web-platform-tests/beacon/headers/header-referrer-no-referrer.html
  • trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/content-type-and-body.py

    r270031 r270032  
    33    test_id = request.GET.first(b"id")
    44    if command == b"put":
    5         request.server.stash.put(test_id, request.headers.get(b"Content-Type", b""))
     5        request.server.stash.put(test_id, request.headers.get(b"Content-Type", b"") + b": " + request.body)
    66        return [(b"Content-Type", b"text/plain")], u""
    77
  • trunk/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/w3c-import.log

    r253760 r270032  
    1616List of files:
    1717/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/beacon.py
    18 /LayoutTests/imported/w3c/web-platform-tests/beacon/resources/content-type.py
     18/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/content-type-and-body.py
    1919/LayoutTests/imported/w3c/web-platform-tests/beacon/resources/inspect-header.py
Note: See TracChangeset for help on using the changeset viewer.